03 · What You Need to Know
The Difference Comes From Where the Variable Sits in the Research Model
What is a confounder?
In a causal research question, a confounder is a variable that can distort the estimated relationship between an exposure and an outcome because it is related to the exposure and is also causally relevant to the outcome, while not being a consequence of the exposure in the causal pathway of interest.
A simple causal structure might look like this:
Z → X
Z → Y
X → Y
Here, Z contributes to both X and Y. If Z is not appropriately addressed, some of the observed X–Y association may reflect differences in Z rather than the causal effect of X on Y.
Consider a study examining whether students' voluntary attendance at academic tutorials improves examination performance. Prior academic achievement may influence who chooses to attend tutorials and may also influence subsequent examination performance. If those differences are ignored, the observed association between tutorial attendance and performance may partly reflect prior achievement.
In that causal model, prior achievement may be a confounder.
Confounding question
Is another variable distorting the causal comparison between X and Y?
Typical concern
Estimate the X–Y effect without attributing to X differences that arise from relevant common causes.
Importantly, researchers should not define confounding only by looking for variables that are statistically associated with both X and Y. Confounding is fundamentally about the causal structure underlying those associations.
What is a mediator?
A mediator occupies a very different position. Instead of existing before the exposure as a source of distortion, the mediator is proposed to occur as part of the process through which X affects Y:
X → M → Y
Suppose participation in academic tutorials improves students' study strategies, and improved study strategies subsequently contribute to higher examination performance.
If the theory proposes that tutorial attendance changes study strategies and that this change contributes to performance, study strategy is a mediator.
The substantive question is now:
How does X produce its relationship or effect on Y?
This is why mediation analysis usually focuses on an indirect effect: the part of the relationship or causal effect proposed to operate through the mediator.
A more detailed treatment of what researchers mean when they say that a variable “explains” a relationship through mediation requires distinguishing statistical decomposition from evidence about an actual causal mechanism.
What is a moderator?
A moderator answers another question entirely. It indicates that the relationship between X and Y changes according to another variable, W.
Suppose academic tutorials improve examination performance more strongly among students with low baseline knowledge than among students who already have high baseline knowledge.
Baseline knowledge is functioning as a moderator if the effect or association between tutorial attendance and performance differs across levels of baseline knowledge.
The research question becomes:
When, for whom, or under what conditions is the X–Y relationship stronger, weaker, absent, or different?
Moderation is commonly examined statistically through an interaction between X and W.
The three roles answer three different questions
| Variable role |
Core question |
Conceptual position |
Typical analytical goal |
|
Confounder
|
Could Z distort the X–Y causal relationship? |
A relevant common cause or source of confounding outside the causal pathway of interest |
Reduce confounding bias when estimating a causal effect |
|
Mediator
|
Through what process does X affect Y? |
On a proposed pathway from X to Y |
Estimate and interpret indirect and direct effects |
|
Moderator
|
When or for whom does the X–Y relationship differ? |
Defines variation in the X–Y relationship |
Estimate interactions or conditional effects |
Why confounders and mediators can look statistically similar
One reason researchers confuse confounding and mediation is that both can involve a third variable associated with X and Y. In simple regression settings, introducing that third variable can also change the coefficient for X.
Yet the statistical pattern does not tell you whether the third variable came before X or resulted from X.
Consider these two structures:
Confounding: Z → X and Z → Y
Mediation: X → M → Y
Both structures may produce correlations among all three variables. The crucial distinction is the presumed causal direction.
This is why trying to classify variables by running regressions and observing what happens to coefficients can be misleading. Two models can resemble one another mathematically while representing very different scientific explanations.
Watch Out
Do not determine whether a variable is a confounder or mediator by asking only whether “controlling for it” reduces the X–Y coefficient. That reduction can occur under multiple causal structures. The variable's temporal and causal position must be justified independently.
Why a moderator is different from both
A moderator need not explain why X and Y are associated, nor is its primary role to remove bias from their estimated relationship. Instead, it describes heterogeneity.
If W moderates the X–Y relationship, the effect or association for one value of W differs from that for another value.
For example, an instructional strategy could improve learning substantially in small classes but have little benefit in very large classes. Class size might then moderate the strategy's effect.
The deeper implication is that asking for “the effect of X” may be insufficient when the effect depends on W. Understanding what it means for an effect to depend on another variable requires examining conditional effects rather than interpreting only a single overall coefficient.
A confounder does not have to be a moderator
A confounder and moderator can both matter to the same X–Y relationship, but for different reasons.
Suppose prior achievement confounds the relationship between voluntary tutorial attendance and examination performance because prior achievement affects both attendance and performance. Meanwhile, students' program of study might moderate the tutorial effect because tutorials are more effective in some disciplinary contexts than others.
Prior achievement and program of study are solving different analytical problems. One concerns biased comparison; the other concerns variation in the relationship.
A variable can sometimes be both a confounder and an effect modifier in a particular analysis. The labels are not mutually exclusive logical categories. Researchers must specify which role is relevant to which part of the causal question.
A mediator is a consequence of the exposure in the proposed pathway
For mediation, the proposed ordering is central. If X causes M and M subsequently contributes to Y, M occurs downstream of X.
This distinguishes the mediator from a conventional pre-exposure confounder.
Suppose researchers study whether professional development for teachers improves students' outcomes. Teachers' pedagogical knowledge before the training may confound an observational comparison if it influences participation and student outcomes. Pedagogical knowledge acquired because of the training, however, could be a mediator if the training increases knowledge and that increase improves teaching.
The same construct, pedagogical knowledge, could therefore occupy different roles depending on when it is measured and what causal process is being proposed.
“Control for everything” is not a safe strategy
A common response to third-variable uncertainty is to include every available variable as a covariate. This can feel conservative: if many alternative explanations are controlled, surely the estimate must become more trustworthy.
Causal inference does not work that way.
Adjusting for an appropriate confounder may reduce bias. Adjusting for a mediator may remove part of the total causal effect that the researcher intended to estimate. Adjusting for certain variables affected by both exposure and outcome-related causes can introduce rather than remove bias. Some variables may simply reduce precision without solving a meaningful inferential problem.
The question is therefore not “How many variables did you control for?” but “Why was each variable adjusted for?”
This also explains why a control variable and a confounder are not automatically the same thing. “Control variable” describes what researchers do with a variable analytically; “confounder” describes a causal role.
Confounding is defined relative to a causal question
A variable is not simply “a confounder” in isolation. Confounding is defined relative to a particular exposure, outcome, causal contrast, population, and assumed causal structure.
Age, socioeconomic status, prior performance, sex, organizational tenure, or any other familiar covariate should not automatically be classified as a confounder simply because researchers commonly adjust for it.
The relevant question is whether the variable creates confounding for the particular causal effect being estimated.
This is one reason researchers should resist including a variable solely because previous studies included it. Earlier authors may have asked a different question, studied another population, assumed a different causal structure, or used the variable for a purpose other than confounding control.
The same variable can change roles when the research question changes
Consider prior knowledge in educational research.
In one study, prior knowledge might confound an observational association between voluntary use of an educational platform and achievement because students with stronger prior knowledge may both use the platform differently and achieve higher scores.
In another study, knowledge acquired during an intervention might mediate its effect on later problem-solving performance.
In a third study, baseline knowledge might moderate an intervention effect if the intervention benefits beginners more than advanced learners.
The construct looks familiar in all three studies, but its role differs because the research questions and causal positions differ.
This principle becomes particularly important when determining whether a variable can be a confounder in one study and a mediator in another.
Directed causal diagrams can make the distinction clearer
Researchers often find it useful to draw their assumptions before fitting statistical models. Directed acyclic graphs, or DAGs, provide one formal way to represent proposed causal relationships.
In a simplified representation:
- a confounder may have arrows pointing toward both X and Y;
- a mediator may receive an arrow from X and send an arrow toward Y;
- a moderator is conceptually different because effect modification is not represented simply by adding an ordinary arrow between variables.
The value of drawing the structure is not that the diagram proves the assumptions. It forces researchers to state them explicitly. Disagreements that remain hidden inside a regression equation often become obvious once the proposed causal structure is drawn.
Statistical significance cannot assign a variable's role
None of these classifications should be based on whether a coefficient reaches a conventional p-value threshold.
A theoretically important confounder does not cease to matter because one sample association is nonsignificant. A statistically significant relationship between X and M does not prove mediation. A significant main effect for W does not prove moderation.
The variable's role comes first from the scientific question and causal or theoretical structure. Statistical analysis then evaluates quantities implied by that structure.