Manuel B. Garcia

Manuel B. Garcia serves as the Senior Director for Educational Technology and Digital Learning at FEU Institute of Technology, Manila, Philippines. Read More

Contact Info

1607, FEU Tech Building,
P. Paredes St, Sampaloc,
Manila, Philippines
mbgarcia@feutech.edu.ph

Follow Me

Can a Variable Be a Confounder in One Study and a Mediator in Another?

The same measured variable can be a confounder in one study and a mediator in another because these labels describe causal roles within a specific research question. The role depends on what causes what, when variables occur, and which effect the study is trying to estimate.

108
Confounder in One Study, Mediator in Another Guide 108 of 223
01 · The Question

Can the Same Variable Really Change Its Role From One Study to Another?

Researchers are often taught to classify variables into categories: independent variable, dependent variable, confounder, mediator, moderator, covariate, control variable. This can create the impression that once a variable receives a label, that label should follow it permanently.

But consider prior academic achievement.

In one study, prior achievement may affect both students' voluntary use of a tutoring platform and their later examination performance. In that study, prior achievement may confound the relationship between platform use and performance.

In another study, an instructional intervention may improve students' achievement during the semester, and that improvement may subsequently contribute to persistence. Achievement could then lie on a pathway from the intervention to persistence and function as a mediator.

The construct is still achievement. Its role has changed because the research question, timing, exposure, outcome, and causal structure have changed.

This is not an inconsistency. It is one of the most important principles in thinking clearly about research variables: variable roles are relational, not inherent properties of the variable itself.

02 · The Short Answer

A Variable’s Role Depends on the Causal Question Being Asked

In Brief

Yes. The same measured variable can be a confounder in one study and a mediator in another because “confounder” and “mediator” describe positions within a particular causal structure, not permanent characteristics of a variable.

A variable functions as a confounder when it helps create a noncausal exposure–outcome association that must be addressed for the causal effect of interest, and as a mediator when it lies on a proposed pathway through which the exposure affects the outcome. Changing the exposure, outcome, timing, or estimand can therefore change the variable’s role.

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.

04 · A Practical Example

How Digital Literacy Can Be a Confounder in One Study and a Mediator in Another

Hypothetical Example

Digital literacy, AI-tool use, and learning outcomes

Two research teams study digital literacy, AI use, and academic performance, but they ask different questions and use different designs.

Study A: observational AI-tool use Researchers ask whether students who voluntarily use an AI study tool achieve better learning outcomes. Students with greater pre-existing digital literacy may be more likely to use the tool and may also perform better academically. Digital literacy may therefore confound the AI-use–outcome relationship.
Study B: digital-skills intervention Researchers randomly assign students to a digital-skills training program and hypothesize that the training improves academic performance partly by increasing digital literacy. Digital literacy now lies on the pathway from intervention to outcome.
Study B interpretation Digital literacy is a proposed mediator because the intervention is expected to change literacy and those changes are expected to contribute to performance.
Why the role changed In Study A, digital literacy existed before the exposure of interest and may cause both exposure and outcome. In Study B, the intervention itself is proposed to cause changes in digital literacy.

The variable has not somehow transformed from one statistical species into another. The causal question has changed.

This is exactly why methods sections should say what effect is being estimated and why each variable occupies its proposed role.

05 · What Researchers Often Get Wrong

Common Mistakes When Assigning Variable Roles

Misconception

Once a variable is a confounder, it is always a confounder

No. Confounder is defined relative to a particular exposure–outcome effect and causal structure. The same construct can occupy another role when the question changes.

Misconception

If previous studies treated Z as a confounder, I should too

Not automatically. Earlier studies may have used different exposures, outcomes, timing, populations, or assumptions. Their classification is evidence to consider, not a permanent designation for Z.

Misconception

A variable correlated with X and Y must be either a confounder or mediator

No. Correlation alone does not determine causal position. Z might be a confounder, mediator, collider, consequence of Y, proxy variable, or simply associated because of another process.

Misconception

If controlling for Z makes the X coefficient smaller, Z is a mediator

No. Coefficient attenuation can occur under many causal and statistical structures. Mediation requires a defensible pathway in which X precedes and affects Z, which subsequently contributes to Y.

Misconception

A mediator should always be controlled for

Not if the target is the total effect of X on Y. Adjusting for a mediator can remove part of that total effect. The correct treatment depends on whether the research question concerns total, direct, or indirect effects.

Misconception

The variable's role can be determined after looking at the regression output

The role should be justified from the research question, theory, timing, and causal assumptions. Statistical results may challenge that model, but they should not be used to retroactively assign whichever label makes the results easiest to explain.

