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
Renewing License - Single User-Payment ProblemHi. I tried to renew my single user license (it will expire on 9th June) from India. It is of amoun…
Granger causality testsHello, I'm trying to run a Granger causality test on panel data to check whether bank profits (depe…
changin p-value range in esttabHi, I use esttab command to compile my models. I see below * p<0.05, ** p<0.01, *** p<0.00…
gosrt are not stable when identifiers are the same, how to make it the order stable?I find when use gsort var, when var has some duplicates of obervation, the order after gsorting are …
Append csv files into one dta fileHello, I have 38 csvfiles that I want to merge into one DTA file using a loop (foreach) . My csvfil…
Subscribe to:
Post Comments (Atom)
0 Response to Margins command error: at values for factor wavefirst do not sum to 1
Post a Comment