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.
On 8/08/2022, at 11:13, Rolf Turner <r.turner at auckland.ac.nz <mailto:r.turner at auckland.ac.nz>> wrote: Three days ago I sent an email to r-sig-mixed-models asking what I was doing wrong in my use of the "newdata" argument of simulate.merMod(). So far I have received no response at all. This surprises me. I expected a quick reply, from Ben Bolker (or someone like him) to the effect of "You absolute ninny. *This* is (obviously!) the syntax that you should be using." Was my question unclear or too obscure or arcane? If so, are there any suggestions as to how I could be more perspicuous? I really would appreciate some help. cheers, Rolf Turner -- Honorary Research Fellow Department of Statistics University of Auckland Phone: +64-9-373-7599 ext. 88276
_______________________________________________ R-sig-mixed-models at r-project.org <mailto:R-sig-mixed-models at r-project.org> mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models <https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models>