Arild Husby
2005-Nov-25 14:11 UTC
[R] Use of nesting in lmer- error in numerical expression
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 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..? 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@stud.ntnu.no> arildhus@stud.ntnu.no mobile: +47 92294412 office : +47 73596266 [[alternative HTML version deleted]]
Douglas Bates
2005-Nov-26 17:38 UTC
[R] Use of nesting in lmer- error in numerical expression
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 vectorAre 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 >
Maybe Matching Threads
- singular convergence with lmer function i lme4
- change of variance components depending on scaling of fixed effects
- Which features would you like to see on the crantastic.org community portal?
- Announce: cis-puppet 0.2.0 is now available
- Urgent - I really need some help lme4 model avg Estimates