[R-sig-ME] lmer and multiple membership

Douglas Bates bates at stat.wisc.edu
Sun Mar 22 17:42:52 CET 2009


On Fri, Mar 20, 2009 at 10:53 AM, Francois Rousseu
<francoisrousseu at hotmail.com> wrote:

> Hi everyone

> I know that lmer can handle cross-classified random effects, but can it handle random effects
> involving multiple membership as well? My problem is this: I am modelling the number of visits
> made by different individuals at every feeder they visit daily. I have three random effects:
> individual, feeder and date. There is multiple membership in terms of feeders and dates
> and an individual can potentially be seen at many different feeders which can change everyday.
> To make it simpler, here is an example of the data:

> Individual           Date          Feeder          Number of visits
>       1                   155              A                           13
>       1                   155              B                           34
>       1                   157              A                           76
>       2                   155              A                           87
>       2                   156              B                           34
>       2                   157              C                           23
>       3                   155              A                             3
>       3                   155              D                         123
>       3                   156              D                           12
>       3                   157              A                           56
>       3                   157              E                           24
>       3                   168              A                          45
>       3                   168              B                            6
>       3                   168              C                          78

Thank you for sending a section of the data.  Based on what you have
described I would say that individual, date and feeder are partially
crossed factors and it would be legitimate to fit the model you show
below.

> If I am not interested in date as a fixed effect, I have to put it in the model as a random effect
> and I’m wondering if specifying the model like this in lmer is the thing to do (not interested in
> varying slopes yet):

> fixed effects + (1|individual) + (1|feeder) + (1|date)

> However, if I am interested by the date as a fixed effect, do I have to specify it in the random
> effects as well to indicate that the repeated measures on individuals are related to feeders and
> dates? If so, does it have to be specified in any special way?

I'm not quite sure what the question is but I think the answer is
"no".  The structure of the data is determined by the factors
themselves.  If Date is a categorical covariate it will generate
equivalent structures in the model matrices whether it is a
fixef-effects term or a random-effects term, although the coefficient
estimates will be somewhat different.  I don't see a need to include
that covariate in both the fixed effects and the random effects.




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