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

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Wed Aug 26 17:18:29 CEST 2009


Dear Robert,

Since you have only 4 sites, a random effect is not so good. You would
need at least 6 sites for a good estimate of the variance. You have
enough data to treat site as a fixed effects. It only costs 2 extra
degrees of freedom. Therefore I would model this like: 

lm(response ~ (area/site)*treatment, data = data)

HTH,

Thierry

------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
Thierry.Onkelinx at inbo.be
www.inbo.be

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey

-----Oorspronkelijk bericht-----
Van: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
Namens Robert Buitenwerf
Verzonden: woensdag 26 augustus 2009 16:24
Aan: R Help
Onderwerp: [R] lme: how to nest a random factor in a fixed factor?


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]]

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Druk dit bericht a.u.b. niet onnodig af.
Please do not print this message unnecessarily.

Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer 
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in  this message 
and any annex are purely those of the writer and may not be regarded as stating 
an official position of INBO, as long as the message is not confirmed by a duly 
signed document.




More information about the R-help mailing list