Announcement

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

  • Pseduo R2 after xtmelogit

    Dear community,
    to calculate the pseudo R2 after my xtmelogit-estimation, I found this two possibilities:
    di "The McFadden pseudo-R2 is: " ( e(ll_c) - e(ll) )/e(ll_c)
    The McFadden pseudo-R2 is: .02392622

    . di "The Cox and Snell pseudo-R2 is: " 1 - exp( (-2*(e(ll)-e(ll_c))) /e(N))
    The Cox and Snell pseudo-R2 is: .02006514

    Both of them seem very low to me, since the Pseudo R2 in the single-level-(logit)-estimation was quite good. Now I found a formula in an article to calculate the pseudo R2 this way:
    for the single-level: 1 - (var(single-level full model) + var(context-level full model)) / (var(single-level Random intercept only model) + var(context-level RIOM)).
    for the context-level: 1 - (var(single-level full model)/average group size + var(context-level full model)) / (var(single-level Random intercept only model)/average group size + var(context-level RIOM)).

    My question is: How can I calculate each of those variances?

    Best,
    Kenny

  • #2

    Try to get Tjur R2 may be better:

    Tjur, T. (2009) “Coefficients of determination in logistic regression models—A new proposal: The coefficient of discrimination.” The American Statistician 63: 366-372.

    Code:
    sysuse auto , clear
    logit foreign weight mpg
    * Pseudo R2 = 0.3966
    
    predict yh if e(sample)
    reg foreign yh
    * R2 = 0.4110
    
    ttest yh , by(foreign)
    * Tjur R2 = |-0.4253| = 0.4253
    HTML Code:
    . sysuse auto , clear
    
    Logistic regression                               Number of obs   =         74
                                                      LR chi2(2)      =      35.72
                                                      Prob > chi2     =     0.0000
    Log likelihood = -27.175156                       Pseudo R2       =     0.3966
    
    ------------------------------------------------------------------------------
         foreign |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
          weight |  -.0039067   .0010116    -3.86   0.000    -.0058894    -.001924
             mpg |  -.1685869   .0919175    -1.83   0.067    -.3487418     .011568
           _cons |   13.70837   4.518709     3.03   0.002     4.851859    22.56487
    ------------------------------------------------------------------------------
    
    . * Pseudo R2 = 0.3966
    .  predict yh if e(sample)
    (option pr assumed; Pr(foreign))
    
    .  reg foreign yh
    
          Source |       SS       df       MS              Number of obs =      74
    -------------+------------------------------           F(  1,    72) =   50.25
           Model |  6.35452901     1  6.35452901           Prob > F      =  0.0000
        Residual |  9.10493045    72  .126457367           R-squared     =  0.4110
    -------------+------------------------------           Adj R-squared =  0.4029
           Total |  15.4594595    73  .211773417           Root MSE      =  .35561
    
    ------------------------------------------------------------------------------
         foreign |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
              yh |    .966399   .1363286     7.09   0.000      .694633    1.238165
           _cons |   .0099895   .0578928     0.17   0.863    -.1054177    .1253966
    ------------------------------------------------------------------------------
    . * R2 = 0.4110
    
    .  ttest yh , by(foreign)
    
    Two-sample t test with equal variances
    ------------------------------------------------------------------------------
       Group |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
    ---------+--------------------------------------------------------------------
    Domestic |      52    .1708459    .0318593    .2297409    .1068857    .2348062
     Foreign |      22    .5961823    .0533607     .250284    .4852126     .707152
    ---------+--------------------------------------------------------------------
    combined |      74    .2972973    .0354902    .3052979    .2265655    .3680291
    ---------+--------------------------------------------------------------------
        diff |           -.4253364    .0600016               -.5449475   -.3057254
    ------------------------------------------------------------------------------
        diff = mean(Domestic) - mean(Foreign)                         t =  -7.0887
    Ho: diff = 0                                     degrees of freedom =       72
    
        Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
     Pr(T < t) = 0.0000         Pr(|T| > |t|) = 0.0000          Pr(T > t) = 1.0000
    
    . * Tjur R2 = |-0.4253| = 0.4253
    Emad A. Shehata
    Professor (PhD Economics)
    Agricultural Research Center - Agricultural Economics Research Institute - Egypt
    Email: [email protected]
    IDEAS: http://ideas.repec.org/f/psh494.html
    EconPapers: http://econpapers.repec.org/RAS/psh494.htm
    Google Scholar: http://scholar.google.com/citations?...r=cOXvc94AAAAJ

    Comment


    • #3
      Thank you Emad, but I'm looking for a R2 after xtmelogit, not after logit. At xtmelogit you need to R2's: one for the single level and one for the contextual level..

      Comment

      Working...
      X