Causal mediation: natural direct & indirect effects (CMAverse)
@misc{cmaverse,
title = {CMAverse},
author = {Shi and Valeri and others},
howpublished = {\url{https://bs1125.github.io/CMAverse/}},
note = {Software / documentation}
}Follow the analysis.
Select a node to explore the method
Treatment, mediator, outcome, confounders
Data preparation — shapes the raw inputs into what the estimator expects.
Lay out the mediation DAG and the confounders of the A→M, A→Y and M→Y links.
library(CMAverse)
# a (treatment), m (mediator), y (outcome), C (confounders)
Before using this step, make its assumptions and its output explicit. A useful peer note explains what you would check, what could go wrong, or what would change your interpretation.
Questions to explore- Which assumption matters most here, and what evidence could challenge it?
- What would you check before passing this output to the next step?
Choose a question to start your comment.
Peer discussion
- Bring your experience, a question, or a different perspective.
Log in to comment on this step.
Fit mediator & outcome models
The core estimate — where the causal quantity itself is computed.
A regression/g-formula (or weighting) approach to both models.
cmest(data=df, model='rb', outcome='y', exposure='a',
mediator='m', basec=C, EMint=TRUE)
Before using this step, make its assumptions and its output explicit. A useful peer note explains what you would check, what could go wrong, or what would change your interpretation.
Questions to explore- Which assumption matters most here, and what evidence could challenge it?
- What would you check before passing this output to the next step?
Choose a question to start your comment.
Peer discussion
- Bring your experience, a question, or a different perspective.
Log in to comment on this step.
Decompose the total effect
Uncertainty quantification — standard errors, intervals, and aggregation.
Report the natural direct and indirect effects (and the mediated proportion).
summary(res) # NDE, NIE, total, proportion mediated
Before using this step, make its assumptions and its output explicit. A useful peer note explains what you would check, what could go wrong, or what would change your interpretation.
Questions to explore- Which assumption matters most here, and what evidence could challenge it?
- What would you check before passing this output to the next step?
Choose a question to start your comment.
Peer discussion
- Bring your experience, a question, or a different perspective.
Log in to comment on this step.
Sensitivity to mediator–outcome confounding
A robustness check — does the headline result survive a different lens?
How strong an unmeasured M–Y confounder would overturn the conclusion.
cmsens(res, sens='uc')
Before using this step, make its assumptions and its output explicit. A useful peer note explains what you would check, what could go wrong, or what would change your interpretation.
Questions to explore- Which assumption matters most here, and what evidence could challenge it?
- What would you check before passing this output to the next step?
Choose a question to start your comment.
Peer discussion
- Bring your experience, a question, or a different perspective.
Log in to comment on this step.
Inputs & data
A treatment, a mediator on the causal path, an outcome, and the confounders of each link.
Show data format & exampleHide example
Format — one row per unit: treatment a, mediator m, outcome y, confounders C.
a m y c1 c2
1 0.6 3.2 0.4 -1.1
0 0.2 1.8 -0.1 0.6
Figures reproduced from CMAverse — Shi, Valeri et al. — unofficial community showcase; all credit to the original authors.
⚠️ Unofficial community showcase of cmaverse. Not affiliated with the authors; all credit to them.
Split a total effect into what flows through a mediator (indirect) and what doesn't (direct) — with a sensitivity analysis for mediator–outcome confounding.
Discuss the workflow (0)
Log in to join the discussion.