R/bootstrap_lme4.R
, R/bootstrap_nlme.R
, R/generics.R
resid_bootstrap.Rd
Generate semi-parametric residual bootstrap replicates of a statistic for a nested linear mixed-effects model.
# S3 method for merMod resid_bootstrap(model, .f, B, .refit = TRUE) # S3 method for lme resid_bootstrap(model, .f, B, .refit = TRUE) resid_bootstrap(model, .f, B, .refit = TRUE)
model | The model object you wish to bootstrap. |
---|---|
.f | A function returning the statistic(s) of interest. |
B | The number of bootstrap resamples. |
.refit | a logical value indicating whether the model should be refit to
the bootstrap resample, or if the simulated bootstrap resample should be
returned. Defaults to |
The returned value is an object of class "lmeresamp".
The semi-parametric bootstrap algorithm implemented was outlined by Carpenter, Goldstein and Rasbash (2003), and is referred to as the CGR bootstrap by some. The algorithm is outlined below:
Obtain the parameter estimates from the fitted model and calculate the estimated error terms and EBLUPs.
Center and rescale the error terms and EBLUPs so that the empirical variance of these quantities is equal to estimated variance components from the model.
Sample independently with replacement from the rescaled estimated error terms and rescaled EBLUPs.
Obtain bootstrap samples by combining the samples via the fitted model equation.
Refit the model and extract the statistic(s) of interest.
Repeat steps 3-5 B times.
Carpenter, J. R., Goldstein, H. and Rasbash, J. (2003) A novel bootstrap procedure for assessing the relationship between class size and achievement. Journal of the Royal Statistical Society. Series C (Applied Statistics), 52, 431--443.
Examples are given in bootstrap
parametric_bootstrap
, resid_bootstrap
,
case_bootstrap
, reb_bootstrap
,
wild_bootstrap
for more details on a specific bootstrap.
bootMer
in the lme4 package for an
implementation of (semi-)parametric bootstrap for mixed models.