Dear All,
As the title suggests, I found out that the output from ivreg2h when using both the generated and external instruments.
More specifically, in the process of generating the Lewbel (2012) instruments, ivreg2h did not use all the available exogenous variables in the endogenous filtering but only used the constant.
This can be temporarily fixed by disabling command line 664 and re-enabling command line 663 in ivreg2h.ado
The code below illustrates this error:
As the title suggests, I found out that the output from ivreg2h when using both the generated and external instruments.
More specifically, in the process of generating the Lewbel (2012) instruments, ivreg2h did not use all the available exogenous variables in the endogenous filtering but only used the constant.
This can be temporarily fixed by disabling command line 664 and re-enabling command line 663 in ivreg2h.ado
The code below illustrates this error:
Code:
* Setup
webuse abdata, clear
qui {
keep if year>1978 & year<1983
* Two results below are identical.
* (i) Result of ivreg2h
ivreg2h n w ys ( k = kL1), gen(iv_, replace)
estimates store result1
* (ii) Result of ivreg2 with generated IVs manual calculation
qui {
tempvar e_
reg k // Bug is in here! Regression k on constant only
predict double `e_', res
foreach var of varlist w ys {
sum `var', mean
gen double k_`var'_g = (`var'-r(mean))*`e_'
}
}
ivreg2 n w ys (k = kL1 k_w_g k_ys_g), orthog(kL1)
estimates store result2
}
esttab result1 result2, b(6) se(6) ///
stat(N r2_a sargan sarganp idstat idp widstat cstat cstatp, ///
l("N" "Adj R-sq" "Sargan" "Sargan p" "Underid" "Underid p" ///
"Cragg-Donald F" "C stat" "C p") ///
fmt(%9.0g %9.6f)) ///
mtit("IVREG2H" "Manual calc.")
Code:
--------------------------------------------
(1) (2)
IVREG2H Manual calc.
--------------------------------------------
k 0.820610*** 0.820610***
(0.014848) (0.014848)
w -0.405216*** -0.405216***
(0.090302) (0.090302)
ys 0.037689 0.037689
(0.271396) (0.271396)
_cons 2.502956 2.502956
(1.309752) (1.309752)
--------------------------------------------
N 560 560
Adj R-sq 0.843894 0.843894
Sargan 0.873115 0.873115
Sargan p 0.646257 0.646257
Underid 5.54e+02 5.54e+02
Underid p 0.000000 0.000000
Cragg-Dona~F 1.76e+04 1.76e+04
C stat 0.670040 0.670040
C p 0.413038 0.413038
--------------------------------------------
Standard errors in parentheses
* p<0.05, ** p<0.01, *** p<0.001

Comment