Announcement

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

  • Itraclass correlation for multilevel models, gllamm

    Hello,

    I am trying to figure out how to calculate intraclass correlation (ICC) for a three level model using gllamm, a user-contributed command for multilevel modeling. gllamm does not accept the "estat icc" option. From what I am seeing online, I believe there is not a simple command for ICC with gllamm, and that I have to write out the formula for ICC. To start with, I am trying to find the unconditional ICC for the levels in my model.

    Here is my unconditional model:

    Code:
    gllamm Garden_Active_, i(Garden_ID LGardenZip_) family(binomial) link(logit)  nip(30) adapt
    And here is my output:

    Code:
    gllamm Garden_Active_, i(Garden_ID LGardenZip_) family(binomial) link(logit)  nip(30) adapt
    
    Running adaptive quadrature
    Iteration 0:    log likelihood = -2718.5586
    Iteration 1:    log likelihood =  -2606.836
    Iteration 2:    log likelihood = -2600.9528
    Iteration 3:    log likelihood = -2600.8307
    Iteration 4:    log likelihood = -2600.8307
    
    
    Adaptive quadrature has converged, running Newton-Raphson
    Iteration 0:   log likelihood = -2600.8307  
    Iteration 1:   log likelihood = -2600.8307  (backed up)
    Iteration 2:   log likelihood = -2600.7843  
    Iteration 3:   log likelihood = -2600.7388  
    Iteration 4:   log likelihood = -2600.7386  
     
    number of level 1 units = 4035
    number of level 2 units = 2432
    number of level 3 units = 31
     
    Condition Number = 2.1411013
     
    gllamm model 
     
    log likelihood = -2600.7386
     
    --------------------------------------------------------------------------------
    Garden_Active_ |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    ---------------+----------------------------------------------------------------
             _cons |  -.0779572   .0776656    -1.00   0.315     -.230179    .0742645
    --------------------------------------------------------------------------------
     
     
    Variances and covariances of random effects
    ------------------------------------------------------------------------------
    
     
    ***level 2 (Garden_ID)
     
        var(1): 4.6620217 (.59617179)
     
    ***level 3 (LGardenZip_)
     
        var(1): .01965498 (.03711558)
    ------------------------------------------------------------------------------
    However, I'm not understanding the formula and what numbers I need to plug in to calculate ICC for my level 2 and 3. Could anyone please help?

    Many thanks,
    Alyssa

  • #2
    You can just use the formula

    Code:
    ICC1= var(_cons1)/(var(_cons1)+ var(_cons2) + (pi)^2/3)
    ICC2= var(_cons2)/(var(_cons1)+ var(_cons2) + (pi)^2/3)
    where var(_consj) is the variance of the random intercept j. I think you should also be able to estimate the above model with -xtmelogit- which allows you to use -estat icc- for comparison with your calculations.

    Comment


    • #3
      Hi Andrew,

      Thanks for your answer. Just to make sure I understand, to determine the ICC for my level 3, it would be .01965498/(.01965498+4.6620217+pi2/3)
      and for my level 2 it would be 4.6620217/(.01965498+4.6620217+pi2/3) ?

      Many thanks,
      Alyssa

      Comment


      • #4
        For the lowest level, it should be the sum of both variances, which I neglected to include in #2. See the following example

        Code:
        . webuse towerlondon
        (Tower of London data)
        
        . melogit dtlm difficulty i.group || family: || subject:, nolog
        
        Mixed-effects logistic regression               Number of obs     =        677
        
        -------------------------------------------------------------
                        |     No. of       Observations per Group
         Group Variable |     Groups    Minimum    Average    Maximum
        ----------------+--------------------------------------------
                 family |        118          2        5.7         27
                subject |        226          2        3.0          3
        -------------------------------------------------------------
        
        Integration method: mvaghermite                 Integration pts.  =          7
        
                                                        Wald chi2(3)      =      74.90
        Log likelihood = -305.12041                     Prob > chi2       =     0.0000
        --------------------------------------------------------------------------------
                  dtlm |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
        ---------------+----------------------------------------------------------------
            difficulty |  -1.648505   .1932075    -8.53   0.000    -2.027185   -1.269826
                       |
                 group |
                    2  |  -.2486841   .3544076    -0.70   0.483    -.9433102     .445942
                    3  |  -1.052306   .3999921    -2.63   0.009    -1.836276   -.2683357
                       |
                 _cons |  -1.485863   .2848455    -5.22   0.000     -2.04415   -.9275762
        ---------------+----------------------------------------------------------------
        family         |
             var(_cons)|   .5692105   .5215654                      .0944757    3.429459
        ---------------+----------------------------------------------------------------
        family>subject |
             var(_cons)|   1.137917   .6854853                      .3494165    3.705762
        --------------------------------------------------------------------------------
        LR test vs. logistic model: chi2(2) = 17.54               Prob > chi2 = 0.0002
        
        Note: LR test is conservative and provided only for reference.
        
        . estat icc
        
        Residual intraclass correlation
        
        ------------------------------------------------------------------------------
                               Level |        ICC   Std. Err.     [95% Conf. Interval]
        -----------------------------+------------------------------------------------
                              family |   .1139105   .0997727      .0181851    .4715289
                      subject|family |   .3416307   .0889471       .192923    .5297291
        ------------------------------------------------------------------------------
        
        
        
        . di .5692105/ (.5692105 + 1.137917+ c(pi)^2/3)
        .11391055
        
        . di (.5692105+1.137917) / (.5692105 + 1.137917+ c(pi)^2/3)
        .34163078

        Comment

        Working...
        X