Announcement

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

  • Using estat icc as postestimation after melogit

    Dear all,

    I am running a multilevel mixed effects logistic regression model using melogit. I want to use the postestimation estat icc to get an output for the intracluster correlation cofficient for each level of the random effects (I have two levels). According to the stata manual, the command estat icc is for use after estimation with mixed, meintreg, metobit, melogit, meqrlogit, and meprobit. However, when I run the command written below, I get this reply: requested action not valid after most recent estimation command r(321);.
    I use STATA 15.

    Command:

    meologit bloedning treat##tiddataindsamling oest_vest##tiddataindsamling iv_foedsler##tiddataindsamling ib2.alder_kat_3 i.par_kat i.kons_ny ib2.GA_kat || hospital_samtykke: || hospital_samtykke_tid:, or

    estat icc

    Does anyone know why this error occurs and how to be able to compute the ICC after my regression model?

    Kind regards,
    Trine Damsted.



  • #2
    NOTE: The discussion here relates to meologit, but it applies to melogit as well.

    I think the capability was added in Stata 16. I can replicate your error in version 15. Either get a hold of Stata 15+ or compute the ICC by hand. For a 3-level mixed-effects ordered logit regression

    $$\text{ICC}_{1}= \frac{Var(\_cons_{1})}{Var(\_cons_{1})+ Var(\_cons_{2}) + \frac{\text{pi}^{2}}{3}}$$

    and

    $$\text{ICC}_{2}=\text{ICC}_{1}+ \frac{Var(\_cons_{2})}{Var(\_cons_{1})+ Var(\_cons_{2}) + \frac{\text{pi}^{2}}{3}}$$


    Use the option -coeflegend- in the command to see how those variance estimates are named.


    Code:
    webuse tvsfpors
    meologit thk prethk cc##tv || school: || class:, or nolog
    estat icc
    di _b[/var(_cons[school])]/ (_b[/var(_cons[school])]+  _b[/var(_cons[school>class])] + (_pi^2/3))
    scalar icc1= _b[/var(_cons[school])]/ (_b[/var(_cons[school])]+  _b[/var(_cons[school>class])] + (_pi^2/3))
    di icc1 + _b[/var(_cons[school>class])]/ (_b[/var(_cons[school])]+  _b[/var(_cons[school>class])] + (_pi^2/3))
    Res.:

    Code:
    . estat icc
    
    Residual intraclass correlation
    
    ------------------------------------------------------------------------------
                           Level |        ICC   Std. Err.     [95% Conf. Interval]
    -----------------------------+------------------------------------------------
                          school |   .0128837   .0121247      .0020104    .0779697
                    class|school |   .0554383   .0178729      .0291869    .1028006
    ------------------------------------------------------------------------------
    
    .
    . di _b[/var(_cons[school])]/ (_b[/var(_cons[school])]+  _b[/var(_cons[school>class])] + (_pi^2/3))
    .01288374
    
    .
    . scalar icc1= _b[/var(_cons[school])]/ (_b[/var(_cons[school])]+  _b[/var(_cons[school>class])] + (_pi^2/3))
    
    .
    . di icc1 + _b[/var(_cons[school>class])]/ (_b[/var(_cons[school])]+  _b[/var(_cons[school>class])] + (_pi^2/3))
    .05543829

    ADDED IN EDIT:

    For an extension of the example to melogit, consider

    Code:
    webuse tvsfpors
    tab thk
    gen thk2= thk>2
    melogit thk2 prethk cc##tv || school: || class:, or nolog
    estat icc
    di _b[/var(_cons[school])]/ (_b[/var(_cons[school])]+  _b[/var(_cons[school>class])] + (_pi^2/3))
    scalar icc1= _b[/var(_cons[school])]/ (_b[/var(_cons[school])]+  _b[/var(_cons[school>class])] + (_pi^2/3))
    di icc1 + _b[/var(_cons[school>class])]/ (_b[/var(_cons[school])]+  _b[/var(_cons[school>class])] + (_pi^2/3))
    Res.:

    Code:
    . estat icc
    
    Residual intraclass correlation
    
    ------------------------------------------------------------------------------
                           Level |        ICC   Std. Err.     [95% Conf. Interval]
    -----------------------------+------------------------------------------------
                          school |   .0178766   .0173592      .0026144    .1122118
                    class|school |    .064756   .0224644      .0323835    .1252994
    ------------------------------------------------------------------------------
    
    . 
    . di _b[/var(_cons[school])]/ (_b[/var(_cons[school])]+  _b[/var(_cons[school>class])] + (_pi^2/3))
    .01787659
    
    . 
    . scalar icc1= _b[/var(_cons[school])]/ (_b[/var(_cons[school])]+  _b[/var(_cons[school>class])] + (_pi^2/3))
    
    . 
    . di icc1 + _b[/var(_cons[school>class])]/ (_b[/var(_cons[school])]+  _b[/var(_cons[school>class])] + (_pi^2/3))
    .064756
    Last edited by Andrew Musau; 06 Oct 2021, 05:07.

    Comment

    Working...
    X