resid_bootstrap: Residual Bootstrap for Nested LMEs

View source: R/generics.R

resid_bootstrap.merModR Documentation

Residual Bootstrap for Nested LMEs

Description

Generate semi-parametric residual bootstrap replicates of a statistic for a nested linear mixed-effects model.

Usage

## S3 method for class 'merMod'
resid_bootstrap(model, .f, B, .refit = TRUE, rbootnoise = 0)

## S3 method for class 'lme'
resid_bootstrap(model, .f, B, .refit = TRUE, rbootnoise)

resid_bootstrap(model, .f, B, .refit = TRUE, rbootnoise = 0)

Arguments

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 TRUE.

rbootnoise

a numeric value between 0-1 indicating the strength of technical 2-level noise added in relation to the 1-level variation (in standard deviations) during residual bootstrapping. Minuscule noise, such as rbootnoise = 0.0001, can be used to avoid errors with singular matrices when exactly the same values are replicated during the bootstrapping, or when the model being processed fails to return any 2-level variation. Currently applicable only with lme4::lmer models. The feature has been tested with 2-level random-intercept models with predictors. Defaults to 0 (i.e. the feature is not used by default).

Details

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:

  1. Obtain the parameter estimates from the fitted model and calculate the estimated error terms and EBLUPs.

  2. 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.

  3. Sample independently with replacement from the rescaled estimated error terms and rescaled EBLUPs.

  4. Obtain bootstrap samples by combining the samples via the fitted model equation.

  5. Refit the model and extract the statistic(s) of interest.

  6. Repeat steps 3-5 B times.

Value

The returned value is an object of class "lmeresamp".

References

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.

See Also

  • 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.


lmeresampler documentation built on Feb. 16, 2023, 6:53 p.m.