Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: st: xtmixed
From
"Sun, Wensheng" <[email protected]>
To
"[email protected]" <[email protected]>
Subject
RE: st: xtmixed
Date
Thu, 3 Jan 2013 18:49:59 -0600
Hi Billy,
It works. Thank you!
Carol
________________________________________
From: [email protected] [[email protected]] On Behalf Of William Buchanan [[email protected]]
Sent: Thursday, January 03, 2013 6:35 PM
To: [email protected]
Subject: Re: st: xtmixed
Hi Carol,
You could not have two lines with identical slopes in your example. In your specific example you do get two straight lines, but it isn't clear why this is a problem for you. In addition to running the syntax you provided, I also ran:
webuse pig
g drug=0 if id<=24
replace drug=1 if drug!=0
xtmixed weight c.week##i.drug || id: week, cov(uns) res(ind) mle variance
margins drug, at(week=(1(1)9))
marginsplot
You should also include the output from your original syntax since it is likely that the margins are fairly similar across the values of the independent variable. Else, provide some additional details to the listserv regarding why you feel the line should not be straight along with an example that performs how you believe it should (in this case the pig weight dataset didn't produce two lines with identical slopes which you can see by looking at the difference in the values in the margins before the lines intersect and afterwards).
HTH,
Billy
On Jan 3, 2013, at 4:06 PM, Sun, Wensheng wrote:
> 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))
> marginsplot
>
> what I got is two straight lines with exactly the same slopes.
>
> The marginsplot I wish to get is the ones in www.stata.com/stata12/margins-plots
>
> Please help.
>
> Thank you very much!
>
> Carol
> *
> * 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/
*
* 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/