Dear Statalisters:
I am trying to graph random intercepts and slopes--BLUPs--for each of 50 subjects, observed on four periods each (N=50, T=4), after estimating a longitudinal growth model with "xtmixed." I would like all to appear on the same graph. (I used "xtmixed" because I'm still on Stata12.) Here's the code:
Apparently, "margins" doesn't recover BLUPs for the random effects, as gllapred did with the "gllamm" package (for which quadrature is really slow, and maybe inaccurate, for moderately complex problems) or "ranef" does in the R package "lme4"--unless "margins" incorporates recovery of random effects in Stata13. I get this error message:
The graph I want would look something like the one I get with this code:
Any ideas on how I can do this with any of the "xt" or the "mixed" commands? Suggestions would be greatly appreciated.
Thanks,
David
I am trying to graph random intercepts and slopes--BLUPs--for each of 50 subjects, observed on four periods each (N=50, T=4), after estimating a longitudinal growth model with "xtmixed." I would like all to appear on the same graph. (I used "xtmixed" because I'm still on Stata12.) Here's the code:
Code:
*Define Panel and Time Variables xtset id time *Longitudinal Growth Model xtmixed readit time || id:time *Graph Intercepts and Slopes margins, at(time=(0(1)3)) predict(xbu) over(id) marginsplot, x(time) plotdim(id)
Code:
. margins, at(time=(0(1)3)) predict(xbu) over(id) option xbu not allowed r(198);
The graph I want would look something like the one I get with this code:
Code:
*OLS (Unpooled Model) *Separate Intercepts and Slopes for Each Respondent reg readit c.time##i.id *Plots quietly margins, at(time=(0(1)3)) over(id) *Plot All Slopes on Single Graph marginsplot, x(time) plotdim(id)
Any ideas on how I can do this with any of the "xt" or the "mixed" commands? Suggestions would be greatly appreciated.
Thanks,
David
Comment