[R] syntax for interactions in lme
Lorenz.Gygax@fat.admin.ch
Lorenz.Gygax at fat.admin.ch
Thu Oct 27 07:24:08 CEST 2005
> Host (fixed)
> Sire (random)
> Dam nested within Sire (random)
> Host * Sire (random)
> Host * Dam within Sire (random)
>
> So without the interactions I have:
>
> hogmodel = lme(gain ~ host, random = ~1|sire/dam)
>
> If I understand correctly, that "sire/dam" term gives me both
> Sire and Dam within Sire as random factors. OK, so now I want
> to add the two interactions (listed above)...
Correct, for the interactions write:
random = ~ host | sire/dam
an interaction between a fixed and a random term can be interpreted as a
variability in the fixed term for the different levels in the random term.
Thus the 1 (which stands for the intercept) is exchanged with the fixed
effect(s) with which interactions are of interest.
This is easy if all the hierarchical levels of a nested random effects go
into an interaction it is a bit more complicated if not. Say you only want
the interaction of host and dam but not sire:
random = list (~ 1 | sire, ~ host | dam)
Hope this helps (it can all be found in Pinheiro and Bates and on the help
pages).
Lorenz
More information about the R-help
mailing list