I'm running a mixed-effects model (or multilevel model or growth curve analysis) to estimate trajectories in my outcome variable using multiple imputed data. I know that the margingsplot package does not work with multiple imputed data but I'm trying the following where I plot the model based trajectories using just one of the imputed datasets:
Code:
* my time variable is age, that I centre below so that the model constant is set at age 36. I then create the spline variables for 4 time periods (4 of them): gen agec=age-36 mkspline age36_43 7 age43_53 17 age53_63 27 age63_69 = agec br ID agec age36_43 age43_53 age53_63 age63_69 * The model includes interactions between categorical social class (adultsc) and all 4 spline variables: mixed score age36_43##i.adultsc age43_53##i.adultsc age53_63##i.adultsc age63_69##i.adultsc i.childsc ib2.education2 sex || NSHD_ID: agec, cov(unstr) mle, if _mi_m==20 * Margins command: margins adultsc, at(agec=(0 7 17 27 33)) atmeans marginsplot, noci
The mixed-effects model runs well (no issues).
However, I'm unable to generate the margins for adultsc as I get an error msg saying that 'agec' not found in list of covariates, which is of course true. The splines were based on the variable agec.
So, how would I overcome this problem? I can't include agec in the fixed effects part of the model.
In more general: How would one plots trajectories from a growth curve analysis (mixed effects model) based on multiple imputed data?
Thanks!
Amal
0 Response to Plotting trajectories from a growth curve analysis model (mixed effects model with linear splines) using marginsplot
Post a Comment