[R] Nesting fixed factors in lme4 package
Ben Bolker
bbolker at gmail.com
Fri Jan 18 15:07:02 CET 2013
Martina Ozan <martina_ozan <at> hotmail.com> writes:
> Hi, can anyone tell me how to nest two fixed factors using glmer in
> lme4? I have a split-plot design with two fixed factors - A (whole
> plot factor) and B (subplot factor), both with two levels. I want to
> do GLMM as I also want to include different plots as a random
> factor. But I am interested on the effect of A a B and their
> interaction on the response variable. I tried
> this:glmer(response~A*B+(A/B)+(1|C),data=Exp2,family=poisson but it
> gives the same output as if I removed (A/B) all together or used
> (A:B) instead thus the output is the same as:
> glmer(response~A*B+(1|C),data=Exp2,family=poisson anyone can help
> with how I define this nesting, so that data are analysed correctly
> given my split-plot design? thanks, Martina
In general mixed model questions should go to
r-sig-mixed-models at r-project.org , but this is actually *not*
specifically a mixed model problem. If A and B are fixed factors,
you're typically interested in A*B, which translates to 1+A+B+A:B,
i.e. intercept; main effects of A and of B; and the interaction.
The nesting syntax A/B translates to 1 + A + A:B, i.e. no main
effect of B. Nesting would typically make more sense in a random-effects
context where the meaning of "B=1 in unit A=1" is different from
"B=1 in unit A=2", i.e. where you don't want or it doesn't make
sense to estimate a main effect of B across levels of A.
Ben Bolker
More information about the R-help
mailing list