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
MERGE problem!!Problem with merge. I removed my duplicates and they are my only identical variables but I get "not …
How to rearrange bars in bar graph with two variables and two over groupsHi all, I feel like I should know how to do this - but I'm trying to plot two variables with two se…
Annual Average by Year and Calculate PercentHello Statlisters, I have a dataset with 42 variables and 682 observations of all the starting leve…
Reshape problemHi! I want to reshape my data wide to long, but state says that there is a problem. It days there ar…
asclogit to run McFadden's conditional logit model. model doesn't convergeHi everyone, I hope you are good. I am trying to understand college choice for high school seniors.…
Subscribe to:
Post Comments (Atom)
0 Response to Margins command error: at values for factor wavefirst do not sum to 1
Post a Comment