Skip to content
Prev 68447 / 398506 Next

A question on the library lme4

Luis Fernando Chaves wrote:
It depends on whether each Country has a unique label or not.  If they 
have unique labels then you simply use

model3 <- lmer(malrat1 ~ I(year-1982)+(1|Country)+(1|Continent), 
wbmal10, poisson)

If the Country factor is implicitly nested within Continent (e.g. the 
Country labels are "1", "2", ... and on each Continent they start with 
"1") then you must create a factor with unique levels by forming the 
interaction of Country and Continent as Bill Venables described in his 
reply.

In lmer there is no need, and indeed no way, to distinguish between 
nested and non-nested grouping factors for random effects.  Because of 
this you cannot use implicit nesting.