[R] Use of nesting in lmer- error in numerical expression
Douglas Bates
dmbates at gmail.com
Sat Nov 26 18:38:33 CET 2005
On 11/25/05, Arild Husby <arildhus at stud.ntnu.no> wrote:
>
>
> Dear R users,
>
>
>
> I am trying to fit a GLMM using lmer to a dataset where the brood identity
> (LNRREIR) is nested within mothers identity. The reason for this is that
> each mother can have several nests within each year and also between years.
>
>
>
> I am running the following script (actually I have tried all different
> combinations with LNRREIR and mother):
>
>
>
> mod <- lmer(sr~z.hatchday + (1|LNRREIR:mother) + (1|mother),
> family=binomial, data=aggrsexfil)
>
> Error in LNRREIR:mother : result would be too long a vector
Are both LNRREIR and mother stored as factors?
If the brood identity is unique for each brood then there is no need
to create the grouping factor as an interaction (although the practice
is encouraged as a precautionary measure).
> In addition: Warning messages:
>
> 1: numerical expression has 64 elements: only the first used in:
> LNRREIR:mother
>
> 2: numerical expression has 64 elements: only the first used in:
> LNRREIR:mother
>
>
>
> Is this the wrong way to specify it or what is happening here?
>
>
>
> I am also wondering if only including mother as a random factor, do R
> understand that its nested? That is, when there are e.g. 60 different nests
> and 40 mothers. Do R then take into account that each mother can have
> multiple broods? In that way the nesting seems redundant..?
If you only include mother as a random factor it can't be either
nested or not. The property of nesting is a relationship between two
grouping factors.
>
>
>
>
>
> Thanks for all help!
>
>
>
> Best regards,
>
>
>
> Arild
>
>
>
>
>
> --------------------------------------------
>
> Arild Husby (M.Sc.),
>
> Research Technician,
>
> Department of Biology,
>
> Realfagbygget,
>
> Norwegian University of Science and Technology,
>
> N-7491 Trondheim
>
> NORWAY
>
> e-mail: <mailto:arildhus at stud.ntnu.no> arildhus at stud.ntnu.no
>
> mobile: +47 92294412
>
> office : +47 73596266
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
More information about the R-help
mailing list