[R-sig-ME] error with parametric bootstrap for negative binomial model, lme4, pbkrtest

Lauren Catherine Ponisio lponisio at gmail.com
Thu May 21 19:07:00 CEST 2015


Hello list members,
I was hoping to use the a parametric bootstrap using the pbktest package,
PBmodcomp() function. With a negative binomial mixed model I get the
following error:

Error in lme4::.simulateFun(object = sm, nsim = nsim, seed = seed) : could
not find function "sfun"

I get the same error when I try to use the function simulate() on a
negative binomial model. With other families I do not get an error.

I found that Ben Bolker recommended a hack on the lme4 github site, but I
cannot get it to work.
https://github.com/lme4/lme4/issues/284

If fact, below is the code he suggested which gives me the above error.

library(lme4)
library(pbkrtest)

set.seed(101)
dd <- data.frame(f=factor(rep(1:10, each=50)),
                 x=runif(500),
                 y=rnbinom(500, size=2, mu=2))

g1 <- glmer.nb(y ~ x + (1|f), data=dd)
g0 <- glmer.nb(y ~ 1 + (1|f), data=dd)

PBmodcomp(g1, g0, nsim=10)

Thanks!
best,
Lauren

	[[alternative HTML version deleted]]



More information about the R-sig-mixed-models mailing list