Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Eric Jacobson <eric_jacobson@hms.harvard.edu> |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | st: plotting confidence bands around marginal means from mixed model |
Date | Fri, 28 Mar 2014 23:35:39 -0400 |
Dear List, I analyzed longitudinal data on outcomes from a randomized controlled clinical trial by building a linear mixed model using using xtmixed in Stata 12, xtmixed vaspain tx_group days tx_group##c.days || studycode: days, reml covar(un) vaspain is the continuous outcome. tx_group is binary 1/0 days is continuous time variable. studycode are integers 1-46 that identify each individual subject in the trial. So this model has main effects for tx_group, days, and the interaction of tx_groupXdays; it also has random intercept and slope for each studycode I found a significant tx_groupXdays effect, i.e. a significant difference between the two tx_group in the slopes for decline of vaspain over days. I have plotted the regression lines for the marginal effect of vaspain vs. days, by each tx_group; i.e. one line for group 1, another line for group 2. That seems fairly straight forward. Now I would like to put 95% confidence intervals around each line, i.e. the CIs that reflect the marginal variance in the mixed model, not the CI from an ordinary linear regression. I have been unable to find out how to do the latter. It seems like it might be possible using either predict and two-way, or margin and marginplot; but lots of searching for directions or an example has turned up nothing. Does anyone know how to produce such a plot from an xtmixed model? Is it possible to do this in STATA 12? Thanks for any enlightenment, Eric Eric Jacobson Department of Global Health & Social Medicine Harvard Medical School * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/