Announcement

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

  • R-sq and adj R-sq in xtreg, fixed effect

    Dear all,

    I am currently working on a panel data set in which i create a regression by code xtreg x y, fe. While doing this I can see the within, overall and between R-sq. I would like to know my R-sq and my adjusted R-sq for this data but I cannot seem to find it anywhere.

    Best regards,
    Clara

  • #2
    Hi Clara,
    Unfortunately, you wont find the Adjusted Rsq using -xtreg- command.
    In fact, you should be aware that the within, overall and between R2 are not comparable with the standard notion of R2s one uses with standard OLS.
    If you are interested in those R2s, perhaps you can look into "reghdfe" (by Sergio Correira), which reports both standard and adjusted R2.
    HTH
    Fernando

    Comment


    • #3
      Clara:
      as an side to Fernando's helpful advice, when dealing with -xtreg,fe- consider R2 within only.
      You can obtain adj R-sq from -ereturn list- (but I doubt it can be useful for across-model comparison as you would do with OLS):
      Code:
      . use "http://www.stata-press.com/data/r16/nlswork.dta"
      (National Longitudinal Survey.  Young Women 14-26 years of age in 1968)
      
      . xtreg ln_wage age,fe
      
      Fixed-effects (within) regression               Number of obs     =     28,510
      Group variable: idcode                          Number of groups  =      4,710
      
      R-sq:                                           Obs per group:
           within  = 0.1026                                         min =          1
           between = 0.0877                                         avg =        6.1
           overall = 0.0774                                         max =         15
      
                                                      F(1,23799)        =    2720.20
      corr(u_i, Xb)  = 0.0314                         Prob > F          =     0.0000
      
      ------------------------------------------------------------------------------
           ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
               age |   .0181349   .0003477    52.16   0.000     .0174534    .0188164
             _cons |   1.148214   .0102579   111.93   0.000     1.128107     1.16832
      -------------+----------------------------------------------------------------
           sigma_u |  .40635023
           sigma_e |  .30349389
               rho |  .64192015   (fraction of variance due to u_i)
      ------------------------------------------------------------------------------
      F test that all u_i=0: F(4709, 23799) = 8.81                 Prob > F = 0.0000
      
      
      . ereturn list
      
      scalars:
                     e(r2_w) =  .1025747671254915
                      e(F_f) =  8.807898505113039
                     e(rank) =  2
                     e(Tbar) =  6.053078556263269
                     e(Tcon) =  0
                    e(g_min) =  1
                    e(g_avg) =  6.053078556263269
                    e(g_max) =  15
                      e(N_g) =  4710
                  e(sigma_u) =  .4063502328846532
                     e(corr) =  .0313506604859547
                     e(r2_o) =  .0773811195932452
                     e(r2_b) =  .0876851602614176
                  e(sigma_e) =  .3034938911233301
                    e(sigma) =  .5071775366817735
                      e(rho) =  .6419201461924331
                        e(p) =  0
                      e(p_f) =  0
                     e(df_m) =  4710
                     e(df_b) =  1
                     e(ll_0) =  -5426.929832151553
                       e(ll) =  -3884.175784681907
                      e(tss) =  6516.690152088633
                     e(df_a) =  4709
                     e(r2_a) =  -.0750323948073182
                      e(rss) =  2192.091189848528
                      e(mss) =  250.5537342607759
                     e(rmse) =  .3034938911233301
                       e(r2) =  .1025747671254915
                        e(F) =  2720.200851719238
                     e(df_r) =  23799
                        e(N) =  28510
      
      macros:
                  e(cmdline) : "xtreg ln_wage age,fe"
                      e(cmd) : "xtreg"
             e(marginsnotok) : "E U UE SCore STDP XBU"
                  e(predict) : "xtrefe_p"
                    e(model) : "fe"
                      e(vce) : "conventional"
                     e(ivar) : "idcode"
                   e(depvar) : "ln_wage"
               e(properties) : "b V"
      
      matrices:
                        e(b) :  1 x 2
                        e(V) :  2 x 2
      
      functions:
                   e(sample)
      Kind regards,
      Carlo
      (Stata 19.0)

      Comment


      • #4
        Hi Carlo,
        That is (to me) good to know. I had to look into the manual to figure out how that Adjusted R2 is calculated. I have the feeling it double counts the number of degrees of freedom.
        Thank you
        Fernando

        Comment


        • #5
          FernandoRios, you are correct - the fixed effects are included in the adjustment which makes the statistic not very meaningful. See my comment in #9 of the following thread.

          https://www.statalist.org/forums/for...ted-as-missing

          Comment


          • #6
            Fernando and Andrew:
            instinctively, I would stay away from adjusted RSq when in comes to panel data.
            Thanks to you both for highlighting the degrees of freedom double-counting in adjusted RSq calculation process.
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment

            Working...
            X