If you fit the model as suggested below and store it in an object, say
"model.lme", then you can update the model as follows to include the
continuous AR1 structure
model2.lme<-update(model.lme, correlation=corCAR1(form=~time|cow) )
To compare the two models, you might use the LRT as:
anova(model.lme,model2.lme)
Harold
-----Original Message-----
From: r-help-bounces@stat.math.ethz.ch on behalf of Spencer Graves
Sent: Sun 6/6/2004 12:21 PM
To: Alex Bach
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Repeated measures
1. You didn't say which "manual" you were reading on
"lme", if
you have not consulted Pinheiro and Bates (2000) Mixed-Effects Models in
S and S-Plus (Springer), I suggest you do so. The issues are discussed
in greater depth with many examples. I found this book well worth the
time and money I invested in it.
2. Have you considered the following:
lme(milk yield = cow + treatment + time + treatment*time, random
~time|cow ... )
This will NOT have the ARCH(1) R RCORR error structure; "lme"
can
handle certain types of autocorrelated error structures, but I don't
remember the details at the moment. Pinheiro and Bates discuss some
capabilities of this nature.
hope this helps.
spencer graves
Alex Bach wrote:
> Dear R-gurus,
>
> I am pretty much new on R.
> I am trying to to do a repeated analysis of a linear mixed model with
> R, and I consistently fail...
>
> The problem is: Cow is the random factor, treatment is the fixed
> factor. The dependent variable is milk yield, which is measured
> several times (repeatedly over time), thus there is another variable
> which is time (i.e. week).
>
> The model would be something like this: milk yield = cow + treatment +
> time + treatment*time
>
> With time as a repeated measure.
>
> Would some one be kind enough to guide on how could I set up the
> statement in R?
> I imagine I have to use LME but I have not been smart enough to figure
> out how to do it by just reading its manual. Also, with SAS there is a
> nice contrast, called SLICE that allows you to test when in time there
> is difference between treatments. I do not know if there is something
> like this is R.
>
> Thank you very much!
>
> PD. For SAS users, what I am using in SAS to perform this analysis
> (with an Autoregressive covariance structure) the program would read
> like this:
>
> proc MIXED covtest;
> CLASS cow treat time;
> MODEL yield= treat time treat*time;
> REPEATED time/SUB=cow(treat) TYPE=ARH(1) R RCORR;
> RANDOM cow;
> LSMEANS treat time treat*time/SLICE = time;
> RUN;
>
>
> Thank you very much,
>
> Sincerely,
>
> Alex
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
______________________________________________
R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[[alternative HTML version deleted]]