Hi. I am using a dynamic random effects model to study the effect of health insurance on self-employment. My outcome variable is a binary and my dataset a panel. I have set the initial conditions and am trying to run a probit. The probit runs fine, but my code appears to fail at the margins command with the error "at values for factor wavefirst do not sum to 1". I'm unable to fathom why and would greatly appreciate any help.
egen wavefirst=min(yr), by(idind)
label var wavefirst "First time R appears in the sample"
foreach v in selfemp {
gen _t1 = `v' if yr==wavefirst
egen `v'_ic=mean(_t1), by(idind)
drop _*
}
foreach v in married schyrs numchild lnannearniR {
gen _t1 = `v' if yr==wavefirst
egen `v'_1=mean(_t1), by(idind)
gen _t2 = `v' if yr>wavefirst`i'
egen `v'_R=mean(_t2), by(idind)
drop _*
}
*dynamic w lags and pre-post
xtprobit $F post#urban_hukou interaction $L $X2 i.wavefirst, vce(robust)
outreg2 using "DynamicModel.xls", append ctitle(Dynamic w Post) bdec(3)
margins, at(wavefirst=(1(1)5)) over(urban_hukou)
local t: variable label selfemp
marginsplot, xdimension(at(wavefirst)) recast(line) xlabel(1(1)6) ytitle("") title("`t'") graphregion(fcolor(white)) plotopts(lwidth(medthick)) ciopts(lwidth(vvthin)) legend(region(fcolor(white)) region(lcolor(white))) saving("DynamicWLag.gph", replace)
Related Posts with Margins command error: at values for factor wavefirst do not sum to 1
Problem with generating new variable-- Need help pleaseHello everyone, I need help in generating a new variable based on an existing one. The existed vari…
Drop last 7 characters from obsrevations if they have certain charactersHello, This is my first post, so please excuse me. I have one variable with observations like this…
Multinomial logistic regression with Panel DataSuppose you have panel data (many observations for each person) and you have a discrete ordered outc…
Finding the right Instrument VariablesHi, i am examining relation between firm performance and instiutional ownership. I am now strugglin…
How relevant are stochastic trends in a panel with T<<N?The panel dimensions are N=170 and T=21 and the estimated model is a dynamic panel estimated using x…
Subscribe to:
Post Comments (Atom)
0 Response to Margins command error: at values for factor wavefirst do not sum to 1
Post a Comment