Announcement

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

  • Obtain Pseudo-R-Squared when using xtlogit

    Dear all,

    I am currently analyzing a panel dataset. My model consists of a binary dependent variable and three continuous independent variables. For my regression, I therefore use the command -xtlogit dv iv, re-. To interpret my model, literature always refers to pseudo R-squared, e.g. McFaddens R2, Nagelkerke R2 or Cox & Snell R2. However, the Stata output always comes without pseudo R-squared. Does anyone know, how I can obtain the Pseudo R-squared values when using the command -xtlogit-? Is it even possible to get Pseudo R2 when using -xt logit-?

    Thank you,
    Shakira

  • #2
    Shakira:
    try:
    Code:
    di  e(r2_p)
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      while -xtlogit, fe- stores pseudo-R-squared in e(), -xtlogit, re- does not.
      you might want to check out https://www.stata.com/support/faqs/s...ics/r-squared/

      Comment


      • #4
        Øyvind is correct. I missed the -re- specification in OP's query.
        Actually, -xtlogit,re- gives back -e(chi2)-.
        Kind regards,
        Carlo
        (StataNow 18.5)

        Comment


        • #5
          I do not see an issue calculating a Pseudo R-squared statistic given that xtlogit implements maximum likelihood estimation. McFadden's Pseudo R-squared has a very specific definition, and it gives you the improvement in the log-likelihood resulting from the addition of variables to the model, where the comparison model is the model with intercept only.

          $$\text{McFadden's Pseudo}\; R^{2}= 1 - \frac{L_{1}}{L_{0}}$$


          where \(L_1\) is the maximized log-likelihood from the full model and \(L_0\) is the log-likelihood from the model with intercept only. Here is a way to calculate the statistic by hand.

          Code:
          webuse union, clear
          qui xtlogit union age grade i.not_smsa south##c.year
          scalar l1= e(ll)
          qui xtlogit `e(depvar)' if e(sample)
          scalar l0= e(ll)
          scalar PR2= 1-(l1/l0)
          di "Pseudo R2 = "PR2
          Res.:

          Code:
          . qui xtlogit union age grade i.not_smsa south##c.year
          
          . scalar l1= e(ll)
          
          . qui xtlogit `e(depvar)' if e(sample)
          
          . scalar l0= e(ll)
          
          . scalar PR2= 1-(l1/l0)
          
          . di "Pseudo R2 = "PR2
          Pseudo R2 = .01100406

          Bill Gould offers the same advice in this Stata FAQ in the case of xtprobit.
          Last edited by Andrew Musau; 10 Jan 2022, 21:50.

          Comment

          Working...
          X