Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: xtmixed

From   "Sun, Wensheng" <>
To   "" <>
Subject   st: xtmixed
Date   Thu, 3 Jan 2013 18:06:08 -0600

Hi, William,

Thanks for the reply. For example, 

webuse pig

gen drug=.
replace drug=0 if id<=24
replace drug=1 if id>24
gen drug_week=drug*week
xtmixed weight week i.drug drug_week, ||id: week, covariance(unstructured) residuals(independent) mle variance

I want the independent variable 'week' to be random in coefficient and intercept, eg. each id has its own slope and overall, different drug group has different slope at each week. However, if I use the above command, when I run

margins drug, at(week=(1 5 9))

what I got is two straight lines with exactly the same slopes.

The marginsplot I wish to get is the ones in

Please help.

Thank you very much!

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index