boot_se {mlmhelpr}R Documentation

Bootstrap Standard Errors (experimental)

Description

Computes bootstrapped standard errors for fixed effects. z-test returned using a standard normal reference distribution (interpret with caution)

Usage

boot_se(model, nsim = 5, seed = 1234, pct = 95, ...)

Arguments

model

a mixed model produced using the lme4 package (lmer or glmer functions). This is an object of class merMod. This function is a wrapper for lme4::bootMer

nsim

number of bootstrap samples to compute. Defaults to 5 but should be closer to 1,000 or 5,000. Note this is time intensive.

seed

random number seed for reproducibility. Defaults to 1234.

pct

percentage level for confidence interval. Defaults to 95.

...

additional parameters to pass to lme4::bootMer. Not currently implemented.

Value

A list containing a data frame with coefficient estimates and number of bootstrapped samples.

Examples


# lmer example
fit <- lme4::lmer(mathach ~ 1 + ses + catholic + (1|id),
data=hsb, REML=TRUE)

boot_se(fit)



# run time > 10s
# glmer example: logistic
  # Create binary outcome
hsb$binary_math <- ifelse(hsb$mathach <= 13, 0, 1)

fitb <- lme4::glmer(binary_math ~ 1 + ses + catholic + (1|id),
data=hsb, family = binomial(link="logit"))

boot_se(fitb)



[Package mlmhelpr version 0.1.1 Index]