1

I'm running ivreg2 in Stata and am unable to export the first-stage coefficient and sd into the LaTeX output. However, I can export the F-stat of IV in the first stage. I'm only interested in the IV estimate, so the 2SLS coefficient on the endogenous regressor being instrumented. In the reproducible example below, weight is an exogenous regressor.

*ssc install estout, replace
*ssc install ivreg2, replace

sysuse auto, clear
eststo clear

gen rep = (rep78 > = 4)
summ mpg
gen mpgx = (mpg > = `r(mean)')
summ trunk
gen trunkx = (trunk > = `r(mean)')
 
eststo: ivreg2 price weight (foreign = mpgx) if rep == 1 , savefirst first
estadd scalar fiv = e(F)

eststo: ivreg2 price weight (foreign = mpgx) if rep == 0 , savefirst first
estadd scalar fiv = e(F)

eststo: ivreg2 price weight (foreign = mpgx) if trunkx == 1 , savefirst first
estadd scalar fiv = e(F)

eststo: ivreg2 price weight (foreign = mpgx) if trunkx == 0 , savefirst first
estadd scalar fiv = e(F)


 esttab using "iv_test.tex", replace   ///
 b(3) se(3) star(* 0.10 ** 0.05 *** 0.01) ///
 label booktabs nonotes nomtitle collabels(none)  ///
 scalars("fiv IV F-stat")  ///
    keep(foreign) /// it's not allowing me to keep the first stage coef on mpgx
 mgroups("Repair" "Trunk", pattern(1 0 1 0) ///
 prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))

I will be grateful for any help!

aimalik
  • 13
  • 4
  • For this to be reproducible, the user needs to install the community-contributed commands mentioned. – Nick Cox Sep 30 '22 at 09:42

0 Answers0