Causal Mediation (ACME + ADE)

Verified

Mediation (legacy hub)

Independently verified. Every statistic this test reports has been re-derived against an independent reference — never the library the pipeline itself calls — the rendered output was read back in a browser, and the result is locked with a committed regression suite.

Run this test straight away on a free built-in teaching dataset — no data of your own needed — or bring your own. Either opens the guided workspace: variable setup, assumption diagnostics, results with effect sizes and confidence intervals, figures, and APA-ready reporting.

Loading teaching datasets…

Or use your own dataset

Loading your datasets…

Estimates mediation in a modern causal framework — natural direct and indirect effects, allowing exposure–mediator interaction.

Causal mediation decomposes the total effect into natural direct and indirect effects under explicit assumptions (no unmeasured confounding), handling exposure × mediator interaction that classic Baron-Kenny can't.

Worked example

How much of a drug's effect on recovery works via inflammation?

Causal mediation decomposed the drug→recovery effect into natural direct and indirect (via inflammation) effects (n = 400, bootstrapped).

Result

63% of the total effect was mediated by inflammation (natural indirect effect = 0.22, 95% CI [0.13, 0.31]).

How you'd report it (APA)

Causal mediation showed inflammation mediated 63% of the drug's effect on recovery (NIE = 0.22, 95% CI [0.13, 0.31]).

Try it yourself: Load this ready-made sample and follow the run above.

When to use it

  • You need a defensible causal claim
    The counterfactual (NDE/NIE) decomposition rests on stated assumptions rather than the Baron-Kenny recipe.
  • Exposure and mediator may interact
    The effect of M on Y differs by level of X — something the classic product-of-coefficients approach cannot represent.
  • You want a mediated proportion
    NIE / total effect gives the share of the effect explained by the mediator.

When NOT to — use instead

  • A simple linear mechanism, no interaction
    If X and M don't interact and Y is continuous, the classic approach is simpler and equivalent. Simple mediation

Hypotheses

H₀: the natural indirect effect (NIE) is zero — none of X's total effect on Y passes through M.
Hₐ: the NIE is non-zero. The total effect is decomposed into a natural direct effect (NDE) and NIE, each with a bootstrap CI; mediation is supported when the NIE CI excludes 0.

Parameter tested: the natural indirect and direct effects (NIE, NDE), which sum to the total effect and permit an exposure×mediator interaction

Assumptions (and what to do if they fail)

No unmeasured exposure–outcome confoundinghigh

Check: Ideally X is randomised; otherwise every common cause of X and Y must be measured and adjusted.

If violated: Both NDE and NIE are biased.

No unmeasured mediator–outcome confoundinghigh

Check: No omitted common cause of M and Y — not guaranteed even when X is randomised.

If violated: The NIE is biased; this is the assumption that most often fails in practice.

No mediator–outcome confounder affected by the exposurehigh

Check: X must not cause a confounder of the M–Y link.

If violated: The natural-effect decomposition is not identified; interventional effects are needed instead.

Correct outcome and mediator modelsmedium

Check: The interaction and any non-linearity are specified as intended.

If violated: Mis-specification carries straight into the effect estimates.

Ready to run a Causal Mediation (ACME + ADE) on your own data?

Guided setup, automatic assumption checks, effect sizes, figures and an APA write-up.

Run this test →