Announcement

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

  • esttab with stats: how to add ar2?

    Hi all,

    I am currently using esttab to export a bunch of regression results. Since I have manually created some FE and Controls labels (using estadd), I have to use stats option, which overwrites options like r2 or ar2 attached to esttab command directly. The problem is that stats() works well for r2, but doesn't work for ar2. For example, if I type esttab model*, stats(FE, Controls,N, ar2, label("FE" "Controls" "N" "Adjusted R^2")), the ar2 row is just blank. And it doesn't work if I include scalars(ar2) as an option. Does anyone know how to solve this? Thanks!

  • #2
    In general, the adjusted r-squared is stored in the estimation results as r2_a, not as ar2, as for example the output of help regress tells us.
    Code:
    . sysuse auto
    (1978 Automobile Data)
    
    . regress price length
    
          Source |       SS           df       MS      Number of obs   =        74
    -------------+----------------------------------   F(1, 72)        =     16.50
           Model |   118425867         1   118425867   Prob > F        =    0.0001
        Residual |   516639529        72  7175549.01   R-squared       =    0.1865
    -------------+----------------------------------   Adj R-squared   =    0.1752
           Total |   635065396        73  8699525.97   Root MSE        =    2678.7
    
    ------------------------------------------------------------------------------
           price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
          length |   57.20224   14.08047     4.06   0.000     29.13332    85.27115
           _cons |  -4584.899   2664.437    -1.72   0.090    -9896.357     726.559
    ------------------------------------------------------------------------------
    
    . ereturn list
    
    scalars:
                      e(N) =  74
                   e(df_m) =  1
                   e(df_r) =  72
                      e(F) =  16.5040845075474
                     e(r2) =  .1864782241337118
                   e(rmse) =  2678.721525601992
                    e(mss) =  118425867.2775322
                    e(rss) =  516639528.8440893
                   e(r2_a) =  .1751793105800135
                     e(ll) =  -688.0767132700388
                   e(ll_0) =  -695.7128688987767
                   e(rank) =  2
    
    macros:
                e(cmdline) : "regress price length"
                  e(title) : "Linear regression"
              e(marginsok) : "XB default"
                    e(vce) : "ols"
                 e(depvar) : "price"
                    e(cmd) : "regress"
             e(properties) : "b V"
                e(predict) : "regres_p"
                  e(model) : "ols"
              e(estat_cmd) : "regress_estat"
    
    matrices:
                      e(b) :  1 x 2
                      e(V) :  2 x 2
    
    functions:
                 e(sample)   
    
    .

    Comment


    • #3
      Originally posted by William Lisowski View Post
      In general, the adjusted r-squared is stored in the estimation results as r2_a, not as ar2, as for example the output of help regress tells us.
      Code:
      . sysuse auto
      (1978 Automobile Data)
      
      . regress price length
      
      Source | SS df MS Number of obs = 74
      -------------+---------------------------------- F(1, 72) = 16.50
      Model | 118425867 1 118425867 Prob > F = 0.0001
      Residual | 516639529 72 7175549.01 R-squared = 0.1865
      -------------+---------------------------------- Adj R-squared =  0.1752
      Total | 635065396 73 8699525.97 Root MSE = 2678.7
      
      ------------------------------------------------------------------------------
      price | Coef. Std. Err. t P>|t| [95% Conf. Interval]
      -------------+----------------------------------------------------------------
      length | 57.20224 14.08047 4.06 0.000 29.13332 85.27115
      _cons | -4584.899 2664.437 -1.72 0.090 -9896.357 726.559
      ------------------------------------------------------------------------------
      
      . ereturn list
      
      scalars:
      e(N) = 74
      e(df_m) = 1
      e(df_r) = 72
      e(F) = 16.5040845075474
      e(r2) = .1864782241337118
      e(rmse) = 2678.721525601992
      e(mss) = 118425867.2775322
      e(rss) = 516639528.8440893
      e(r2_a) = .1751793105800135
      e(ll) = -688.0767132700388
      e(ll_0) = -695.7128688987767
      e(rank) = 2
      
      macros:
      e(cmdline) : "regress price length"
      e(title) : "Linear regression"
      e(marginsok) : "XB default"
      e(vce) : "ols"
      e(depvar) : "price"
      e(cmd) : "regress"
      e(properties) : "b V"
      e(predict) : "regres_p"
      e(model) : "ols"
      e(estat_cmd) : "regress_estat"
      
      matrices:
      e(b) : 1 x 2
      e(V) : 2 x 2
      
      functions:
      e(sample)
      
      .
      Great! This works pretty well. Thanks!

      Comment

      Working...
      X