How to use simulate.merMod() function with a GAMM object/how to do a parametric bootstrap with GAMM

Viewed 64

I am trying to carry out a parametric bootstrapping procedure for estimating the CI of random effect repeatability (ICC) in a generalized additive mixed model (GAMM, from the gamm4 package). The problem is, I can't figure out how to do so without using the simulate.merMod() function embedded in lme4, and this function seems not to work with the "mer" object produced by gamm4.

Here's some example data:

a <- seq(1, 2, length.out = 1000)
b <- 2*a^2.5 + 3
eta <- rnorm(n = 1000, mean = 0, sd = 1)
socialGroup <- sort(rep(c(1:20), 1000/20))

data <- data.frame(resp = a, independent = b + eta, socialGroup = socialGroup)

mod <- gamm4(resp ~ s(independent) , 
             data = data,
             random = ~ (1|socialGroup))

lme4:::simulate.merMod(mod$mer, nsim = 10)

That last command should in theory work, but instead I get "Error in FUN(X[[i]], ...) : random effects specified in re.form that were not present in original model"

I've tried going through the source code for simulate.merMod, but I'm afraid it's beyond my ken. I have two questions:

a) If possible, how can I get the simulate() command to work for this object? b) If anyone can provide guidance on how to do a parametric bootstrapping procedure with a GAMM object, that would be an enormous help.

0 Answers
Related