Skip to content
Prev 19924 / 20628 Next

Radio silence in re "newdata" argument of simulate.merMod(): PS

I read your message too casually, and failed to notice the attachments.
The issues may be that levels of `period` are not balanced within levels of
`herd`, either in `cbpp` or in `X`.  The following works:

library(lme4)
fit   <- glmer(cbind(incidence, size - incidence) ~ 0 + period + (1 | herd),
               family = binomial, data = cbpp)
X     <- subset(data.frame(herd=factor(rep(1:30,each=4)),size=rep(40,120), 
                        period=factor(rep(1:4,30))), herd==1)
X[,'herd'] <- rep(factor('new'),nrow(X))
s.mer1 <- simulate(fit,newdata=X,allow.new.levels=TRUE)

John Maindonald.