Announcement

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

  • ESTTAB Command Help

    I have 4 models (OLS, Fixed Effects, Random Effects and a Fixed Effect Differenced) which I have stored using the eststo command and am trying to use esttab to get certain scalars to be reported as an output table so that I can format the resulting table for an article. I am interested in the following scalars r2 df_2 F Sigma u,the Rho statistic and the standard errors of the estimates (SEE) or square root of mean squared errors (SRMSE).

    The current code I'm using (which only gets me part of the way) is
    Code:
    esttab, label mtitles scalars (F p_value  df_r  r2)
    I am unsure how to find the scalar equivalent to SEE, SRMSE, Rho, the actual F-test(model) and how to add stars to the F-test and Effect Test in the output. Please advise. Should I simply run a display after each model and record it so that I can edit the table manually or is there any easy way to get this using the scalar function?

    Fixed/Random Effects Statistics Highlighted in Bold:
    Code:
    . xtreg $ylist l.lnannualjobs d.pct_aanh pct_poverty pct_totaldegrees d.ln_empstable avgstateincentive, fe i(county)
    
    Fixed-effects (within) regression               Number of obs     =        555
    Group variable: county                          Number of groups  =         37
    
    R-sq:                                           Obs per group:
         within  = 0.4762                                         min =         15
         between = 0.9936                                         avg =       15.0
         overall = 0.9787                                         max =         15
    
                                                    F(6,512)          =      77.58
    corr(u_i, Xb)  = 0.9691                         Prob > F          =     0.0000
    
    -----------------------------------------------------------------------------------
         lnannualjobs |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    ------------------+----------------------------------------------------------------
         lnannualjobs |
                  L1. |   .5567163   .0347663    16.01   0.000     .4884142    .6250184
                      |
             pct_aanh |
                  D1. |   .0010539   .0020719     0.51   0.611    -.0030166    .0051243
                      |
          pct_poverty |   .0129627    .003774     3.43   0.001     .0055482    .0203772
     pct_totaldegrees |   .0129081   .0067972     1.90   0.058    -.0004457    .0262619
                      |
         ln_empstable |
                  D1. |   .7517452   .0451105    16.66   0.000     .6631207    .8403697
                      |
    avgstateincentive |  -2.518008   5.451199    -0.46   0.644    -13.22748    8.191461
                _cons |   3.582079   .3671468     9.76   0.000     2.860779    4.303379
    ------------------+----------------------------------------------------------------
              sigma_u |  .54256832
              sigma_e |  .13076773
                  rho |  .94510027   (fraction of variance due to u_i)
    -----------------------------------------------------------------------------------
    F test that all u_i=0: F(36, 512) = 5.14                     Prob > F = 0.0000
    OLS Statistics Needed Highlighted in Bold
    Code:
    reg $ylist $xlist if obs!=219
    
          Source |       SS           df       MS      Number of obs   =       591
    -------------+----------------------------------   F(5, 585)       =    213.57
           Model |  592.562504         5  118.512501   Prob > F        =    0.0000
        Residual |  324.625907       585  .554916081   R-squared       =    0.6461
    -------------+----------------------------------   Adj R-squared   =    0.6430
           Total |  917.188411       590  1.55455663   Root MSE        =    .74493
    
    -----------------------------------------------------------------------------------
         lnannualjobs |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    ------------------+----------------------------------------------------------------
             pct_aanh |  -.0086078   .0026004    -3.31   0.001     -.013715   -.0035006
          pct_poverty |     .01679   .0085872     1.96   0.051    -.0000755    .0336555
     pct_totaldegrees |  -.0146091   .0230061    -0.64   0.526    -.0597936    .0305755
         ln_empstable |   .8816694   .0474711    18.57   0.000     .7884349    .9749039
    avgstateincentive |  -30.33077   25.47656    -1.19   0.234    -80.36743    19.70589
                _cons |   .9807619   .9065059     1.08   0.280    -.7996406    2.761164
    -----------------------------------------------------------------------------------
    Apologies for the long post, I wanted to provide as much detail as possible. Many thanks in advance.

  • #2
    esttab is from Stata Journal. Most of these statistics will be available from ereturn list. If not, you can reproduce them, so there will be no need to insert anything manually.

    Code:
    sysuse auto
    qui regress mpg weight disp
    ereturn list
    Res.:

    Code:
    scalars:
                      e(N) =  74
                   e(df_m) =  2
                   e(df_r) =  71
                      e(F) =  66.78504752026517
                     e(r2) =  .6529306984682528
                   e(rmse) =  3.45606176570828
                    e(mss) =  1595.409691543724
                    e(rss) =  848.0497679157351
                   e(r2_a) =  .643154098425105
                     e(ll) =  -195.2397979466294
                   e(ll_0) =  -234.3943376482347
                   e(rank) =  3
    So in the esttab command, specify

    Code:
    esttab, stats(F rmse rss, star(F))
    Res.:

    Code:
    . esttab, stats(F rmse rss, star(F))
    
    ----------------------------
                          (1)   
                          mpg   
    ----------------------------
    weight           -0.00657***
                      (-5.63)   
    
    displacement      0.00528   
                       (0.54)   
    
    _cons               40.08***
                      (19.84)   
    ----------------------------
    F                   66.79***
    rmse                3.456   
    rss                 848.0   
    ----------------------------
    t statistics in parentheses
    * p<0.05, ** p<0.01, *** p<0.001

    Similarly, you can get your wanted statistics from xtreg.
    Last edited by Andrew Musau; 27 May 2020, 01:55.

    Comment


    • #3
      Thanks, Andrew. I knew it was something like that. I read everything about making tables using esttab, but didn’t consider looking at the stored scalars in xtreg for my answer.

      Comment

      Working...
      X