06 · What This Means for You

Classify the Relationship, Not the Variable in Isolation

When deciding whether a variable is a confounder or mediator, avoid asking “What kind of variable is Z?” in isolation.

Ask instead:

What role does Z play in the causal relationship between this exposure and this outcome?

A simple decision framework

If Z precedes X and contributes to both X and Y
Z may be part of the confounding structure for the X–Y effect.
If X causes changes in Z and Z subsequently contributes to Y
Z may be a mediator of the X–Y effect.
If the role seems to change when you choose a different exposure or outcome
That is expected. Reconstruct the causal question rather than trying to preserve one permanent label.
If timing or direction is uncertain
State the uncertainty and avoid strong causal classification until the theoretical and temporal structure is defensible.

This reasoning should be part of deciding which variables belong in the study and how they should be analyzed.

The practical rule is simple: variable names remain the same, but causal roles can change. Always define the role relative to a specific exposure, outcome, time sequence, and causal estimand.

07 · A Quick Checklist

Before Calling a Variable a Confounder or Mediator, Check This

Before assigning the variable's role, check:
Specify the focal exposure and outcome.
Identify when the candidate variable occurs relative to the exposure.
Ask whether the variable causes or helps determine the exposure.
Ask whether the exposure itself causes changes in the candidate variable.
Determine whether the variable contributes to the outcome independently of the focal exposure pathway.
Do not classify the variable from correlations or coefficient changes alone.
Specify whether the target is a total, direct, or indirect causal effect.
Reassess the variable's role whenever the exposure, outcome, timing, or research question changes.
Use a causal diagram when the relationships are difficult to reason through verbally.
08 · Frequently Asked Questions

Frequently Asked Questions About Changing Variable Roles

Can the exact same measured variable be a confounder in one analysis and a mediator in another?

Yes. If the exposure–outcome question changes, the same variable can occupy a different position in the causal structure. What matters is whether it precedes and contributes to both exposure and outcome or instead lies downstream of the exposure on a pathway to the outcome.

Can a variable be both a confounder and mediator in the same dataset?

Yes, relative to different causal effects or pathways. A variable may mediate one relationship while confounding another. Researchers should therefore specify the particular exposure–outcome effect whenever assigning the label.

Can a variable be both a mediator and moderator?

Yes. A construct can mediate one pathway while moderating another, and more complex models can contain both mediation and moderation. The roles refer to different relationships within the model.

How do I know whether a variable is a confounder or mediator?

Start with temporal and causal ordering. A conventional confounder precedes the exposure and contributes to both exposure and outcome, whereas a mediator is caused by the exposure and lies on a pathway to the outcome. Theory and design are needed because associations alone cannot establish that ordering.

What if the variable was measured at the same time as the exposure?

Simultaneous measurement can make causal ordering difficult to establish unless timing is known from other information. Researchers should avoid strong confounder or mediator claims when the relevant temporal direction is genuinely uncertain.

Should I control for a variable if I am unsure whether it is a confounder or mediator?

Do not make the decision from uncertainty alone. Specify the causal question, examine plausible alternative causal structures, and consider how adjustment would change the estimand under each. Indiscriminate adjustment may solve one problem while creating another.

Why does changing the outcome alter the role of a variable?

Variable roles are defined relationally. A variable that lies between X and Y may be a mediator when Y is the outcome but become the outcome itself when the research question ends at that variable.

Should I use the same variable labels as previous studies?

Only when the same causal reasoning applies. Previous studies can inform your model, but their labels should not be copied automatically when your exposure, outcome, timing, population, or estimand differs.

09 · The Bottom Line

A Variable Does Not Carry a Permanent Causal Label

The Bottom Line

The same variable can be a confounder in one study and a mediator in another because these terms describe causal positions relative to a particular exposure, outcome, timing, and effect of interest.

Do not classify variables in isolation. Reconstruct the causal question each time: determine what comes before the exposure, what the exposure changes, what pathways lead to the outcome, and what effect you actually want to estimate.

10 · Sources and Further Reading

Sources and Further Reading

11 · Cite this Guide

How to Cite This Guide

This guide is intended to be read, shared, and used in research, teaching, and academic work. If you draw on its ideas, explanations, or other content, please acknowledge the source by citing the guide. Doing so gives appropriate credit and helps your readers locate the original resource.

Has the Field Guide helped your research?

If a guide helped clarify a question, inform a research decision, or move your work forward, I would love to hear about your experience. Your story may also help other researchers discover the Field Guide.

Share Your Experience
Takes only a few minutes