missingmed runs regression (GLM)-based mediation analysis across incomplete data and pools with Rubin's rules. It is the missing-data middle of the mediationverse: a thin orchestration layer that fits each analysis with medfit and delegates inference to RMediation.
Two estimators share one S7 pipeline:
method = "mi") — pools per-imputation fits with
Rubin's rules.method = "ipw") — reweights complete cases
(stabilized weights, trimming, HC sandwich SEs).engine = "lavaan") — give lavaan syntax in
model, including a latent mediator; works with both estimators.sensitivity_mnar()) — repeats the
analysis with the imputed values shifted, giving a sensitivity curve.New to the package? Start with Choosing an analysis on the website.
For the indirect effect it provides both a Monte-Carlo confidence interval
and a D4-stacked MBCO likelihood-ratio test (which, unlike pooling, respects
the union-null geometry of H0: ab = 0).
From the Data-Wise R-universe (binaries, no compilation):
install.packages(
"missingmed",
repos = c("https://data-wise.r-universe.dev", "https://cloud.r-project.org")
)
Or the development version from GitHub:
# install.packages("pak")
pak::pak("Data-Wise/missingmed")
set_md_mediation() -> run() -> pool() -> infer()
MDMediationData MDMediationFit MDMediationResult CI / MBCO
library(missingmed)
# `imp` is a mice::mids object; X -> M -> Y with confounder C
md <- set_md_mediation(imp, Y ~ X + M + C, M ~ X + C,
treatment = "X", mediator = "M") # method = "mi" (default)
res <- pool(run(md))
infer(res, type = "mc") # Monte-Carlo CI for the indirect effect
infer(run(md), type = "mbco", ariv = "fixed") # D4-stacked MBCO test of H0: ab = 0
Inverse-probability weighting takes a raw data.frame:
md_ipw <- set_md_mediation(df, Y ~ X + M + C, M ~ X + C,
treatment = "X", mediator = "M", method = "ipw")
infer(pool(run(md_ipw)), type = "mc")
See vignette("missingmed") to get started, vignette("mbco-mi") for why MBCO
needs the per-imputation fits, and vignette("technical") for the full design,
contracts, and methodology.
missingmed → {medfit (fitting), RMediation (inference)}; simulation via
medsim. All are part of the mediationverse.
Cite the version you used:
citation("missingmed")
GPL (>= 3) · Davood Tofighi (dtofighi@gmail.com) · ORCID 0000-0001-8523-7776