[R-sig-ME] lmer model for repeated measure in RCB design
Ben Bolker
bbolker at gmail.com
Wed Jan 11 20:13:15 CET 2012
Schreiber, Stefan <Stefan.Schreiber at ...> writes:
>
>
> Hi all,
>
> I have a questions about the following situation and was hoping to find
> clarification here.
>
> I have a data frame with the following variables:
>
> id, genotype, group, block, climate, response
>
> I measured a response of 7 genotypes in a randomized complete block
> design. I measured each genotype 8 times (n=48).
You have some missing combinations? (8*7=56, right?)
> I grouped my 7
> genotypes into 3 for me more reasonable groups. I measured the response
> on the same 7 genotypes 3 times under different climatic conditions.
>
> I specified block and genotype as random and group as fixed. I believe
> the proper random statement should look like: block, genotype nested
> within group.
>
> I came up with the following code:
>
> fit1 <- lmer(weight ~ group*climate + (1|block) + (1|group/genotype) ,
> data=df)
>
> The problem I have now is how can I include the fact that I measured the
> same genotypes at three different times? Can I say (1|group/genotype/id)
> instead of (1|group/genotype)?
Is id a unique identifier for each observation? In that
case it's definitely redundant with the residual variance and
should not be included in the model statement.
I'm still a little bit uncertain about your experimental design
(thanks for the careful explanation, though). I'm going to make up
one possible explanation. How unbalanced is it? Does climate
represent another level of replication (e.g. are there three climate
conditions that are measured for each group*genotype*block
combination), or does it vary in an unbalanced way across
group*genotype*block combinations? Would your total number
of observations be 8 (blocks) * 7 (genotypes) * 3 (climate conditions)?
You shouldn't include group both as a fixed effect (your
fixed group*climate term expands to group+climate+group:climate)
and a random effect (your group/genotype term expands to
group+group:genotype). You should probably use
(1|group:genotype) instead (make sure group and genotype
are both stored as factors).
Even if it weren't redundant, including a random effect of
group (with only three groups) is likely to give you an
estimated group-level variance of zero -- there aren't enough
levels to estimate variance reliably.
If genotypes have unique IDs then you don't need the explicit
nesting or interaction syntax. If so, my best guess is that
weight ~ group*climate + (1|block) + (1|genotype)
is what you want.
You might consider whether it's worth including other random terms --
the most complex model would include (group*climate|block)
and (climate|genotype) -- but you might find that you were running
out of signal ...
More information about the R-sig-mixed-models
mailing list