Skip to content

Mediation analysis

Separate direct and mediated causal effects in a fictional execution-policy model, and see why randomised treatment does not remove mediator–outcome confounding.

Mediation analysis studies how an exposure or intervention affects an outcome through an intermediate variable, called a mediator. For a quant evaluating an execution policy, it separates “did the policy change trading cost?” from “how much of that change passed through execution intensity?” The second question requires stronger causal inference assumptions than a comparison of average costs.

A policy, a mechanism and a cost

Consider a fictional execution experiment. Let X=0X=0 denote a baseline schedule and X=1X=1 an accelerated schedule. Let MM be a centred execution-intensity score, measured after assignment but before the final cost is measured. Let YY be centred implementation shortfall in basis points of parent-order notional; a positive change means higher cost.

Assume the following structural equations describe interventions, rather than merely fitting historical observations:
M=2X+u,Y=3X+4M+v.M=2X+u,\qquad Y=3X+4M+v.

Here uu and vv are independent, zero-mean disturbances, independent of randomised XX. Their distributions stay unchanged when XX is set externally. Assume no interference between experimental orders. There is no XMXM interaction: one extra score point changes cost by 4 bp under either schedule.

Changing XX from 0 to 1 increases MM by 2 points. The mediated route therefore adds 2×4=82\times4=8 bp. Holding the mediator fixed leaves a 3 bp direct increase. Substitution checks the total:

Y=3X+4(2X+u)+v=11X+4u+v.Y=3X+4(2X+u)+v=11X+4u+v.
Thus the intervention adds 11 bp in total: 3 bp directly and 8 bp through the chosen score. These are consequences of the fictional model, not estimated trading costs. “Direct” means outside this mediator; it can include other unmodelled mechanisms, rather than an instantaneous physical effect.
Fictional causal execution model: changing policy X from 0 to 1 raises intensity M by 2 score points; each point adds 4 bp of shortfall. The mediated effect is 8 bp, direct effect 3 bp and total effect 11 bp.
Fictional causal execution model: changing policy X from 0 to 1 raises intensity M by 2 score points; each point adds 4 bp of shortfall. The mediated effect is 8 bp, direct effect 3 bp and total effect 11 bp.
Original fictional path diagram. The arrows state the assumed causal structure; the calculation does not establish that real execution data follow it.

Which direct effect?

Using the potential outcomes framework, write M(x)M(x) for the mediator under policy xx, and Y(x,m)Y(x,m) for the outcome if both policy and mediator were set to x,mx,m. Population-average effects for the change from 0 to 1 include:

TargetDefinitionQuestion
Total effectE[Y(1,M(1))−Y(0,M(0))]\mathbb{E}[Y(1,M(1))-Y(0,M(0))]What changes when the whole policy changes?
Controlled direct effect at mmE[Y(1,m)−Y(0,m)]\mathbb{E}[Y(1,m)-Y(0,m)]What changes if everyone’s mediator is fixed to the same mm?
Natural direct effectE[Y(1,M(0))−Y(0,M(0))]\mathbb{E}[Y(1,M(0))-Y(0,M(0))]What changes while each order retains its baseline mediator value?
Natural indirect effect at policy 1E[Y(1,M(1))−Y(1,M(0))]\mathbb{E}[Y(1,M(1))-Y(1,M(0))]What changes through the mediator while policy stays at 1?
The last two sum to the total effect by adding and subtracting the same counterfactual outcome. They compare hypothetical worlds; the same order’s M(0)M(0) and M(1)M(1) are not jointly observed. Controlled and natural effects answer different questions. Pearl’s original formulation distinguishes them explicitly.

In the additive example, the controlled direct effect is 3 bp for every mm, the natural direct effect is 3 bp, and the natural indirect effect is 8 bp. With an interaction, the controlled direct effect can depend on mm, and the indirect effect can depend on which policy is held fixed. The displayed natural-effect pair still decomposes the total; the simple coefficient product need not describe every indirect-effect contrast.

Why two regressions are not enough

Fitting MM on XX, then YY on XX and MM, gives associations. Interpreting their coefficients causally requires a defensible design. A standard identification route assumes sufficient pre-treatment adjustment for exposure–mediator, exposure–outcome and mediator–outcome confounding, plus consistency, suitable overlap and no interference. Natural effects require additional counterfactual restrictions; familiar assumptions also exclude mediator–outcome confounders caused by the exposure. These requirements are stronger than a good regression fit.

Randomising XX helps with exposure assignment. It does not randomise MM: unrecorded market stress may increase both intensity and shortfall. The coefficient on MM then mixes its effect with stress. Under the appropriate identification assumptions, linearity and no exposure–mediator interaction justify the simple product method. Imai, Keele and Tingley explain this connection and sensitivity analysis for violations.
The distinction between an endogenous slope and a structural effect is developed in Endogeneity and Instrumental Variables (public preview; full lesson requires membership). It supports the regression warning here, rather than providing a mediation identification strategy.

The danger of controlling for what the policy changes

Including MM blocks the mediated route, so its adjusted XX coefficient is not generally a total effect. It is not automatically a direct effect either. If hidden stress affects both MM and YY, conditioning on MM can open the collider path X→M←stress→YX\to M\leftarrow\text{stress}\to Y.
A harder case arises if the policy changes market conditions LL, which subsequently affect both intensity and cost. Adjusting for LL as though it were a baseline control does not generally identify natural effects; omitting it does not solve the confounding. This is post-treatment bias, not a request to add every available regressor. VanderWeele, Vansteelandt and Robins show why exposure-induced mediator–outcome confounding obstructs the usual natural-effect identification and discuss alternative effect definitions.

For an execution study, specify the timing, mediator, outcome horizon and target contrast before fitting. Report uncertainty and sensitivity to hidden confounding; a precise coefficient product cannot compensate for an unidentified mechanism.

Practice: a randomised policy, a confounded mediator

In another fictional model, XX is randomised independently of zero-mean hidden stress UU:

M=X+U,Y=2X+3M+2U.M=X+U,\qquad Y=2X+3M+2U.

There are no interactions. What are the structural direct, indirect and total effects of changing XX from 0 to 1? Would the coefficient on XX in a regression of YY on XX and MM recover the direct effect?

Answer. The direct effect is 2 outcome units, the indirect effect is 1×3=31\times3=3, and the total is 5. But U=M−XU=M-X, so the observed equation becomes Y=5MY=5M. With nondegenerate independent variation in XX and UU, the adjusted XX coefficient is therefore 0, not 2. Randomisation identifies the total contrast here; it does not remove hidden mediator–outcome confounding. The accompanying numerical check verifies this with all four equally likely combinations of X∈{0,1}X\in\{0,1\} and U∈{−1,1}U\in\{-1,1\}.

Sources

Last updated
  • causal inference
  • mediation
  • direct effects
  • indirect effects
  • confounding
  • execution research
← Back to the glossaryBack to top ↑