robust_se {mlmhelpr}R Documentation

Robust Standard Errors

Description

Implements cluster-robust standard errors from the clubSandwich package. The clubSandwich package is required to use this function. See mlmhelpr::boot_se for an alternative.

Usage

robust_se(model, type = "CR2", pct = 95)

Arguments

model

model produced using the lme4::lmer() function. This is an object of class merMod and subclass lmerMod.

type

character string specifying the estimation type. Options include "CR0", "CR1", "CR1p", "CR1S", "CR2", or "CR3". Defaults to "CR2". See details in clubSandwich::vcovCR.

pct

percentage level for confidence interval. Defaults to 95. Must be specified as a whole number between 1 and 100 (e.g., 99, 95, 80).

Value

Data frame and message indicating type of robust standard error requested.

References

Pustejovsky J (2022). clubSandwich: Cluster-Robust (Sandwich) Variance Estimators with Small-Sample Corrections. R package version 0.5.8, https://CRAN.R-project.org/package=clubSandwich.

Examples




# run time > 5s
fit <- lme4::lmer(mathach ~ 1 + ses + catholic + (1|id),
data=hsb, REML=TRUE)

robust_se(fit)




[Package mlmhelpr version 0.1.0 Index]