Generate cases bootstrap replicates of a statistic for a nested linear mixed-effects model.

# S3 method for merMod
case_bootstrap(model, .f, B, resample, orig_data = NULL, .refit = TRUE)

# S3 method for lme
case_bootstrap(model, .f, B, resample, orig_data = NULL, .refit = TRUE)

case_bootstrap(model, .f, B, resample, orig_data = NULL, .refit = TRUE)

Arguments

model

The model object you wish to bootstrap.

.f

A function returning the statistic(s) of interest.

B

The number of bootstrap resamples.

resample

A logical vector specifying whether each level of the model should be resampled in the cases bootstrap. The levels should be specified from the highest level (largest cluster) of the hierarchy to the lowest (observation-level); for example for students within a school, specify the school level first, then the student level.

orig_data

the original data frame. This should be specified if variables are transformed within the formula for glmer() or lmer() and the case bootstrap is used.

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

Value

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

Details

The cases bootstrap is a fully nonparametric bootstrap that resamples the data with respect to the clusters in order to generate bootstrap samples. Depending on the nature of the data, the resampling can be done only for the higher-level cluster(s), only at the observation-level within a cluster, or at all levels. See Van der Leeden et al. (2008) for a nice discussion of this decision.

To resample a given level of the model, the corresponding entry in the logical vector specified in the resample parameter must be set to true. A few examples are given below in terms of a two-level model where students are clustered within schools:

  • To resample only the schools, set resample = c(TRUE, FALSE).

  • To resample only the students, set resample = c(FALSE, TRUE).

  • To resample both the students and the schools, set resample = c(TRUE, TRUE).

References

Van der Leeden, R., Meijer, E. and Busing F. M. (2008) Resampling multilevel models. In J. de Leeuw and E. Meijer, editors, Handbook of Multilevel Analysis, pages 401--433. New York: Springer.

See also