| mlmoderator-package | R Documentation |
mlmoderator provides a unified workflow for estimating, probing, and
visualizing multilevel moderation effects from mixed-effects models fitted
with lme4::lmer(). It supports simple slopes analysis, Johnson—Neyman
intervals, publication-ready interaction plots, and grand- or group-mean
centering.
| Function | Description |
mlm_center() | Grand- or group-mean center variables |
mlm_probe() | Compute simple slopes at selected moderator values |
mlm_jn() | Johnson-Neyman significance regions |
mlm_plot() | Publication-ready interaction plot |
mlm_summary() | Consolidated moderation report |
mlm_variance_decomp() | Decompose slope uncertainty into fixed + random components |
mlm_surface() | Slope surface heatmap over the full predictor x moderator space |
mlm_sensitivity() | Robustness of interaction to ICC shift and omitted confounders |
library(mlmoderator) library(lme4) data(school_data) # 1. Center variables dat <- mlm_center(school_data, vars = "ses", cluster = "school", type = "group") # 2. Fit model mod <- lmer(math ~ ses * climate + gender + (1 + ses | school), data = dat) # 3. Probe interaction mlm_probe(mod, pred = "ses", modx = "climate") # 4. Johnson-Neyman interval mlm_jn(mod, pred = "ses", modx = "climate") # 5. Plot mlm_plot(mod, pred = "ses", modx = "climate") # 6. Summary report mlm_summary(mod, pred = "ses", modx = "climate")
Maintainer: Subir Hait haitsubi@msu.edu (ORCID)
Useful links:
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.