[R] Repeated measures

Alex Bach alex.bach at irta.es
Sun Jun 6 17:52:12 CEST 2004


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




More information about the R-help mailing list