Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "Roger B. Newson" <r.newson@imperial.ac.uk> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: plotting confidence bands around marginal means from mixed model |
Date | Sat, 29 Mar 2014 10:36:07 +0000 |
The -parmest- and -eclplot- packages can be downloaded from SSC. The -parmest- package can be used after -margins- to store confidence intervals for the marginal means, using the -bmatrix()- and -vmatrix()- options. As in
bmatrix(r(b)) vmatrix(r(V)) I hope this helps. Best wishes Roger Roger B Newson BSc MSc DPhil Lecturer in Medical Statistics Respiratory Epidemiology, Occupational Medicine and Public Health Group National Heart and Lung Institute Imperial College London Royal Brompton Campus Room 33, Emmanuel Kaye Building 1B Manresa Road London SW3 6LR UNITED KINGDOM Tel: +44 (0)20 7594 7931 Email: r.newson@imperial.ac.uk Web page: http://www.imperial.ac.uk/nhli/r.newson/ Departmental Web page: http://www.imperial.ac.uk/nhli/reomph/ Opinions expressed are those of the author, not of the institution. On 29/03/2014 03:35, Eric Jacobson wrote:
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/
* * 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/