03 · What You Need to Know
Confounder and Mediator Are Positions in a Causal Structure
A confounder sits outside the causal pathway of interest
Suppose researchers want to estimate the causal effect of X on Y.
A simple confounding structure might be:
C → X
C → Y
X → Y
C is a common cause of X and Y. If C is not appropriately addressed, some of the observed X–Y association may reflect differences in C rather than the causal effect of X.
For example, suppose researchers study whether voluntary attendance at academic tutorials improves final examination performance. Prior achievement may influence both the decision to attend tutorials and later performance.
In that study, prior achievement may be a confounder.
Confounder
Contributes to a noncausal exposure–outcome association that threatens estimation of the causal effect of interest.
Typical position
Upstream of both the exposure and outcome rather than caused by the exposure.
A mediator lies on the pathway from exposure to outcome
Now consider a different structure:
X → M → Y
M occurs downstream of X and contributes to Y. It is part of the process through which X is proposed to affect the outcome.
Suppose a teaching intervention improves students' academic self-efficacy, which subsequently improves persistence. Self-efficacy may mediate part of the intervention's effect on persistence.
The question is no longer “What variable is distorting the comparison?” It is:
Through what process does X produce its effect on Y?
This distinction underlies the difference between confounding control and mediation as an explanatory pathway.
The same construct can occupy either position
Consider academic motivation.
Study A asks whether voluntary participation in supplemental instruction improves academic performance. Students with greater pre-existing motivation may be more likely to participate and may also perform better regardless of participation:
Motivation → Participation
Motivation → Performance
Motivation may therefore confound the participation–performance relationship.
Study B instead asks how an intervention improves performance. The intervention is hypothesized to increase motivation, which subsequently improves academic performance:
Intervention → Motivation → Performance
Motivation is now a mediator.
Nothing contradictory has happened. In Study A, motivation precedes the exposure. In Study B, motivation is a consequence of the exposure.
The exposure matters
One of the easiest ways to understand changing variable roles is to notice that a variable's position is defined relative to the focal exposure.
Suppose the variables are:
Institutional support → Teacher self-efficacy → AI adoption → Student outcomes
If the exposure is teacher self-efficacy and the outcome is AI adoption, institutional support may be an antecedent or potential confounder depending on the broader structure.
If the exposure is institutional support and the outcome is AI adoption, teacher self-efficacy may be a mediator.
If the exposure is AI adoption and the outcome is student outcomes, teacher self-efficacy may again play another role depending on whether it causes adoption, student outcomes, or both.
Changing the exposure changes the causal paths relevant to the question.
The outcome matters too
Variable roles can also change when the outcome changes.
Suppose an intervention affects engagement, and engagement affects academic persistence:
Intervention → Engagement → Persistence
If persistence is the outcome, engagement is a mediator.
But if engagement itself becomes the outcome in another study, it is no longer a mediator relative to that particular question. It is simply the outcome being explained.
The label belongs to the relationship, not to the variable name.
Timing can completely change the variable’s role
The same construct measured at different times may occupy different positions.
Consider knowledge.
Baseline knowledge measured before an educational intervention may affect both whether students engage with optional learning resources and their later performance. It could therefore be a confounder of an observational resource-use–performance relationship.
Knowledge gained after the intervention may instead be part of the mechanism by which the intervention improves later problem-solving performance.
In that case, post-intervention knowledge may be a mediator.
| Variable |
Timing |
Possible role |
Why? |
|
Knowledge
|
Before exposure |
Confounder |
May contribute to both exposure and outcome |
|
Knowledge
|
After exposure |
Mediator |
May be changed by exposure and subsequently affect outcome |
Researchers should therefore pay attention not only to what was measured, but also to when.
The estimand matters
A variable's analytical treatment also depends on which causal effect the study intends to estimate.
Suppose:
X → M → Y
X → Y
If the research question concerns the total effect of X on Y, the pathway through M belongs to that total effect. Routinely adjusting for M would remove part of the effect being estimated.
If the question concerns a particular direct effect, M becomes central to defining the estimand and may need to be handled using mediation methods under additional causal assumptions.
Thus, even within one dataset and one causal diagram, whether a variable should be adjusted for can depend on what effect the researcher wants.
Confounder and mediator cannot be identified from correlations alone
Suppose X, Z, and Y are all strongly correlated.
The following structures can both produce such a pattern:
Confounding: Z → X and Z → Y
Mediation: X → Z → Y
A correlation matrix cannot tell you which causal structure generated the associations.
Regression alone does not solve the problem either. Adding Z may reduce the X coefficient under both structures.
Watch Out
Do not classify a variable as a confounder or mediator merely because adjusting for it changes the exposure coefficient. The same statistical pattern can arise under very different causal structures.
“Measured before” helps, but does not settle everything
A variable measured before X cannot normally be a consequence of X in that same temporal sequence. This can help rule out mediation.
However, earlier timing does not automatically prove confounding.
A pre-exposure variable might:
- cause X but not Y;
- cause Y but not X;
- be unrelated to either;
- serve as a proxy for an unmeasured cause;
- modify the effect of X;
- belong elsewhere in the causal structure.
Timing narrows the possibilities, but substantive causal reasoning remains necessary.
A variable can be a mediator in one pathway and a confounder in another
Complex causal systems can make variable roles even more context-specific.
Consider:
A → M → Y
M → X → Y
If the research question concerns the effect of A on Y, M may be a mediator.
If the research question instead concerns the effect of X on Y and M causes both X and Y, M may be a confounder.
Thus, the same causal diagram can assign different roles to M depending on which exposure–outcome effect is being estimated.
This is why labels should always be interpreted as shorthand for a specific causal question.
The distinction also explains why adjustment can help in one study and harm in another
If Z is a genuine confounder, adjusting for it may help block a noncausal backdoor path.
If the same construct is a mediator in another study and the target is the total effect, controlling for it can block part of the causal effect.
The statistical operation may be identical: include Z as a covariate.
The causal consequence is different.
This is the broader reason a control variable is not automatically a confounder. Adjustment decisions require knowledge of the variable's role, not merely its availability.
Moderators add yet another possible role
Suppose motivation changes the size of an intervention effect:
Students with low motivation benefit little, while highly motivated students benefit substantially.
Motivation is now functioning as a moderator because the intervention effect differs across motivation levels.
The same construct could therefore be:
- a confounder in one study;
- a mediator in another;
- a moderator in another;
- an exposure or outcome elsewhere.
The distinctions among these third-variable roles depend on the theoretical and causal structure rather than the variable's name.
Directed acyclic graphs make role changes easier to see
A directed acyclic graph, or DAG, can help because it represents assumptions about causal direction explicitly.
Suppose the first study assumes:
Motivation → AI use
Motivation → Achievement
Motivation may be part of the confounding structure.
A second study assumes:
AI intervention → Motivation → Achievement
Motivation is now a mediator.
The diagrams immediately reveal why the appropriate analytical treatment changes.
DAGs do not prove that the assumptions are correct. They make the assumptions inspectable, which is often far more useful than letting them remain implicit in a regression equation.
The research question should come before the variable label
A common workflow is:
Variable collected → label assigned → model selected
A stronger workflow is:
Research question → causal structure → variable roles → analysis
This sequence prevents a familiar problem in which researchers decide that age, motivation, self-efficacy, or prior achievement is “a control” simply because those variables appeared in earlier studies.
The better question is: what role does this variable play in this exposure–outcome relationship?
A variable may have more than one role in a complex model
Simple diagrams are pedagogically useful, but real systems can be more complicated.
A variable might mediate one pathway while confounding another. It might also modify an effect while participating in a causal chain elsewhere.
Researchers therefore need to be precise about statements such as “Z is a mediator.” A more informative formulation is:
Z is hypothesized to mediate the effect of X on Y.
Likewise:
Z is treated as a potential confounder of the X–Y effect.
The relational wording makes the role explicit.
Variable roles should not be copied from the literature without reconstruction
Suppose several studies call socioeconomic status a confounder. That does not mean it must be a confounder in every future analysis.
A new study may have a different exposure, outcome, population, or design. Socioeconomic status might be upstream of both variables, upstream of only one, downstream of the exposure, or irrelevant to the causal effect being estimated.
This is why researchers should not include a variable simply because previous studies did.
The literature should inform the causal model, not replace it.
This principle extends beyond confounders and mediators
The same logic applies to many research labels.
A variable may be:
- a predictor in one model and outcome in another;
- a moderator in one study and ordinary covariate in another;
- an antecedent in one relationship and mediator in another;
- a cause in one analysis and a consequence in another stage of a longitudinal process.
This is why antecedent variables should also be understood relationally rather than as fixed variable types.
Reciprocal processes can make one-time labels especially misleading
Some variables influence one another over time.
Engagement may increase self-efficacy, while successful engagement experiences later strengthen self-efficacy. Organizational support may increase technology adoption, while widespread adoption subsequently prompts greater institutional support.
In such dynamic systems, one variable can be upstream at one time and downstream later.
If theory suggests these feedback processes, researchers should consider whether two variables influence each other rather than assigning a permanent one-directional label based on a single measurement occasion.