I wanted to generate Inverse Mills' Ratio for a panel data. Following Wooldridge (2010 pp. 835), I tried to use forval loop to do probit for each single year. However, the following code sometimes works but most of the time encounters errors such as "no observations" "last estimates not found". Can anybody point out what happened?
Code:
gen imr_sic1=. gen imr_sic2=. forval i=2005/2010 { forval j=1/2 { capture probit dependent_variable ${control_variable_sic`j'} if year==`i' predict xb_`i'_`j' if e(sample), xb replace imr_sic`j'=normalden(xb_`i'_`j')/normal(xb_`i'_`j') if f_fyear==`i' } }
Comment