Description
Bootstrap Resampling for Multilevel Models.
Description
Functions for bootstrapping with multilevel data and models (and mixed-effect models). It implements multiple bootstrap methods under the parametric, residual, and case bootstrap categories, as discussed in Van der Leeden, Meijer, and Busing (2008) <doi:10.1007/978-0-387-73186-5_11> and Carpenter, Goldstein, and Rasbash (2003) <doi:10.1111/1467-9876.00415>. Currently it supports fitted objects from the 'lme4' package.
README.md
bootmlm
The bootmlm package does bootstrap resampling for multilevel models. Currently only models fitted with lme4::lmer() is supported. You can install the package on GitHub:
install.packages("bootmlm")
See this paper for a performance comparison of different bootstrapped confidence intervals for multilevel effect size estimations:
Lai, M. H. C. (2021). Bootstrap confidence interval for multilevel standardized effect size. Multivariate Behavioral Research, 56(4), 558--578. https://doi.org/10.1080/00273171.2020.1746902
Example
Here is an example to get the bootstrap distributions of the fixed effects and the level-1 error SD:
library(lme4)
fm01ML <- lmer(Yield ~ (1 | Batch), Dyestuff, REML = FALSE)
mySumm <- function(x) {
c(getME(x, "beta"), sigma(x))
}
# Covariance preserving residual bootstrap
library(bootmlm)
boo01 <- bootstrap_mer(fm01ML, mySumm, type = "residual", nsim = 100)
# Plot bootstrap distribution of fixed effect
library(boot)
plot(boo01, index = 1)
# Get confidence interval
boot.ci(boo01, index = 2, type = c("norm", "basic", "perc"))
# BCa using influence values computed from `empinf_mer`
boot.ci(boo01, index = 2, type = "bca", L = empinf_mer(fm01ML, mySumm, 2))