Part 4 · Module 6
Mediators, Moderators and Effect Modifiers
Distinguish mechanisms from conditional effects and statistical interaction, and plan appropriate measurement, analysis and interpretation.
Learning outcomes
After completing this lecture, you should be able to:
- distinguish mediators, moderators, effect modifiers and statistical interaction
- explain how a mediator differs from a confounder through causal timing and structure
- formulate total-effect, direct-effect and conditional-effect research questions
- identify design and measurement requirements for mediation and effect-modification analyses
- appraise claims about mechanisms and subgroup effects without relying solely on p-values
Overview
Health researchers often ask two different questions:
- How or through what pathway does an exposure or intervention affect an outcome?
- For whom, where or under what conditions does the effect differ?
A mediator is an intermediate variable through which part of an effect may operate. A moderator is a broad term for a variable that changes the strength or direction of a relationship. In epidemiology, effect modification means that the effect of an exposure or intervention differs across levels of another variable on a specified effect scale. Statistical interaction refers to a departure from additivity in a chosen statistical model [1–3].
These ideas overlap but are not interchangeable. Mediation concerns mechanism and causal pathways. Effect modification concerns heterogeneity of effects. Statistical interaction depends on model and scale.
Why this matters
Mechanism and subgroup claims influence clinical targeting, implementation and theory. Yet they are easy to overstate. A variable measured after exposure is not automatically a mediator. A significant interaction term does not prove a biologically distinct mechanism. Separate significance tests in two subgroups do not establish that effects differ.
Good planning requires clear time order, prespecified hypotheses, reliable measurement and adequate sample size. Causal mediation analysis additionally requires strong assumptions about confounding of the exposure–outcome, exposure–mediator and mediator–outcome relationships [4].
Mediation: asking about pathways
Consider:
A → M → Y
A → Y
A is the exposure or intervention, M the mediator and Y the outcome. The total effect includes all pathways from A to Y. A direct effect represents a contrast not operating through the specified mediator under a particular causal definition. An indirect effect represents the pathway through the mediator.
These effects are counterfactual quantities: they compare outcomes under hypothetical exposure and mediator conditions. Their identification cannot be achieved merely by adding a mediator to a conventional regression model.
Necessary time order
A mediator should occur after the exposure and before the outcome. Measurement times must support this order. Cross-sectional measurement of exposure, mediator and outcome at one occasion usually leaves temporal direction ambiguous.
Mediator versus confounder
A confounder precedes exposure and is a common cause of exposure and outcome. A mediator is caused by exposure and lies on a pathway to the outcome. Misclassifying a mediator as a confounder can remove part of the total effect.
Exposure-induced mediator–outcome confounding
A post-exposure variable may affect both the mediator and outcome. Conventional mediation approaches can then fail because controlling for that variable may block part of the exposure effect while not controlling leaves mediator–outcome confounding. More advanced causal methods and carefully defined effects may be needed.
Designing a mediation study
Define the intervention and mechanism
Explain how the intervention is expected to change the mediator and how the mediator is expected to change the outcome. A plausible story is not enough; specify measurable processes and time points.
Measure pre-exposure confounders
Potential common causes of exposure, mediator and outcome should be identified prospectively, often using a DAG.
Measure the mediator before the outcome
The interval should allow the mechanism to operate. Repeated mediator measurements may be needed when the process evolves.
Maintain outcome ascertainment
Mediator non-response should not determine whether outcomes are measured. Restricting to participants with complete mediator data can introduce selection bias.
Anticipate measurement error
Poor mediator measurement can distort direct and indirect effects. A single proxy may not represent the mechanism.
Plan sample size for the mediation estimand
A study powered only for the total effect may be too imprecise for indirect effects, especially when pathways are modest.
Specify a mediation question
- exposure or intervention contrast;
- outcome and time horizon;
- mediator definition and measurement time;
- total, direct and indirect effects of interest;
- exposure–outcome confounders;
- exposure–mediator confounders;
- mediator–outcome confounders;
- possible exposure-induced confounders;
- missing-data and measurement-error strategy; and
- sensitivity analysis for unmeasured mediator–outcome confounding.
Moderation and effect modification
Effect modification asks whether the effect differs across levels of a variable. Examples include differences by baseline risk, genotype, age, disease severity, clinic capacity or social context.
The modifier should usually be measured before exposure for clear interpretation, although contextual or time-varying modification can be studied with more complex designs.
Scale dependence
Effect modification can differ by effect scale. There may be no interaction on a risk-ratio scale but meaningful interaction on a risk-difference scale. Therefore, statements such as “there was no interaction” are incomplete without naming the scale and estimand.
Clinical and public-health interpretation
Absolute-effect modification is often important for decisions because baseline risk varies. The same relative effect can produce a larger absolute benefit in a higher-risk group.
Statistical interaction
A product term in a regression model tests a particular form of interaction on the model’s scale. It is one tool, not the definition of effect modification. Flexible modelling may be needed when effects vary non-linearly.
Mediation and effect modification compared
illustrativeTable 1. Distinct questions and implications
| Feature | Mediation | Effect modification |
|---|---|---|
| Main question | Through what pathway does A affect Y? | Does the effect of A on Y differ across Z? |
| Position in time | Mediator follows A and precedes Y | Modifier is commonly baseline or contextual |
| Main quantities | total, direct and indirect effects | stratum-specific or conditional effects |
| Typical risk | mediator–outcome confounding and post-exposure bias | data-driven subgroup claims and scale ambiguity |
| Policy use | identify mechanisms or intervention components | target, tailor or transport interventions |
Effect modifier versus confounder
A variable can be both a confounder and an effect modifier. For example, clinic capacity may influence booking and completion, creating confounding, while the effect of booking may also differ between high- and low-capacity clinics.
The analytical implications are distinct:
- confounding control aims to obtain an unbiased effect estimate;
- effect-modification analysis aims to estimate and present different effects across levels.
Adjusting for a variable does not automatically evaluate effect modification. Interaction or stratified estimates must be specified.
Moderator terminology
In psychology and behavioural research, moderator often refers to a variable that changes the association between an exposure and outcome. The term may be used without causal claims. In causal epidemiology, effect modification is defined through contrasts of causal effects. Researchers should define their usage rather than assume disciplines use the terms identically [2].
Presenting effect modification responsibly
Recommended presentation includes:
- effects within relevant strata;
- confidence intervals for each stratum-specific effect;
- the contrast between effects on at least one explicit scale; and
- a test or interval for interaction where appropriate [3].
Do not conclude that effects differ because one subgroup has p < 0.05 and another has p > 0.05. The correct question is whether the effects themselves differ.
Additive and multiplicative interaction
For two binary factors A and Z:
- additive interaction examines whether the joint absolute effect exceeds the sum of separate absolute effects;
- multiplicative interaction examines whether the joint relative effect exceeds the product of separate relative effects.
Public-health questions about preventable cases often benefit from additive-scale assessment. Regression models may default to multiplicative interaction, so the scale should be chosen based on the question rather than software convenience.
Mediation and interaction can coexist
The exposure may interact with the mediator, or a modifier may alter one pathway but not another. The total effect can then be decomposed into components involving mediation and interaction under advanced causal frameworks [5]. This requires careful assumptions and is not captured by a simple “percentage mediated”.
Percent mediated can be unstable or difficult to interpret when direct and indirect effects have opposite directions, when outcomes are non-linear, or when exposure–mediator interaction exists.
Choosing a design for mechanism and heterogeneity
Randomisation of the exposure or intervention strengthens the exposure–mediator and exposure–outcome comparisons, but it does not randomise the mediator. The mediator–outcome relationship may still be confounded by baseline characteristics, evolving symptoms, treatment response or service processes. A mediation study therefore needs more than a randomised exposure.
Prospective longitudinal designs are preferable when mechanism is central because they can establish measurement order and capture change. Repeated mediator measurements can distinguish an early intervention response from a stable baseline trait, although they also introduce time-varying confounding and more complex estimands. Experimental manipulation of a proposed mediator can provide stronger mechanistic evidence when it is ethical and feasible.
For effect modification, the design should ensure adequate representation across the modifier range. A trial with very few participants in one subgroup cannot provide a stable subgroup effect even when the overall effect is precise. Cluster-level modifiers require enough clusters, not merely many individuals within a few clinics. Continuous modifiers should usually remain continuous and be modelled flexibly rather than divided at the sample median.
A sequence of studies may be most credible: first establish an overall effect, then test a small number of theory-supported mechanisms and modifiers, and finally replicate important heterogeneity in a new sample or setting.
Measurement considerations
Mediator measurement
The mediator instrument should represent the proposed mechanism, be measured at a meaningful time and distinguish intervention delivery from participant response.
Modifier measurement
Modifiers should have defensible categories or flexible continuous modelling. Arbitrary dichotomisation can create or conceal interaction.
Outcome consistency
Use the same outcome definition across strata and mediator levels. Differential ascertainment can mimic effect heterogeneity.
Context and level
Clinic capacity is a clinic-level modifier, while travel burden is individual-level. Multilevel structure must be respected.
Analysis map for the booking intervention
illustrativeTable 2. Prespecified pathway and heterogeneity questions
| Question | Variable | Timing | Planned interpretation |
|---|---|---|---|
| Does booking reduce arrangement burden? | perceived arrangement burden | 1–2 weeks after discharge | intervention-to-mediator pathway |
| Does burden influence completion? | arrangement burden | before outcome | mediator-to-outcome pathway, subject to confounding |
| Does booking work differently by travel time? | travel time | baseline | effect modification on absolute and relative scales |
| Does booking work differently by clinic capacity? | clinic capacity | baseline/contextual | cluster-level effect modification |
Interpreting mediation results
An estimated indirect effect should be interpreted as evidence compatible with a specified pathway under the study’s assumptions. It does not show that the mediator is the only mechanism or that intervening directly on the mediator would reproduce the same outcome effect. The mediator may have several versions, and the intervention may change it through processes not captured by the measurement.
Avoid describing a mechanism as “fully mediated” merely because a direct-effect estimate is not statistically significant. Direct effects can be imprecise, and absence of statistical significance is not evidence that no pathway remains. Report total, direct and indirect estimates with confidence intervals and explain the assumptions.
The proportion mediated is attractive but can be misleading. It may fall outside 0% to 100%, become unstable when the total effect is small, and obscure opposing pathways. Absolute direct and indirect effects are often easier to interpret.
Interpreting effect heterogeneity
Effect modification should be interpreted using the pattern, magnitude and uncertainty of stratum-specific effects. A smooth gradient across baseline risk may be more plausible than a sharp difference created by an arbitrary cut-point. Results should be related to clinical decisions: whether the intervention remains beneficial, whether absolute benefit changes enough to alter prioritisation, and whether harms or implementation burden also differ.
Replication matters because interaction estimates are usually less precise than main effects. A modifier discovered in one dataset should be validated in another population or tested in a subsequent study before it drives exclusion or treatment restriction. Transportability also requires examining whether the modifier distribution and contextual mechanisms are similar across settings.
Negative controls and triangulation for mechanisms
Mechanism claims can be strengthened through triangulation. Qualitative evidence may show whether participants experienced the proposed process. Process data can establish that the intervention changed the mediator at the expected time. Negative-control outcomes or exposures may reveal residual bias where appropriate. Experimental component studies can test whether changing the proposed mechanism changes the outcome.
No single analysis is definitive. Coherent findings across designs, measures and populations provide more credible mechanistic evidence than one mediation coefficient.
Planning for precision and multiplicity
Indirect effects and interactions are often estimated less precisely than overall effects. The sample-size plan should reflect the main pathway or heterogeneity estimand rather than assuming that power for the total effect is sufficient. For cluster-level modifiers, the number of clusters can be the limiting information.
Prespecify a small hierarchy of mechanism and modifier hypotheses. When several mediators, outcomes, time points and interaction scales are examined, distinguish confirmatory from exploratory analyses and report the full set rather than only favourable results. Confidence intervals should remain central because a non-significant interaction can still be compatible with clinically important heterogeneity. Conversely, a statistically significant interaction may be too small to affect practice. The plan should define the minimum heterogeneity that would alter a clinical, implementation or policy decision, and it should anticipate sparse data where exposure, modifier and outcome combinations are uncommon. Graphical presentation of predicted outcomes or absolute effects across the modifier range can be more informative than one product-term coefficient.
Ethical and equity considerations
Subgroup analyses can inform equitable tailoring but can also stigmatise groups or imply biological difference where structural pathways are more plausible. Small subgroup estimates may be identifiable in sensitive populations.
Interface with statistical analysis
The analysis plan should distinguish:
- primary total-effect analysis;
- prespecified mediation estimands;
- prespecified effect modifiers and scales;
- exploratory subgroup analyses;
- model form for continuous modifiers;
- clustering and repeated measures;
- multiplicity and precision; and
- sensitivity analyses for causal mediation assumptions.
Detailed regression interaction and mediation estimation belong in advanced Biostatistics content. Methodologically, the key is to ensure that the data structure and timing can answer the proposed question.
Causal mediation assumptionsMMed extension
Identification of natural direct and indirect effects generally requires no unmeasured confounding of exposure–outcome, exposure–mediator and mediator–outcome relationships, together with appropriate treatment of exposure-induced mediator–outcome confounding. These assumptions are strong and partly untestable. Sensitivity analysis should examine how unmeasured mediator–outcome confounding could alter conclusions [4]. Alternative interventional effects can be useful when natural-effect assumptions are difficult to justify.
Worked example
Separating mechanism and heterogeneity questions
Total-effect question: What is the effect of discharge appointment booking on testing completion by day 112?
Mechanism hypothesis: Booking reduces the work required to arrange testing, which increases completion.
Mediator: arrangement-burden score measured two weeks after discharge.
Confounders: baseline health engagement, clinic capacity, travel burden and other common causes identified in the DAG.
Potential complication: reminder receipt is caused by booking and may affect both perceived burden and completion. Treating it as an ordinary confounder could distort mediation analysis.
Effect-modification question: Does the booking effect differ by baseline travel burden?
Presentation: estimate completion under booking and usual referral within clinically meaningful travel-burden values, report risk differences and risk ratios with confidence intervals, and report the contrast between effects.
Interpretation limit: An observed indirect effect would support—but not by itself prove—the proposed mechanism because mediator measurement and unmeasured confounding remain concerns.
Suggested protocol or reporting wording
Where decisions depend on subgroup effects, external replication and assessment of harms, feasibility and acceptability should accompany effectiveness estimates. These decisions should be reviewed with clinicians, patients and implementation stakeholders before subgroup-based recommendations are made.
Common mistakes
Knowledge check
How does a mediator differ from a confounder?
Answer and reasoning
A mediator is caused by the exposure and lies on a pathway to the outcome. A confounder is a pre-exposure common cause of exposure and outcome. Their timing and causal structure lead to different adjustment implications.
One subgroup has p = 0.02 and another has p = 0.20. Does this prove effect modification?
Answer and reasoning
No. The evidence concerns whether the subgroup-specific effects differ, assessed through an interaction contrast and its uncertainty. Different p-values can arise from different precision even when effect estimates are similar.
Why must the effect scale be stated?
Answer and reasoning
Effect modification can be present on an additive scale but absent on a multiplicative scale, or vice versa. The scale determines what kind of effect difference is being assessed and should match the decision question.
Can a variable be both a confounder and an effect modifier?
Answer and reasoning
Yes. It may need control because it affects exposure and outcome, and the exposure effect may also vary across its levels. Confounding control and heterogeneity estimation are separate tasks.
Key take-home messages
Key take-home messages
- Mediation asks how an effect operates; effect modification asks when or for whom it differs.
- Time order and causal structure distinguish mediators from confounders.
- Statistical interaction is model- and scale-specific.
- Subgroup effects should be compared directly with confidence intervals, not by comparing significance labels.
- Causal mediation claims require strong assumptions and sensitivity analysis.
References
- Baron RM, Kenny DA. The moderator–mediator variable distinction in social psychological research: conceptual, strategic, and statistical considerations. J Pers Soc Psychol. 1986;51(6):1173–1182. https://doi.org/10.1037/0022-3514.51.6.1173
- VanderWeele TJ. On the distinction between interaction and effect modification. Epidemiology. 2009;20(6):863–871. https://doi.org/10.1097/EDE.0b013e3181ba333c
- Knol MJ, VanderWeele TJ. Recommendations for presenting analyses of effect modification and interaction. Int J Epidemiol. 2012;41(2):514–520. https://doi.org/10.1093/ije/dyr218
- VanderWeele TJ. Mediation analysis: a practitioner’s guide. Annu Rev Public Health. 2016;37:17–32. https://doi.org/10.1146/annurev-publhealth-032315-021402
- VanderWeele TJ. A unification of mediation and interaction: a 4-way decomposition. Epidemiology. 2014;25(5):749–761. https://doi.org/10.1097/EDE.0000000000000121
These materials support learning and research planning. They require adaptation to the study context and do not replace methodological, statistical, ethical, or regulatory consultation.