Statalist


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

Re: st: Replicate a SAS example with xtmixed, STATA 11


From   Scott Baldwin <[email protected]>
To   [email protected]
Subject   Re: st: Replicate a SAS example with xtmixed, STATA 11
Date   Fri, 29 Jan 2010 11:51:11 -0700

Hi Dave,

When I run your code, I get the following error:

repeated t() values within lowest-level panels
r(459);


Thus, xtmixed doesn't know that the repeated measures are within id.
Thus, you need to change your xtmixed code to:

xi: xtmixed y group i.time i.group*i.time || id: , nocons
residuals(unstructured, t(time))

The || id: tells xtmixed that there are repeated observations within
id and nocons makes it so you don't estimate this random intercept.
This should be equivalent to the REPEATED statement in SAS. I don't
have the book you reference, so I can't check whether the results
match up or not.

Best,
Scott



On Fri, Jan 29, 2010 at 10:55 AM, Amado David Quezada Sanchez
<[email protected]> wrote:
> Hello,
>
> I have tried to replicate an example from Fitzmaurice/Laird/Ware book "Applied Longitudinal Analysis". The code presented by the authors was written for SAS:
>
> PROC MIXED;
>  CLASS id group time;
>  MODEL y=group time group*time/S CHISQ;
>  REPEATED time/TYPE=UN SUBJECT=id R RCORR;
>
> According to the authors "The MODEL statement specifies the response varriable and the fixed effects" and "The SUBJECT option ... is used to denote a variable that distinguishes clusters of correlated responses"..."TYPE=UN specifies an unstructured covariance matrix"
>
> So, after setting the data into long format, I tried to run the following code:
>
> /* Setting the data */
> clear
> infile id str1 grp y0 y1 y4 y6 using http://users.uoa.gr/~fsiannis/data/longitudinal/tlcdata.txt
> reshape long y, i(id) j(time)
> gen group=0 if grp=="P"
> replace group=1 if grp=="A"
> /* Fitting the model, option residuals only found in STATA11 */
> xi: xtmixed y group i.time i.group*i.time, residuals(unstructured, t(time))
>
>
> I receive an error message. What could I do to replicate the SAS code?
>
> Thank you!
> Dave
>
>
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/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/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index