case_bootstrap: Cases Bootstrap for Nested LMEs

View source: R/generics.R

case_bootstrap.merModR Documentation

Cases Bootstrap for Nested LMEs

Description

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

Usage

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

## S3 method for class '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.

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

Value

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

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

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