Dear All,
I need to estimate an IV model with Heckman correction with bootstrapped standard errors. Since I need to estimate more models, including augmented set of regressors, I was going to generate a loop. Specifically I have:
Stata stops at this point:
Outside the loop I do not have any problem in running the code. I cannot figure out what is going wrong.The reported error message is not informative. For sure I did not press any break. Any suggestion would be greatly appreciated.
Thanks in advance,
Dario
I need to estimate an IV model with Heckman correction with bootstrapped standard errors. Since I need to estimate more models, including augmented set of regressors, I was going to generate a loop. Specifically I have:
Code:
local heck1 ""
local heck2 "$demo $school"
local heck3 "$demo $school $traits"
local heck4 "$demo $school $traits $par_edu $par_occ $par_sect"
local heck5 "$demo $school $traits $par_edu $par_occ $par_sect $geo"
forval i=1/5 {
cap program drop myboot
cap drop fitted imr
program define myboot, eclass
preserve
probit credits_dummy $instruments heck`i' log_isee1
predict fitted, xb
gen imr = normalden(fitted) / normal(fitted)
ivreg2 std_gpa (autonuni=$instruments) imr heck`i', cluster(cds) endog(autonuni) first
matrix b=e(b)
ereturn post b
ereturn local cmd="bootstrap"
restore
end
bootstrap _b, seed(12345) reps(500): myboot
est store heck`i'
}
Code:
forval i=1/5 {
2. cap program drop myboot
3. cap drop fitted imr
4. program define myboot, eclass
5. preserve
6. probit credits_dummy $instruments heck`i' log_isee1
7. predict fitted, xb
8. gen imr = normalden(fitted) / normal(fitted)
9. ivreg2 std_gpa (autonuni=$instruments) imr heck`i', cluster(cds) en
> dog(autonuni) first
10. matrix b=e(b)
11. ereturn post b
12. ereturn local cmd="bootstrap"
13. restore
14. end
--Break--
r(1);
Thanks in advance,
Dario

Comment