Causal Mediation Analysis
Estimation of pathway-specific causal contrasts through a post-treatment mediator, with explicit direct/indirect estimands and assumptions beyond those needed for the total treatment effect.
On this page
Estimation of pathway-specific causal contrasts through a post-treatment mediator, with explicit direct/indirect estimands and assumptions beyond those needed for the total treatment effect. Use when the scientific question concerns a specified pathway and the data and assumptions support more than a total-effect comparison.
Definition and scope
Estimation of pathway-specific causal contrasts through a post-treatment mediator, with explicit direct/indirect estimands and assumptions beyond those needed for the total treatment effect. The target population, use, and analysis remain protocol decisions; this card explains the choices and their consequences rather than approving a study.
Operational specification
Define treatment, mediator, outcome, their timing, baseline confounders, exposure-induced mediator-outcome confounders, target population, and controlled, natural, or interventional direct/indirect contrasts. Natural effects involve cross-world counterfactual structure; alternative interventional effects can target different questions under different identification conditions.
Analysis and diagnostics
Use an identification argument and estimator compatible with mediator/outcome types and the assumed confounding structure. Check positivity, measurement and temporal ordering, treatment-mediator interaction, and sensitivity to unmeasured mediator-outcome confounding. Explain the effect scale before decomposing a total effect or calculating a proportion mediated.
When NOT to use and common errors
Do not call the coefficient change after adjusting for a mediator a causal indirect effect, condition on an exposure-induced collider without justification, assume randomized treatment randomizes the mediator, or report a proportion mediated without checking scale, interaction, and near-zero/opposite-signed effects.
Worked example and implementation boundary
Under a synthetic additive decomposition already justified by a causal model, direct risk difference is 0.03 and indirect risk difference is 0.02. Sum them; the arithmetic does not establish identification. The stated additive total is 0.05. Natural or interventional decomposition assumptions must be justified separately. The code performs that explicitly stated calculation with synthetic inputs. It is not a complete fitted analysis and does not demonstrate the identification assumptions, estimate sampling uncertainty, or certify application in another population.
Data-source and reporting requirements
Preserve the provenance, dates, units, and observation rule for each input. Claims capture services and transactions under observable benefits; absence of a record is not proof that an event or resource use did not occur. EHR and registry measurements depend on the collection process and may miss care outside the system. Linked sources add reconciliation and selection questions. Primary collection can improve a missing domain but still requires valid measurement and follow-up. Report which of these limitations affects the stated use, which evidence supports the chosen inputs, and what remains uncertain.
Worked example
Scenario
Under a synthetic additive decomposition already justified by a causal model, direct risk difference is 0.03 and indirect risk difference is 0.02. Sum them; the arithmetic does not establish identification.
Dataset
Synthetic inputs with units defined in the scenario; no patient data.
| input | value |
|---|---|
| direct_rd | 0.03 |
| indirect_rd | 0.02 |
Steps
Result
The stated additive total is 0.05. Natural or interventional decomposition assumptions must be justified separately.
Trade-offs
Code example
Executed example · Python 3.11.15 · 2026-11-01T02:04:28+00:00
Self-contained synthetic calculation for the worked example only. Inputs and units are listed in the dataset; output is the displayed scalar. This does not fit the full study/model, estimate uncertainty, or select an analysis for a real study.
direct_rd = 0.03
indirect_rd = 0.02
result = direct_rd+indirect_rd
assert abs(result - 0.05) < 1e-9
print(result)
Executed example · Rscript (R) version 4.6.1 (2026-06-24) · 2026-11-01T02:04:28+00:00
Self-contained synthetic calculation for the worked example only. Inputs and units are listed in the dataset; output is the displayed scalar. This does not fit the full study/model, estimate uncertainty, or select an analysis for a real study.
direct_rd <- 0.03
indirect_rd <- 0.02
result <- direct_rd+indirect_rd
stopifnot(abs(result - 0.05) < 1e-9)
print(result)
Illustrative example · execution not verified
Self-contained synthetic calculation for the worked example only. Inputs and units are listed in the dataset; output is the displayed scalar. This does not fit the full study/model, estimate uncertainty, or select an analysis for a real study. SAS source is illustrative until executed in a compatible SAS runtime.
data worked_example;
direct_rd = 0.03;
indirect_rd = 0.02;
result = direct_rd+indirect_rd;
put result=;
run;