[R-sig-ME] nested random factor

Seth Bigelow seth at swbigelow.net
Wed Mar 19 15:46:37 CET 2014


Well -- I don't know about the 'correct' model, but you might consider two
ideas. First, the variance among samples might differ according to location.
If so, you would get a better model by nesting sample within location, e.g.,
using the statement (1|location/sample), rather than (1|location) +
(1|sample). You can test whether this model is better with likelihood ratio
tests, i.e., anova(UnNestedmodel,NestedModel).

Second, you probably want to account for serial autocorrelation in samples
taken from the same location, repeatedly over time -- i.e. in the 'week'
variable. I've done this in SAS but never mastered the syntax in nlme/lme4.

Good luck
-Seth 



-----Original Message-----
From: r-sig-mixed-models-bounces at r-project.org
[mailto:r-sig-mixed-models-bounces at r-project.org] On Behalf Of sandrine le
squin
Sent: Wednesday, March 19, 2014 3:01 AM
To: r-sig-mixed-models at r-project.org
Subject: [R-sig-ME] nested random factor

Dear all,

I'm using lmer from lme4 package but I am not sure of what I'm doing.

The dataset has the following variables :
- Treatment (fixed, 3 levels)
- Location (fixed, 4 levels)
- Sample (random, 5 levels). 5 samples are taken in each location (randomly)
- Subsample (random, 3 levels). 3 subsamples are taken in each sample. One
treatment is assigned (randomly) to one of the subsample.

The study was conducted every Wednesday during 15 weeks in 2013, from week
32 to week 47 (no observations for week 33).

For the first location, samples are taken weeks 32, 36, 39, 42 and 49.
For the second location, samples are taken the week 46.
For the third location, samples are taken weeks 35, 38, 41 and 44.
For the 4th location, samples are taken week 34, 37, 40, 43, 47.

For each location* i*, week *j(i)*, sample* k(ij)* and treatment *l*, the
"richness in sugar" of each subsample has been recorded.
The aim of the study is to see if there is an effect of the factor
"treatment" on the response "richness".

I am new in mixed model so I did some research but I am a little bit
confused with the sampling design.

I consider "location", "week" and "sample" as random factor, with sample
nested in week nested in location.
To avoid implicitly nested representations, "sample" has been recoded
(factor with 75 levels (5 samples*15 weeks)).

I write in R:
lmer(richness ~ treatment + (1|location) + (1|week) + (1|sample), data =
mydata)

Is my model correct ?

Thank you for your help

	[[alternative HTML version deleted]]

_______________________________________________
R-sig-mixed-models at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models



More information about the R-sig-mixed-models mailing list