Announcement

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

  • -outreg2- reporting test statistics from -ivreghdfe-

    Hello Statalisters,

    I am running an IV model using -ivreghdfe- by S. Correia (2018). I tried running ivregress2, but it short-circuits when I cluster my standard errors. I have given my code below:
    Code:
    local all `r(varlist)'
    local demog "i.religion educ_lvl age hhheadsex" 
    local region "sexratio literacy"
    foreach var in y1 y2 y3{
    foreach x in x1 x2 x3 {
         ivreghdfe `var'  `demog' `region' (`x' = iv1 iv2), clust(region_name) first
        outreg2 using `x'.doc, append ctitle(`var') label addtext(Individual controls, Yes, AC Controls, Yes, Region Controls, Yes) keep(`x' ) 
        }
    }
    How do I export the test-statistics generated by -ivreghdfe-? I am particularly interested in the first-stage f-stat, Cragg-Donald Wald F statistic, Kleibergen-Paap rk Wald F statistic and the p-values of the Kleibergen-Paap rk LM statistic into the output tables. At the moment I am manually filling them out, but it is getting really out of hand with the sheer number of regressions I am running. Thanks a lot!

  • #2
    ivreghdfe and outreg2 are from SSC (FAQ Advice #12). See https://www.statalist.org/forums/for...-stage-outcome which illustrates for estout (SSC), but the procedure is similar for outreg2.

    Comment


    • #3
      Thank you Andrew, I tried to follow the advice you gave on the following posts: https://www.statalist.org/forums/for...-stage-outcome and https://www.statalist.org/forums/for...ng-r-e-scalars but I keep getting invalid syntax after the highlighted edits.

      Code:
      local all `r(varlist)'
      local demog "i.religion educ_lvl age hhheadsex"
      local region "sexratio literacy"
      foreach var in y1 y2 y3{
      foreach x in x1 x2 x3 {
      ivreghdfe `var' `demog' `region' (`x' = iv1 iv2), clust(region_name) first
      outreg2 using `x'.doc, append ctitle(`var') label addtext(Individual controls, Yes, AC Controls, Yes, Region Controls, Yes) keep(`x' ) //
      addstat(e(cdf), Cragg-Donald Wald F statistic,  e(rkf) , Kleibergen-Paap rk Wald F statistic , e(arf) Anderson-Rubin Wald test  , e(arfp) , ARF P-Value)   } }
      I get the error - Cragg, not found, Keibergen-Paap not found etc.
      Last edited by Lorien Nair; 18 Feb 2022, 02:07. Reason: Forgot to add the error message.

      Comment


      • #4
        I understand where the error in my code and was able to fix it by using the following edit .

        Code:
        outreg2 using `x'.doc, append ctitle(`var') label addtext(Individual controls, Yes, Region Controls, Yes) keep(`x') e(idstat cdf rkf arf arfp)
        Thank you Andrew, your previous posts and links were very helpful.

        Comment

        Working...
        X