[R] lmer() - crossed random effects specification

Daniel Caro dcarov at googlemail.com
Tue Aug 7 23:51:20 CEST 2007

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?

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,


More information about the R-help mailing list