[R] GLMM using lme4
Luciano La Sala
luciano_la_sala at yahoo.com
Wed Dec 3 17:21:54 CET 2008
Dear R-experts,
I am running R version 2.7.1 on Windows Vista. I have a small dataset which consists of “chick ID”, “year (0, 1)”, “hatching order [HO, defined as first, second and third-hatched chick]”, and the binary outcome of interest “death (0, 1)”. So a subset of my dataset looks like this on a txt file:
y ID Yr HO
1 1 1 First
0 2 1 First
0 3 1 Second
0 4 1 First
1 5 1 First
0 6 1 Third
0 7 1 First
0 8 1 Third
0 9 1 First
0 10 1 First
1 11 1 Third
0 12 1 First
0 13 1 First
0 14 1 First
0 15 1 First
0 17 1 First
1 19 1 First
1 20 1 First
............
n ni nj nk
I need to run a GLMM using Year (Yr) and chick ID (ID) as random effects in order to account for lack of independence at the nest level (many chicks are siblings) and eliminate “year effect” incase a significant difference exists between years.
Using lmer, I specified my model as follows:
model1 <- lmer(y~HO+(Yr|ID),family=binomial,1)
summary(model1)
Output:
Error en model.frame.default(data = 1, formula = y ~ HO + (Yr + ID), drop.unused.levels = TRUE) :
las longitudes de las variables son diferentes (encontrada para 'HO')
Q1: What does this error message mean and how can I solve the problema?
Q2: Is my model correctly specified?
I look forward to hearing from you guys, always so helpful.
Lucho
More information about the R-help
mailing list