[R] lme model with replicates within a random factor

Bert Gunter gunter.berton at gene.com
Fri Nov 2 21:36:38 CET 2007


1. Consult the Pinheiro and Bates, MIXED EFFECTS MODELS ... book, especially
if you will continue to use such methodology as part of your professional
work.

2. I think the model you want is:

 Model1<-lme(shannon ~ log(chla+1)*toc*hyd_cycle,random = ~time|basin)

You don't need to include the replicate term because that is automatically
included as the error term in the model. Note that this model probably makes
most sense if time is a factor.If time is a numeric vector, then the model
implies that you expect some kind of random trend with time in each basin,
and you would probably therefore want to include it as a fixed effect, too,
something like:

Model1<-lme(shannon ~ log(chla+1)*toc*hyd_cycle + time,random=~time|basin).

This postulates some overall time trend with random slope and intercept
offsets from the overall trend in each basin. 

Bert Gunter
Genentech Nonclinical Statistics


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Stéphanie Gascón Garcia
Sent: Friday, November 02, 2007 12:39 PM
To: r-help at stat.math.ethz.ch
Subject: [R] lme model with replicates within a random factor

Dear all,

 

I wonder if anyone can help me with specifying a right model for my
analysis. I am a beginner to lme methods. I was unfortunately not able to
find a solution to my problem on my own. 

Data structure:

I have sampled monthly 6 basins during two hydrological cycles, and I have
taken several (2 to 4) samples (replicate) for each basin and month. Im
trying to relate Shannon diversity to some environmental variables, taking
away pseudoreplication. Thus, I have tried an lme model with time and
basin as random factors. I have put hydrological cycle as a fixed factor,
since Im interested in quantifying their effect. But Im not sure if there
are other possibilities to do this.

 

This is my model structure:

 

Model1<-lme(shannon<-log(chla+1)*hyd_cycle+toc*hyd_cycle,
random=~time|basin)

 

Note that I have not put replicate within the random structure
(random=~time|basin/replicate), and this is my major concern. Im not sure
if I have to include replicate in the random structure, since replicates
are randomly taken each time, and so are not repeated measures within the
basins.

 

All books and internet information that I have looked at the moment are
examples with repeated measures within blocks (e.g. repeated measures of the
same plant and treatment). Can anyone help me with this?

 

 

I would appreciate any hints and suggestions

 

Stiphanie

 


	[[alternative HTML version deleted]]



More information about the R-help mailing list