Math for Causal Inference
All simulators

Direct & Indirect Effects

Controlled and natural direct effects, the indirect effect, and the bias from an unmeasured mediator–outcome confounder.

Day 58: Mediation: Direct & Indirect Effects
0123-2-101234mediator level meffectNDE 1.50TE 2.75E[M | X = 0]
CDE(m)NDE = CDE at E[M|X=0]total effect
NDE
1.50
estimated 1.50
NIE
1.25
estimated 1.25
TE
2.75
mediated 45%

M = β0 + β1·X + g·U + e_M and Y = θ1·X + θ2·M + θ3·X·M + c·U + e_Y. The controlled direct effect CDE(m) = θ1 + θ3·m varies with the mediator level (line); NDE and NIE come from the mediation formula. With an unmeasured mediator–outcome confounder U (g, c ≠ 0), estimates from the regression of Y on X, M and X·M (dashed) are biased.