case_bootstrap.merMod | R Documentation |
Generate cases bootstrap replicates of a statistic for a nested linear mixed-effects model.
## 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)
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 |
.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 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)
.
The returned value is an object of class "lmeresamp".
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.
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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.