R/bootstrap_lme4.R
, R/bootstrap_nlme.R
, R/generics.R
reb_bootstrap.Rd
Generate random effect block (REB) bootstrap replicates of a statistic for a two-level nested linear mixed-effects model.
# S3 method for lmerMod reb_bootstrap(model, .f, B, reb_type, .refit = TRUE) # S3 method for lme reb_bootstrap(model, .f, B, reb_type, .refit = TRUE) reb_bootstrap(model, .f, B, reb_type, .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. |
reb_type | Specification of what random effect block bootstrap version to
implement. Possible values are |
.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 random effects block (REB) bootstrap was outlined by Chambers and Chandra (2013) and has been developed for two-level nested linear mixed-effects (LME) models. Consider a two-level LME of the form $$y = X \beta + Z b + \epsilon$$
The REB bootstrap algorithm (type = 0
) is as follows:
Calculate the nonparametric residual quantities for the fitted model
marginal residuals \(r = y - X\beta\)
predicted random effects \(\tilde{b} = (Z^\prime Z)^{-1} Z^\prime r\)
error terms \(\tilde{e} = r - Z \tilde{b}\)
Take a simple random sample, with replacement, of the predicted random effects, \(\tilde{b}\).
Draw a simple random sample, with replacement, of the group (cluster) IDs. For each sampled cluster, draw a random sample, with replacement, of size \(n_i\) from that cluster's vector of error terms, \(\tilde{e}\).
Generate bootstrap samples via the fitted model equation \(y = X \widehat{\beta} + Z \tilde{b} + \tilde{e}\)
Refit the model and extract the statistic(s) of interest.
Repeat steps 2-5 B times.
Variation 1 (type = 1
):
The first variation of the REB bootstrap zero centers and rescales the
residual quantities prior to resampling.
Variation 2 (type = 2
):
The second variation of the REB bootstrap scales the estimates and centers
the bootstrap distributions (i.e., adjusts for bias) after REB bootstrapping.
Chambers, R. and Chandra, H. (2013) A random effect block bootstrap for clustered data. Journal of Computational and Graphical Statistics, 22, 452--470.
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.