MethodAtlas
MechanismModern

Causal Mediation Analysis

Goes beyond 'does the treatment work?' to ask 'through which pathway does it work?' — extends the Baron-Kenny framework by addressing its identification challenges.

Quick Reference

When to Use
When you want to understand the mechanism through which a treatment affects an outcome — decomposing the total effect into natural direct and natural indirect (mediated) components.
Key Assumption
Sequential ignorability: (1) treatment is unconfounded given covariates, AND (2) the mediator is unconfounded given treatment and covariates. Assumption 2 is much stronger than standard unconfoundedness because the mediator is not randomized, even in experiments.
Common Mistake
Using Baron & Kenny (1986) three-step method without recognizing its strong assumptions about no treatment-mediator interaction and no mediator-outcome confounding. Conducting sensitivity analysis for sequential ignorability is recommended (Imai et al., 2010).
Estimated Time
3 hours

One-Line Implementation

Stata: medeff (reg mediator treatment x1 x2) (reg outcome mediator treatment x1 x2), treat(treatment) mediate(mediator) sims(1000)
R: mediate(model.m, model.y, treat = 'treatment', mediator = 'mediator', boot = TRUE, sims = 1000)
Python: # No mature Python mediation package; use R mediation via rpy2

Download Full Analysis Code

Complete scripts with diagnostics, robustness checks, and result export.

Motivating Example

You run a randomized experiment: a job training program for unemployed workers. The randomization is clean, and you find a significant positive effect on earnings. The program works.

But your program officer asks the most natural follow-up question: How does it work? Does the program boost earnings because it builds human capital (workers learn new skills)? Because it provides a signal to employers (a certificate on the resume)? Or because it expands the workers' professional networks (connections lead to job offers)?

These queries are mechanism questions, and they require mediation analysis. You want to decompose the total effect into the parts that flow through each pathway:

Total Effect=Effect through human capitalindirect via M1+Effect through signalingindirect via M2+Effect through networksindirect via M3+All other pathsdirect effect\text{Total Effect} = \underbrace{\text{Effect through human capital}}_{\text{indirect via } M_1} + \underbrace{\text{Effect through signaling}}_{\text{indirect via } M_2} + \underbrace{\text{Effect through networks}}_{\text{indirect via } M_3} + \underbrace{\text{All other paths}}_{\text{direct effect}}

This decomposition turns out to be much harder than it looks.

A. Overview

The Baron and Kenny Legacy

For decades, management researchers followed the Baron and Kenny (1986) approach to mediation.

(Baron & Kenny, 1986)

The approach involves three OLS regressions:

  1. Regress the outcome on the treatment: Y=cT+e1Y = c \cdot T + e_1 (check that cc is significant)
  2. Regress the mediator on the treatment: M=aT+e2M = a \cdot T + e_2 (check that aa is significant)
  3. Regress the outcome on both treatment and mediator: Y=cT+bM+e3Y = c' \cdot T + b \cdot M + e_3 (check that bb is significant and that cc' is reduced compared to cc)

The indirect effect is a×ba \times b, and mediation is "established" if cc' is smaller than cc (partial mediation) or non-significant (full mediation).

This procedure is intuitive, easy to implement, and has been widely cited in the social sciences. It is also, in many settings, deeply problematic. Here is why.

What Baron and Kenny Gets Wrong

The Baron and Kenny approach implicitly assumes:

  1. No treatment-mediator interaction. The effect of MM on YY is the same regardless of treatment status. This assumption rules out, for example, the possibility that human capital matters more for program participants than for non-participants.

  2. No unmeasured confounders of the mediator-outcome relationship. This requirement is the killer assumption. Even if TT is randomized, MM is not randomized. Workers who gain the most human capital from training might also be the most motivated, and motivation independently affects earnings.

  3. Linear, additive effects. The three-regression approach assumes a specific parametric structure.

The modern causal mediation framework, developed by Imai et al. (2010) and by , makes these assumptions explicit and provides tools for assessing whether they are plausible.

