[R-sig-ME] Question about zero-inflated Poisson glmer
bbolker at gmail.com
Fri Jul 1 02:58:33 CEST 2016
Philipp Singer <killver at ...> writes:
> I have now played around more with the data an the models both using lme4
> and glmmTMB.
> In lme4, when I do:
Note that at this point you're not actually using lme4 at all.
Regular old glm() from base R has predict and simulate methods,
which *silently ignore* (slight design flaw there ...) the
extra re.form argument ...
d <- data.frame(x=rpois(100,lambda=5))
m <- glm(x~1,family="poisson",data=d)
p <- predict(m, type='response',re.form=NA)
sim1 <- rpois(n=nrow(d),lambda=p)
## if I do simulate(1,m,...) I get "no applicable method for 'simulate' ..."
## either set.seed(101) here to reset random number generator,
## or use the 'seed' argument to simulate() ...
sim2 <- simulate(m,1,re.form=NA,seed=101)[]
all.equal(sim1,sim2) ## TRUE
> I receive different outcomes? Do I understand these function wrongly?
I get the same answer both ways. I can't tell whether you're doing
something subtly different (that's why reproducible examples
are so nice, even for simple questions), or whether you're
just failing to reset the random-number seed.
More information about the R-sig-mixed-models