[R] lme - Random Effects Struture

Rick Bilonick rab45+ at pitt.edu
Wed Jun 28 18:05:48 CEST 2006


On Wed, 2006-06-28 at 11:04 -0400, harry wills wrote:
> Thanks for the help Dimitris,
> 
> However I still have a question, this time I'll be more specific,
> 
> the following is my SAS code
> 
> 
> 
> proc mixed data=Reg;
>         class ID;
>         model y=Time Time*x1 Time*x2 Time*x3 /S;
>         random intercept Time /S type=UN subject=ID G GCORR V;
>         repeated /subject = ID R RCORR;
> run;    **
> 
> (Type =UN for random effects)
> 
> 
> 
> The eqivalent lme statement I am using is :
> 
> reglme  <- lme(y ~ Time+Time*x1+Time*x2+Time*x3, data=Reg, random = ~ Time |
> ID)
> 
> 
> 
> When I compare the results, the values differ by considerable margin; I
> suppose this is due to the Random effects covariance structure. R output
> tells me that the structure is
> 
> 
> 
> "Structure: General positive-definite, Log-Cholesky parametrization"
> 
> 
> 
> Hence the problem for me is how to control this structure in R. Any help
> would appreciated
> 
> Thanks
> 
> Harry

>From my understanding of SAS, a*b means the interaction of a and b. But
in R, a*b is shorthand for a + b + a:b where a:b is the interaction
term. The way you've written the lme formula, you have time showing up 4
times plus you have additional main effects x1, x2, and x3. Is this what
you want? Maybe I'm wrong but I don't think the SAS code and the R code
represent the same model.

Rick B.



More information about the R-help mailing list