# Parametric, semiparametric and nonparametric bootstrapping for mixed models

Following grafts are taken from this article . I'm newbie to bootstrap and trying to implement the parametric, semiparametric and nonparametric bootstrapping bootstrapping for linear mixed model with R boot package.

R Code

Here is my R code:

library(SASmixed)
library(lme4)
library(boot)

fm1Cult <- lmer(drywt ~ Inoc + Cult + (1|Block) + (1|Cult), data=Cultivation)
fixef(fm1Cult)

boot.fn <- function(data, indices){
data <- data[indices, ]
mod <- lmer(drywt ~ Inoc + Cult + (1|Block) + (1|Cult), data=data)
fixef(mod)
}

set.seed(12345)
Out <- boot(data=Cultivation, statistic=boot.fn, R=99)
Out


Questions

1. How to do parametric, semiparametric and nonparametric bootstrapping for mixed models with boot package?
2. I guess I'm doing nonparametric bootstrapping for mixed model in my code.

I found these slides but could not get the R package merBoot. Any idea where I can get this package. Any help will be highly appreciated. Thanks in advance for your help and time.

Bootstrapping in mixed linear models is very much like bootstrapping in regression except that you have the complication that the effects are divided into fixed and random. In regression to do the parametric bootstrap, you fit the parametric model to the data, compute the model residuals, bootstrap the residuals, take the bootstrap residuals and add them to the fitted model to get a bootstrap sample for the data and then fit the model to the bootstrap data to get bootstrap sample parameter estimates. You repeat the procedure by bootstrapping the original residuals again and then repeating the other steps in the procedure to get another bootstrap sample estimate of the parameters. For the nonparametric bootstrap, you create the vector of the response and covariate values and bootstrap the selection of vectors for the bootstrap sample. From the bootstrap sample, you fit the model to get the parameters and you repeat the process. The only difference between the parametric and nonparametric bootstrap is that you bootstrap the residuals for the parametric bootstrap while the nonparametric bootstrap bootstraps the vectors. In the mixed model case you also can have a semiparametric bootstrap by treating some effects parametrically and the others nonparametrically. If your code is bootstrapping vectors you are doing the nonparametric bootstrap. I don't have a specific solution to provide for doing this in R but if you look at Efron and Tibshirani's book or my book with Robert LaBudde you will see R code for similar types of models to the linear mixed model. The nonparametric bootstrap has been shown to be more robust than the parametric bootstrap when the model is misspecified.

• Thanks @Michael for your nice answer. I'd highly appreciate if you share examples for all three bootstrapping methods implemented in R. Commented May 30, 2012 at 20:12
• I don't think I have semiparametric examples. I am not an R programmer (yet). Robert LaBudde did all teh R programming in our book. He gives an example of a parametric bootstrap coded in R for a stationary autoregressive model (pp 120-122). On page 10 of the book he shows all the bootstrap functions in R that show up using the query">help.search('bootstrap') Efron and Tibshirani have documented in their book the bootstrap package in R that they call "bootstrap" another package due to Davison and Hinkley is their package "boot" which you can find out more about in their bootstrap book. Commented May 30, 2012 at 20:47
• It should be mentioned that strict nonparametric bootstrapping of a mixed model is prone to failure. It can completely omit a level of a random variable, which halts the process. Commented Feb 7, 2017 at 13:13

You might want to have a look at the bootMer function in the development version of lme4,

install_github("lme4",user="lme4")
library(lme4)


that can do model-based (semi-)parametric bootstrapping of mixed models... Just check ?bootMer