[R] lme: how to nest a random factor in a fixed factor?

Robert Buitenwerf buitenwerfrobert at hotmail.com
Wed Aug 26 16:23:40 CEST 2009


Dear all,

 

I have an experimental setup in which a random variable is nested within a fixed variable; however I have troubles specifying the correct LMM with lme. I have searched the lists but haven't been
able to find an example like my setup, which I unfortunately need to get this stuff right. Pinheiro & Bates is great but I still can't figure out how to do it. 

 

My experimental setup was as follows:

100 measurements per treatment plot

2 treatment plots per site

4 sites: 2 in one area and 2 in another area

 

Both treatment and area are fixed factors,while site is random. I am interested in the significance of the fixed effects,less in the magnitude of the random effect. 

 

I have tried:

 

mod1 <- lme(response ~ area*treatment, data=data,random= ~1|site)

but now site is not nested in area…

 

mod2 <- lme(response ~ area*treatment, data=data,random= ~1|area/site)

but now area is both a fixed and a random variable, which doesn't seem to make sense, plus I run out of df for treatment

 

mod3 <- lme(response ~ area*treatment, data=data,random= ~1| plot)

but here plots are not grouped according to site

 

I hope someone would be willing to help me,
thank you in advance!

 

Robert Buitenwerf

Ecologist

South African Environmental Observation Network
_________________________________________________________________
[[elided Hotmail spam]]




More information about the R-help mailing list