Re: [R] syntax for interactions in lme

From: <>
Date: Thu 27 Oct 2005 - 15:24:08 EST

> 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 mailing list PLEASE do read the posting guide! Received on Thu Oct 27 15:27:31 2005

This archive was generated by hypermail 2.1.8 : Thu 27 Oct 2005 - 18:13:01 EST