Skip to content

Getting each bootstrapped data frame from bootMer

2 messages · Daniel Hocking, Ben Bolker

2 days later
#
On 14-05-22 11:26 AM, Daniel J Hocking wrote:
I would be tempted just to re-invent the guts of bootMer, which are
not actually very complicated -- they're just a simulate/refit loop.  So
I might do something like

nsim <- 10
bootData <- simulate(glmm.M35,nsim)  ## data frame of sim data sets
predvals <- matrix(NA,nrow=length(df.fit),ncol=nsim)
set.seed(101)
for (i  in 1:10) {
   predvals[,i] <- predict(refit(glmm.M35,bootData[[i]]),
                     ...)
}

I also suspect (although haven't tried to check) that bootMer doesn't
use any random numbers other than the ones it uses to generate the
simulations, so you would *probably* be able to retrieve the response
values used if you just did this:

bootMer(...,seed=101)
bootData <- simulate(...,seed=101)

(slightly inefficient, but simulating the data is the smallest part of
the problem)

 hope that helps
    Ben Bolker




}