(Imai et al., 2010)

Common Confusions

"What is sequential ignorability?"

is the key assumption of the modern causal mediation framework. It has two parts:

  1. Treatment is ignorable given pre-treatment covariates. Satisfied by randomization of TT or by assuming selection on observables.

  2. The mediator is ignorable given treatment and pre-treatment covariates. Conditional on TT and observed covariates, MM is as good as randomly assigned. This condition is the much harder assumption.

The second part is demanding because even when TT is randomized, MM is typically endogenous. Workers who gain more human capital from training may differ from those who gain less, in ways that also affect earnings. Sequential ignorability requires that all such confounders are observed and controlled for.

"Can I do mediation with observational data?"

Technically yes, but the bar is very high. Doubly robust methods can help with model misspecification in the outcome and mediator equations, but they do not solve the fundamental confounding problem. You need both parts of sequential ignorability to hold. Without randomization of treatment, you need unconfoundedness of TT. Without randomization of MM conditional on TT, you need unconfoundedness of MM given TT and XX. In practice, this requirement means you need an extremely rich set of covariates and a strong theoretical justification.

Even with experimental data (randomized TT), the second part of sequential ignorability is a strong assumption because MM is not randomized.

"What about Zhao et al. (2010)?"

(Zhao et al., 2010)

Zhao et al. (2010) provided an important critique of Baron and Kenny from within the management literature. They argued that the "step 1" requirement (significant total effect) is unnecessary and introduced a more sensible classification of mediation types (complementary, competitive, indirect-only, direct-only, no-effect). This classification was a significant step forward, but it still operates within the regression framework rather than the full causal framework.

B. Identification

Potential Outcomes Framework for Mediation

Let Mi(t)M_i(t) be the mediator value under treatment tt. Let Yi(t,m)Y_i(t, m) be the outcome under treatment tt and mediator value mm.

The Natural Direct Effect (NDE) is:

NDE=E[Y(1,M(0))Y(0,M(0))]NDE = E[Y(1, M(0)) - Y(0, M(0))]

The NDE captures all paths from TT to YY that do not go through MM.

The Natural Indirect Effect (NIE) is:

NIE=E[Y(1,M(1))Y(1,M(0))]NIE = E[Y(1, M(1)) - Y(1, M(0))]

The NIE captures the path from TT to YY that goes through MM.

The total effect decomposes cleanly:

TE=NDE+NIETE = NDE + NIE

Sequential Ignorability (Formal)

