View source: R/bootstrap_mer.R
bootstrap_mer | R Documentation |
Run multilevel parametric, residual, and case bootstrap with different options
Run multilevel parametric, residual, and case bootstrap with different options
bootstrap_mer(
x,
FUN,
nsim = 1,
seed = NULL,
type = c("parametric", "residual", "residual_cgr", "residual_trans", "reb", "case"),
corrected_trans = FALSE,
lv1_resample = FALSE,
reb_scale = FALSE,
.progress = FALSE,
verbose = FALSE,
...
)
bootstrap_mer(
x,
FUN,
nsim = 1,
seed = NULL,
type = c("parametric", "residual", "residual_cgr", "residual_trans", "reb", "case"),
corrected_trans = FALSE,
lv1_resample = FALSE,
reb_scale = FALSE,
.progress = FALSE,
verbose = FALSE,
...
)
x |
A fitted |
FUN |
A function taking a fitted |
nsim |
A positive integer telling the number of simulations, positive
integer; the bootstrap |
seed |
Optional argument to |
type |
A character string indicating the type of multilevel bootstrap.
Currently, possible values are |
corrected_trans |
Logical indicating whether to use the correct
variance-covariance matrix of the residuals. If |
lv1_resample |
Logical indicating whether to sample with replacement
the level-1 units for each level-2 cluster. Only used for
|
reb_scale |
Logical indicating whether to scale the residuals for the random effect block bootstrap |
.progress |
Logical indicating whether to display progress bar (using
|
verbose |
Logical indicating if progress should print output. |
... |
argument passed to .resid_resample. |
bootstrap_mer
performs different bootstrapping methods to fitted
model objects using the lme4 package. Currently, only models fitted
using lmer
is supported.
bootstrap_mer
performs different bootstrapping methods to fitted
model objects using the lme4 package. Currently, only models fitted
using lmer
is supported.
An object of S3 class "boot", compatible with boot package's
boot()
. It contains the following components:
t0 |
The original statistic from |
t |
A matrix with |
R |
The value of |
data |
The data used in the original analysis. |
An object of S3 class "boot"
, compatible with boot
package's boot()
. It contains the following components:
t0 |
The original statistic from |
t |
A matrix with |
R |
The value of |
data |
The data used in the original analysis. |
seed |
The value of |
statistic |
The function |
See the documentation in for link[boot]{boot}()
for the other
components.
Carpenter, J. R., Goldstein, H., & Rasbash, J. (2003). A novel bootstrap procedure for assessing the relationship between class size and achievement. Journal of the Royal Statistical Society. Series C (Applied Statistics), 52, 431–443. https://doi.org/10.1111/1467-9876.00415
Chambers, R., & Chandra, H. (2013). A random effect block bootstrap for clustered data. Journal of Computational and Graphical Statistics, 22(2), 452–470. https://doi.org/10.1080/10618600.2012.681216
Davison, A. C. and Hinkley, D. V. (1997). Bootstrap methods and their application. Cambridge, UK: Cambridge University Press.
Morris, J. S. (2002). The BLUPs are not "best" when it comes to bootstrapping. Statistics & Probability Letters, 56(4), 425–430. https://doi.org/10.1016/S0167-7152(02)00041-X
Van der Leeden, R., Meijer, E., & Busing, F. M. T. A. (2008). Resampling multilevel models. In J. de Leeuw & E. Meijer (Eds.), Handbook of multilevel Analysis (pp. 401–433). New York, NY: Springer.
boot
for single-level bootstrapping,
bootMer
for parametric and semi-parametric bootstrap
implemented in lme4, and boot.ci
for getting
bootstrap confidence intervals.
boot
for single-level bootstrapping,
bootMer
for parametric and semi-parametric
bootstrap implemented in lme4, and
boot.ci
for getting bootstrap confidence
intervals and plot.boot
for plotting the bootstrap
distribution.
library(lme4)
fm01ML <- lmer(Yield ~ (1 | Batch), Dyestuff, REML = FALSE)
mySumm <- function(x) {
c(getME(x, "beta"), sigma(x))
}
# Covariance preserving residual bootstrap
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_`
boot.ci(boo01, index = 2, type = "bca", L = empinf_mer(fm01ML, mySumm, 2))
library(lme4)
fm01ML <- lmer(Yield ~ (1 | Batch), Dyestuff, REML = FALSE)
mySumm <- function(x) {
c(getME(x, "beta"), sigma(x))
}
# Covariance preserving residual bootstrap
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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.