[R] lmer() : crossed-random-effects specification
Douglas Bates
bates at stat.wisc.edu
Wed Aug 8 00:01:43 CEST 2007
On 8/7/07, Daniel Caro <dcarov at googlemail.com> wrote:
> Dear all,
>
> I want to estimate a crossed-random-effects model (i.e., measurements,
> students, schools) where students migrate between schools over time.
> I'm interested in the fixed effects of "SES", "age" and their
> interaction on "read" (reading achievement) while accounting for the
> sample design. Based on a previous post, I'm specifying my model as:
> fm1 <- lmer2(read ~ SES*age +(1| schlid:idl) +(1| schlid), hamburg,
> control=list(gradient = FALSE, niterEM = 0))
> where my data is "hamburg" and "idl" and "schlid" are the student and
> school ids, respectively.
>
> (1) Is this the specification I want to estimate to obtain those
> effects while accounting for...? I'm not sure about the grouping
> variables specification.
>
> If not, how should I specify my model? I reviewed Baltes (2007)
> "Linear mixed model implementation" and learned how to detect if my
> design is nested or crossed, but not how to specify my model once I
> know it is crossed as in my case.
>
> If the previous specification is correct, (2) why do I get this error message?
>
> Error in lmerFactorList(formula, fr$mf, !is.null(family)): number of
> levels in grouping factor(s) 'idl:schlid' is too large
> In addition: Warning messages:
> 1: numerical expression has 30113 elements: only the first used in: idl:schlid
> 2: numerical expression has 30113 elements: only the first used in: idl:schlid
>
> My design consists of 14,047 students, 200 schools and 33,011 obs.
>
> I could, however, run this model:
>
> fm2 <- lmer2(read ~ SES*age + (1|idl) +(1|schlid), hamburg)
>
> But I guess it does not account for the crossed design. Does it?
Yes, it does account for the crossed design.
> I'm not an statistician and am using lmer() and R for the first time
> today. In other words, I sincerely apologize for the very naïve
> question. But I would really like to estimate this model soundly and I
> can't with the software I am familiar with
>
> Any advice or references are very much appreciated.
>
> All the best,
> Daniel
>
> ______________________________________________
> 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
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list