Assumption 1: {Y(t,m),M(t)} ⁣ ⁣ ⁣TX=x\{Y(t', m), M(t)\} \perp\!\!\!\perp T \mid X = x for all t,t,mt, t', m

Assumption 2: Y(t,m) ⁣ ⁣ ⁣MT=t,X=xY(t', m) \perp\!\!\!\perp M \mid T = t, X = x for all t,t,mt, t', m

C. Visual Intuition

The classic mediation DAG:

T --> M --> Y
T ---------> Y

The problem arises from unmeasured confounders:

T --> M --> Y
T ---------> Y
      U ----> M
      U ----> Y

If UU exists and is unobserved, controlling for MM does not isolate the indirect effect — it introduces bias through UU.

Interactive Simulation

Mediation: Baron-Kenny vs. Causal Framework

Adjust the strength of the indirect path, the direct path, and the confounding of the mediator-outcome relationship. Compare the Baron-Kenny indirect effect estimate to the true causal indirect effect.

05.1910.3715.56Simulated ValueTrue Indire…Direct Effe…Mediator-Ou…Sample SizeParameters
05
05
03
1002000
Interactive Simulation

Mediation: Decomposing the Total Effect

DGP: D → M → Y and D → Y. Direct effect = 2.0, indirect effect = 2.0, total = 4.0. Confounding of M = 0.00. N = 400.

Causal Path Diagrama = 1.99b = 1.05c' = 1.87DMYTotal Effect DecompositionDirect: 1.86Indirect: 2.09= 3.95
Direct (ADE)Indirect (ACME)

Estimation Results

Estimatorβ̂SE95% CIBias
Total effect (target: 4.00)closest3.9500.070[3.81, 4.09]-0.050
Baron-Kenny a*b (target: 2.00)2.0830.111[1.86, 2.30]+0.083
Modern ACME (target: 2.00)2.0880.115[1.86, 2.31]+0.088
Naive D coef (target: 2.00)1.8670.110[1.65, 2.08]-0.133
True β4.000
400

Number of observations

2.0

Causal effect of D on Y not through M

2.0

Causal effect of D on Y flowing through M

0.00

Violation of sequential ignorability (U affects both M and Y)

Why the difference?

The total effect of D on Y is 3.95. Of the total effect, 2.09 flows through the mediator M (indirect/ACME) and 1.86 operates directly (ADE). The Baron-Kenny product of coefficients gives 2.08, which is close to the modern causal mediation estimate (2.09). In the linear case, these converge to the same population quantity, but the modern approach (quasi-Bayesian Monte Carlo) propagates parameter uncertainty through simulation, yielding more accurate confidence intervals—especially for small samples or near-zero effects where the delta method can be unreliable. With no confounding (sequential ignorability satisfied), naively controlling for M gives 1.87, which closely approximates the true direct effect.

D. Mathematical Derivation

Don't worry about the notation yet — here's what this means in words: Under sequential ignorability, the natural indirect effect can be identified from observed data by integrating the outcome model over the mediator distribution under treatment and control.

Under sequential ignorability, Imai et al. (2010) show that the ACME for treatment group dd is:

ACME(d)=[E[YT=d,M=m,X=x]dFMT=1,X(m)    E[YT=d,M=m,X=x]dFMT=0,X(m)]dFX(x)\text{ACME}(d) = \int \left[ \int E[Y \mid T = d, M = m, X = x] \, dF_{M|T=1,X}(m) \;-\; \int E[Y \mid T = d, M = m, X = x] \, dF_{M|T=0,X}(m) \right] dF_X(x)

Each inner integral averages the outcome model over the mediator distribution under treatment (T=1T=1) and control (T=0T=0) separately; the ACME is the difference between these two averages.

In the linear case with no interaction:

Y=α+βT+γM+θX+εY = \alpha + \beta T + \gamma M + \boldsymbol{\theta}' X + \varepsilonM=αM+δT+ϕX+uM = \alpha_M + \delta T + \boldsymbol{\phi}' X + u

The indirect effect simplifies to:

NIE=γ×δNIE = \gamma \times \delta

This expression is the Baron-Kenny product of coefficients. Under linearity and no interaction, the modern framework gives the same answer.

With a treatment-mediator interaction:

Y=α+β1T+β2M+β3T×M+θX+εY = \alpha + \beta_1 T + \beta_2 M + \beta_3 T \times M + \boldsymbol{\theta}' X + \varepsilon

The indirect effect becomes:

NIE=(β2+β3t)×δNIE = (\beta_2 + \beta_3 t) \times \delta

Now the indirect effect depends on the treatment level tt. Baron-Kenny cannot capture this dependence.

Sensitivity analysis. Since Assumption 2 is untestable, the sensitivity parameter ρ\rho represents the correlation between the error terms in the mediator and outcome models. When ρ=0\rho = 0, sequential ignorability holds. Reporting how large ρ\rho must be to nullify the indirect effect gives the reader a sense of robustness.

E. Implementation

library(mediation)

# Step 1: Mediator model
model.m <- lm(mediator ~ treatment + x1 + x2, data = df)

# Step 2: Outcome model
model.y <- lm(outcome ~ treatment + mediator + x1 + x2, data = df)

# Step 3: Causal mediation analysis
med_out <- mediate(model.m, model.y,
                 treat = "treatment",
                 mediator = "mediator",
                 boot = TRUE, sims = 1000)
summary(med_out)
plot(med_out)

# Step 4: Sensitivity analysis
sens_out <- medsens(med_out, rho.by = 0.05, effect.type = "indirect")
summary(sens_out)
plot(sens_out)
# Report: at what value of rho does the indirect effect cross zero?
Requiresmediation

F. Diagnostics

  1. Sensitivity analysis for sequential ignorability. Report the Imai-Keele-Tingley sensitivity parameter ρ\rho. How large must the mediator-outcome confounding be to nullify the indirect effect? If the breakpoint ρ\rho is small (e.g., 0.05-0.10), your finding is fragile.

  2. Treatment-mediator interaction. Test for T×MT \times M interactions in the outcome model. If significant, the simple a×ba \times b decomposition is biased.

  3. Multiple mediators. If you have several mediators, check whether they are causally ordered. If M1M_1 causes M2M_2, you cannot simply run separate mediation analyses for each.

  4. Pre-treatment covariates. Check that all covariates you condition on are truly pre-treatment. Including post-treatment variables introduces bias.

  5. Comparison with Baron and Kenny. Report both the a×ba \times b product and the modern causal mediation estimates. If they agree, your results are robust to the choice of framework.

  6. Placebo mediators. Test mediators that should not be affected by the treatment. If you find "mediation" through a placebo mediator, something is wrong.

Interpreting Your Results

Significant indirect effect, robust to sensitivity analysis: You have credible evidence for mediation. Report the proportion mediated and the sensitivity parameter at which the indirect effect becomes zero.

Significant indirect effect, sensitive to confounding: The indirect effect is suggestive but not robust. Be honest. Report that even moderate confounding of the mediator-outcome relationship could explain the result.

Non-significant indirect effect: Be careful about concluding "no mediation." You might lack statistical power, or the mediator might be poorly measured. Measurement error in the mediator attenuates the indirect effect.

G. What Can Go Wrong

Assumption Failure Demo

Ignoring Mediator-Outcome Confounding (Sequential Ignorability Violation)

Randomize the treatment, acknowledge that the mediator is not randomized, and conduct a sensitivity analysis for mediator-outcome confounding using the Imai-Keele-Tingley rho parameter.

Indirect effect: 0.12 (SE = 0.04, p = 0.003). Sensitivity analysis: the indirect effect crosses zero at rho = 0.25, suggesting moderate robustness to unmeasured confounding of the mediator-outcome path.

Assumption Failure Demo

Ignoring Treatment-Mediator Interaction

Include a treatment-by-mediator interaction term in the outcome model and use the modern causal mediation framework, which allows the indirect effect to depend on the treatment level.

NIE at T=1: 0.14 (SE = 0.04). NIE at T=0: 0.06 (SE = 0.03). The indirect effect is larger for treated units, indicating a meaningful treatment-mediator interaction that Baron-Kenny would miss.

Assumption Failure Demo

Post-Treatment Confounders Creating Intermediate Confounding

Carefully check that all covariates in the mediation model are pre-treatment. If a post-treatment variable confounds the mediator-outcome relationship, acknowledge the 'intermediate confounder' problem and discuss its implications.

After removing the post-treatment variable (job search intensity), the indirect effect estimate changes from 0.20 to 0.11 (SE = 0.04). The researcher discusses the intermediate confounder problem and reports both estimates with appropriate caveats.

H. Practice

Concept Check

You conduct a randomized experiment testing a leadership training program (T) on employee performance (Y). You measure 'leadership self-efficacy' (M) as a potential mediator. You find: T significantly affects M (a = 0.4), and in the joint model, M significantly predicts Y (b = 0.3), while the direct effect of T on Y is non-significant. A colleague says: 'Great, we have full mediation.' What is the problem?

Guided Exercise

Causal Mediation: How Does Job Training Improve Earnings?

A labor economist studies a randomized job training program and asks: does training raise earnings by improving technical skills (the mediator), or does it work through other pathways like confidence and networking? The treatment T is random assignment to training. The mediator M is a technical skills test score measured 6 months after training. The outcome Y is earnings at 2 years.

What is the direct effect (CDE/NDE) in this study?

What is the indirect effect (NIE) in this study?

What is sequential ignorability, and is it satisfied here?

If the total effect is +\$3,000 and the indirect effect through skills is +\$1,200, what is the direct effect, and what proportion of the total is mediated?

Error Detective

Read the analysis below carefully and identify the errors.

A management researcher studies how CSR announcements affect firm value, mediated by consumer sentiment. The treatment (CSR announcement) is not randomized. The researcher runs the Baron-Kenny procedure: (1) CSR announcement significantly predicts stock returns (c = 0.05), (2) CSR announcement significantly predicts consumer sentiment (a = 0.12), (3) with both in the model, consumer sentiment predicts stock returns (b = 0.15) and the CSR coefficient drops to 0.03. The researcher concludes: 'Consumer sentiment mediates 40% of the CSR-stock return relationship.'

Select all errors you can find:

Referee Exercise

Read the paper summary below and write a brief referee critique (2-3 sentences) of the identification strategy.

Paper Summary

The authors study whether CEO social capital affects firm innovation through knowledge alliances. Using a panel of 3,000 firms, they find a total effect of 0.15 and an indirect effect through alliances of 0.09, concluding that 60% of the social capital effect on innovation operates through knowledge alliances.

Key Table

EstimateCoefSE95% CI
Total Effect0.150.04[0.07, 0.23]
ACME (indirect)0.090.03[0.03, 0.15]
ADE (direct)0.060.04[-0.02, 0.14]
Prop. Mediated60%
Sensitivity rho0.12

Authors' Identification Claim

We use the Imai-Keele-Tingley framework with 1,000 bootstrap replications. The sequential ignorability assumption is supported by our rich set of controls including firm size, age, industry, and R&D intensity.

I. Swap-In: When to Use Something Else

  • Total-effect estimation (DiD, IV, RDD): When the total effect is sufficient and the mediator is not well-measured or the mechanism is not the primary question.
  • Structural equation modeling (SEM): When the causal model involves multiple mediators with known structure and the goal is simultaneous estimation of all pathways.
  • Instrumental mediation: When the sequential ignorability assumption is implausible and an instrument for the mediator is available to identify the indirect effect.
  • Controlled direct effects: When the question is about blocking a specific pathway (what would happen if the mediator were held fixed) rather than decomposing the total effect into indirect and direct components.

J. Reviewer Checklist

Critical Reading Checklist


Paper Library

Foundational (6)

Baron, R. M., & Kenny, D. A. (1986). The Moderator-Mediator Variable Distinction in Social Psychological Research: Conceptual, Strategic, and Statistical Considerations.

Journal of Personality and Social PsychologyDOI: 10.1037/0022-3514.51.6.1173

Baron and Kenny introduced the widely used four-step approach to testing mediation, comparing total, direct, and indirect effects using sequential regressions. While later work has identified limitations of this approach, it remains one of the most cited papers in all of social science.

Imai, K., Keele, L., & Tingley, D. (2010). A General Approach to Causal Mediation Analysis.

Psychological MethodsDOI: 10.1037/a0020761

Imai, Keele, and Tingley developed a general framework for causal mediation analysis grounded in the potential outcomes framework. They clarified the assumptions needed for identifying causal mediation effects, particularly the sequential ignorability assumption, and provided sensitivity analyses for violations.

Pearl, J. (2001). Direct and Indirect Effects.

Proceedings of the Seventeenth Conference on Uncertainty in Artificial Intelligence

Pearl formalized the concepts of natural direct and indirect effects using structural causal models and do-calculus. This paper established the nonparametric identification conditions for mediation effects and showed that traditional mediation analysis conflates causal and non-causal pathways.

Robins, J. M., & Greenland, S. (1992). Identifiability and Exchangeability for Direct and Indirect Effects.

Robins and Greenland provided early formal conditions for identifying direct and indirect causal effects in epidemiology. Their work on controlled direct effects and the assumptions required for mediation analysis laid important groundwork for the modern causal mediation literature.

Pearl, J. (2014). Interpretation and Identification of Causal Mediation.

Psychological MethodsDOI: 10.1037/a0036434

Pearl provided a structural causal model perspective on mediation, clarifying the interpretation and identification of natural direct and indirect effects. He showed how graphical criteria can determine when mediation effects are identifiable and contrasted the structural approach with the potential outcomes framework used by Imai, Keele, and Tingley.

Acharya, A., Blackwell, M., & Sen, M. (2016). Explaining Causal Findings Without Bias: Detecting and Assessing Direct Effects.

American Political Science ReviewDOI: 10.1017/S0003055416000216

Acharya, Blackwell, and Sen developed a sequential g-estimation approach for estimating controlled direct effects in observational studies, addressing the problem that conditioning on a post-treatment mediator can introduce collider bias. Their method is particularly useful in political science and social science settings where intermediate confounders make standard mediation analysis unreliable.

Application (5)

VanderWeele, T. J. (2015). Explanation in Causal Inference: Methods for Mediation and Interaction.

Oxford University Press

VanderWeele's comprehensive textbook unified the causal mediation literature, covering potential outcomes and structural equation approaches, sensitivity analysis, time-varying treatments, and interaction effects. It is the standard reference for researchers conducting mediation analysis.

MacKinnon, D. P., Fairchild, A. J., & Fritz, M. S. (2007). Mediation Analysis.

Annual Review of PsychologyDOI: 10.1146/annurev.psych.58.110405.085542

MacKinnon, Fairchild, and Fritz provided an accessible review of mediation analysis methods for psychologists, covering the Baron-Kenny approach, the Sobel test, bootstrapping methods, and extensions to multiple mediators. This survey helped bridge the gap between traditional and modern approaches.

Preacher, K. J., & Hayes, A. F. (2008). Asymptotic and Resampling Strategies for Assessing and Comparing Indirect Effects in Multiple Mediator Models.

Behavior Research MethodsDOI: 10.3758/BRM.40.3.879

Preacher and Hayes developed methods and software for testing indirect effects through multiple mediators simultaneously, using bootstrapping to construct confidence intervals. Their approach and accompanying SPSS and SAS macros became extremely widely used in psychology and management research.

Aguinis, H., Edwards, J. R., & Bradley, K. J. (2017). Improving Our Understanding of Moderation and Mediation in Strategic Management Research.

Organizational Research MethodsDOI: 10.1177/1094428115627498

Aguinis, Edwards, and Bradley reviewed how mediation and moderation analyses are conducted in strategic management research and identified common errors. They provided recommendations for improving practice, including using causal mediation frameworks and proper inference procedures.

Zhao, X., Lynch, J. G., & Chen, Q. (2010). Reconsidering Baron and Kenny: Myths and Truths about Mediation Analysis.

Journal of Consumer ResearchDOI: 10.1086/651257

Zhao, Lynch, and Chen provided an important critique of the Baron and Kenny mediation framework from within the management literature. They argued that the 'step 1' requirement of a significant total effect is unnecessary and introduced a more sensible classification of mediation types (complementary, competitive, indirect-only, direct-only, no-effect). While still operating within the regression framework rather than the full causal framework, this paper was a significant step forward for applied researchers.

Survey (1)

VanderWeele, T. J. (2016). Mediation Analysis: A Practitioner's Guide.

Annual Review of Public HealthDOI: 10.1146/annurev-publhealth-032315-021402

VanderWeele provided an accessible practitioner-oriented guide to modern causal mediation analysis, covering the assumptions required for identification, sensitivity analysis for unmeasured confounding, and extensions to multiple mediators and interactions. This review is an excellent entry point for applied researchers seeking to move beyond the Baron-Kenny framework.

Tags

mechanismmediationpathway