mlmoderator-package: mlmoderator: Probing and Visualizing Multilevel Interaction...

mlmoderator-packageR Documentation

mlmoderator: Probing and Visualizing Multilevel Interaction Effects

Description

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.

Core functions

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

Typical workflow

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")

Author(s)

Maintainer: Subir Hait haitsubi@msu.edu (ORCID)

See Also

Useful links:


mlmoderator documentation built on April 4, 2026, 1:07 a.m.