A mediator is a variable through which part or all of the causal influence of one variable on another operates. In a causal diagram, treatment affects the mediator, which affects the outcome: T → M → O. A treatment may also affect the outcome directly, so the mediator identifies one route rather than the entire effect. section 2.5.4 section 6.1.2
Kidney-stone treatment
Suppose treatment changes post-treatment kidney-stone size, and stone size affects recovery. Post-treatment size is a mediator: treatment influences recovery directly and indirectly through the change in size. The overall treatment effect includes both routes. section 2.5.4 section 6.1.2
Figure 2.13 Graph with a mediator. For example, post-treatment size is a mediator in the kidney stone example. Once a treatment is given to a patient, their kidney stone’s size may change. M stands for Mediator, T for Treatment, and O for Outcome.
Use the causal graph to distinguish the direct treatment-to-outcome path from the indirect path through post-treatment size. section 2.5.4
A mediator changes how causal effects should be interpreted and estimated:
- Estimate the total effect without adjusting for the mediator when the goal is to capture every way treatment affects the outcome. Adjusting for the mediator can introduce bias. section 2.5.4 section 2.5.9
- Separate direct and indirect effects when the mechanism matters. In linear models, total effect equals direct effect plus indirect effect; this equality does not generally hold for nonlinear models. section 6.1.2
- Classify the middle variable before choosing an adjustment strategy: a mediator differs from a confounder and a collider, even when all appear in a three-node graph. section 6.1.2 section 2.5.9
Table 2.7 Types of variables to consider in the adjustment formula
|
Type of variable
|
Should it be included in the adjustment formula for calculating
P(
Y = 1|do(
X =
x))?
|
|---|---|
|
Confounder
|
Definitely.
|
|
Missing confounder
|
Definitely, but not possible. This is a problem!
|
|
Mediator
|
No: it will introduce bias.
|
|
Outcome predictive variable
|
It doesn’t introduce bias; in general, it is recommended because it may improve statistical accuracy.
|
|
Treatment predictive variable
|
It doesn’t introduce bias; in general, it is not recommended because it may hurt statistical accuracy.
|
Check the adjustment table for the contrast between mediators, confounders, and predictive variables. section 2.5.9
Regression makes the distinction operational: with a mediator Z, a model including X and Z estimates the direct effect, while a model using X alone estimates the total effect. The treatment, mediator, or confounder role depends on the causal question being asked. section 6.1.2 section 6.1.2
Table 6.6 Mediator: causal paths
|
DAG
|
In equations
|
Mediator: causal paths shown with double-headed arrows comprise the direct path from X to Y and the path that goes through Z.
|
where
ε
Z,
ε
X, and
ε
Y are independent of each other.
|
Compare the equation and diagram for the two causal paths connecting X and Y through mediator Z. section 6.1.2

