Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Gllamm Syntax - Specifying Level 1 & Level 2 Variables?

    Hi, I'm looking for a way to do weighted multilevel ordinal logit models in an older version of Stata, and I found gllamm when researching this online. My only question is, does this package somehow "know" which variables are at level 1 vs. level 2? I don't see a way to specify in the syntax which belong on which level.

  • #2
    gllamm is from SSC (FAQ Advice #12). Here is a replication of a three-level mixed-effects ordered logit regression estimated using meologit.

    Code:
    webuse tvsfpors, clear
    meologit thk prethk cc##tv || school: || class:
    gen cctv= c.cc#c.tv
    gllamm thk prethk cc tv cctv,  link(ologit) fam(binom) i(class school)
    Res.:

    Code:
    . meologit thk prethk cc##tv || school: || class:
    
    Fitting fixed-effects model:
    
    Iteration 0:   log likelihood =  -2212.775  
    Iteration 1:   log likelihood =  -2125.509  
    Iteration 2:   log likelihood = -2125.1034  
    Iteration 3:   log likelihood = -2125.1032  
    
    Refining starting values:
    
    Grid node 0:   log likelihood = -2152.1514
    
    Fitting full model:
    
    Iteration 0:   log likelihood = -2152.1514  (not concave)
    Iteration 1:   log likelihood = -2125.9213  (not concave)
    Iteration 2:   log likelihood = -2120.1861  
    Iteration 3:   log likelihood = -2115.6177  
    Iteration 4:   log likelihood = -2114.5896  
    Iteration 5:   log likelihood = -2114.5881  
    Iteration 6:   log likelihood = -2114.5881  
    
    Mixed-effects ologit regression                 Number of obs     =      1,600
    
    -------------------------------------------------------------
                    |     No. of       Observations per Group
     Group Variable |     Groups    Minimum    Average    Maximum
    ----------------+--------------------------------------------
             school |         28         18       57.1        137
              class |        135          1       11.9         28
    -------------------------------------------------------------
    
    Integration method: mvaghermite                 Integration pts.  =          7
    
                                                    Wald chi2(4)      =     124.39
    Log likelihood = -2114.5881                     Prob > chi2       =     0.0000
    ------------------------------------------------------------------------------
             thk |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
          prethk |   .4085273    .039616    10.31   0.000     .3308814    .4861731
            1.cc |   .8844369   .2099124     4.21   0.000     .4730161    1.295858
            1.tv |    .236448   .2049065     1.15   0.249    -.1651614    .6380575
                 |
           cc#tv |
            1 1  |  -.3717699   .2958887    -1.26   0.209     -.951701    .2081612
    -------------+----------------------------------------------------------------
           /cut1 |  -.0959459   .1688988                     -.4269815    .2350896
           /cut2 |   1.177478   .1704946                      .8433151    1.511642
           /cut3 |   2.383672   .1786736                      2.033478    2.733865
    -------------+----------------------------------------------------------------
    school       |
       var(_cons)|   .0448735   .0425387                      .0069997    .2876749
    -------------+----------------------------------------------------------------
    school>class |
       var(_cons)|   .1482157   .0637521                       .063792    .3443674
    ------------------------------------------------------------------------------
    LR test vs. ologit model: chi2(2) = 21.03                 Prob > chi2 = 0.0000
    
    Note: LR test is conservative and provided only for reference.
    
    . 
    . gen cctv= c.cc#c.tv
    
    . 
    . gllamm thk prethk cc tv cctv,  link(ologit) fam(binom) i(class school)
    
    Iteration 0:   log likelihood = -2121.6111  
    Iteration 1:   log likelihood = -2120.8482  (not concave)
    Iteration 2:   log likelihood = -2114.8798  
    Iteration 3:   log likelihood = -2114.5888  
    Iteration 4:   log likelihood = -2114.5882  
    Iteration 5:   log likelihood = -2114.5882  
     
    number of level 1 units = 1600
    number of level 2 units = 135
    number of level 3 units = 28
     
    Condition Number = 16.629801
     
    gllamm model 
     
    log likelihood = -2114.5882
     
    ------------------------------------------------------------------------------
             thk |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    thk          |
          prethk |   .4085236   .0396155    10.31   0.000     .3308787    .4861686
              cc |   .8842381   .2097764     4.22   0.000     .4730839    1.295392
              tv |    .236287    .204821     1.15   0.249    -.1651549    .6377288
            cctv |  -.3716533    .295649    -1.26   0.209    -.9511147    .2078081
    -------------+----------------------------------------------------------------
    _cut11       |
           _cons |  -.0961664   .1690369    -0.57   0.569    -.4274727    .2351399
    -------------+----------------------------------------------------------------
    _cut12       |
           _cons |   1.177255   .1706313     6.90   0.000     .8428241    1.511686
    -------------+----------------------------------------------------------------
    _cut13       |
           _cons |   2.383446   .1787996    13.33   0.000     2.033005    2.733887
    ------------------------------------------------------------------------------
     
     
    Variances and covariances of random effects
    ------------------------------------------------------------------------------
    
     
    ***level 2 (class)
     
        var(1): .14819423 (.0637178)
     
    ***level 3 (school)
     
        var(1): .04489426 (.04254136)
    ------------------------------------------------------------------------------
    
     
    
    .

    Comment

    Working...
    X