Announcement

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

  • reghdfe command with outtex (or outreg 2)

    Hi All,

    I am currently using the reghdfe command to estimate a model with a large number of fixed effects. Moreover, I have an instrument for my endogenous variable x (z), which I am able to account for upon installation of the ivreg2 command. The command that I am using presently is of the form:

    Code:
    reghdfe y (x=z), absorb (beta=fe)
    What I wish to do is to use the outtex command (or the outreg2 command) that includes not only the point estimate of x along with its SE and R2 of the regression, but also the first stage results, including the underidentification test, weak identification test and Sargan statistic etc. Presently, using the outtex command only produces the second stage estimate. Any suggestions are most welcome.


    Thanks!

  • #2
    So I believe outreg2 will export both the 1st and the 2nd stage to Excel side-by-side (at least it does for Heckman two-stage when it was called treatreg (treatreg is now etregress). To add additional statistics to the output, you use the option addstat.

    Code:
    outreg2 using "output_file", bdec(4) rdec(3) adec(2) bracket nolabel ///
    addstat(Chi-squared, e(chi2), Prob > Chi2, e(p)) ctitle(3rd model) append
    So the addstat syntax you first put what you want outreg2 to call it (i.e. "Chi-squared") and then after the comma call the statistic from the stored results in e(). (In this case e(chi2).

    So if you type in help ivreg2, then do a CTRL + F and search for "stored results" you can see what ivreg2 stores and what it calls them.

    Code:
    ivreg2 saves the following results in e():
    
    Scalars
       e(N)          Number of observations
    [SNIP - I removed a bunch of them]
    
       e(sargan)     Sargan statistic
       e(sarganp)    p-value of Sargan statistic
       e(sargandf)   dof of Sargan statistic = degree of overidentification = L-K
       e(j)          Hansen J statistic
       e(jp)         p-value of Hansen J statistic
       e(jdf)        dof of Hansen J statistic = degree of overidentification = L-K
       e(arubin)     Anderson-Rubin overidentification LR statistic N*ln(lambda)
       e(arubinp)    p-value of Anderson-Rubin overidentification LR statistic
       e(arubin_lin) Anderson-Rubin linearized overidentification statistic N*(lambda-1)
       e(arubin_linp)p-value of Anderson-Rubin linearized overidentification statistic
       e(arubindf)   dof of A-R overid statistic = degree of overidentification = L-K
       e(idstat)     LM test statistic for underidentification (Anderson or Kleibergen-Paap)
       e(idp)        p-value of underidentification LM statistic
       e(iddf)       dof of underidentification LM statistic
       e(widstat)    F statistic for weak identification (Cragg-Donald or Kleibergen-Paap)
       e(arf)        Anderson-Rubin F-test of significance of endogenous regressors
       e(arfp)       p-value of Anderson-Rubin F-test of endogenous regressors
       e(archi2)     Anderson-Rubin chi-sq test of significance of endogenous regressors
       e(archi2p)    p-value of Anderson-Rubin chi-sq test of endogenous regressors
       e(ardf)       degrees of freedom of Anderson-Rubin tests of endogenous regressors
       e(ardf_r)     denominator degrees of freedom of AR F-test of endogenous regressors
       e(redstat)    LM statistic for instrument redundancy
    
    [Etc. - a bunch more after this]
    So, you might do
    Code:
    outreg2 using "output_file", addstat(Sargan statistic, e(sargan), Prob > Sargan, e(sarganp), F-stat for weak identification, e(widstat)) append
    And so on. I believe addstat() can be as long as you would like. If it is really long, it might make sense to store what you want as a local macro.

    For example, when I use outreg2 to output regressions, I normally do the following:
    Code:
    local outreg_file "cvc3_table3_techmeasures_reviewer1"
    local outreg_line1 "excel bdec(4) rdec(3) se bracket addstat(F test: , e(F)) adec(3)"
    
    reg car4_250_100 ln_cvcount3 `rhsvars' if good==1, cluster(acq_gvkey)
    outreg2 using `outreg_file', `outreg_line1' ctitle("CVC investments only") append
    Last edited by David Benson; 13 Nov 2018, 20:23.

    Comment


    • #3
      According to author's website,
      Reghdfe comes with a “secret” command (estfe) that allows for neat output tables
      I believe it can give you nice output similar to esttab/estout.

      Comment

      Working...
      X