Why Variable Roles Matter
A study may record many characteristics about each person, but those characteristics do not all play the same role in answering a question about treatment and outcome. For example, a study of a new exercise program might record whether a person joined the program, their health before it began, how much they exercised afterward, and their blood pressure months later. Knowing which variables come before treatment, which may be changed by treatment, and which have no relevant connection helps us interpret the comparison.
The role of a variable is not an intrinsic label that applies in every study. It depends on the particular treatment or exposure and outcome being considered, as well as on the timing and causal relationships in the situation. A variable that is a confounder in one comparison might be irrelevant to a different question.
In a familiar confounding pattern, a pre-existing characteristic affects both treatment choice and the outcome. In a mediator pattern, the treatment comes first and changes something that then contributes to the outcome. These are different causal roles: a confounder can distort a treatment comparison, while a mediator helps explain how a treatment might have an effect.
A variable being associated with treatment or outcome does not, by itself, establish its role. In particular, an association alone does not show that a variable causes either one. The study context and timing matter. The labels below describe a causal interpretation of the situation, not a conclusion that can always be read directly from a table of associations.
Distinguishing the Roles
| Variable role | Relationship to treatment and outcome | Typical timing | Why it matters |
|---|---|---|---|
| Confounder | Related to treatment choice and affects the outcome | Present before treatment | Can make the treatment groups differ for reasons relevant to the outcome |
| Mediator | Can be changed by treatment and can affect the outcome | After treatment begins | May help explain a pathway through which treatment affects outcome |
| Unrelated variable | Has no relevant relationship to treatment or outcome for this question | Any time | Does not explain the treatment-group outcome difference |
A variable related to the outcome but not to treatment assignment is not automatically a confounder. Nor is a variable related to treatment but with no effect on the outcome. Both may be worth recording for other reasons, but neither matches the confounder role described here. The key question is whether a pre-treatment difference helps explain both who receives treatment and why outcomes differ.
Worked Example: Health Before and After a Program
Suppose a clinic observes whether patients voluntarily join a hypothetical exercise program and records their blood pressure six months later. Before the program, it records each patient's baseline blood pressure. During the six months, it records exercise completed. It also records each patient's eye color. Classify these variables for the comparison of joining the program and later blood pressure.
Baseline blood pressure is a potential confounder. It is measured before joining the program. Patients with higher baseline blood pressure may be more likely to join, perhaps because they are more concerned about their health. Baseline blood pressure can also affect the later blood pressure measurement. It is therefore a plausible pre-treatment factor related to both program participation and the outcome. This does not prove that it creates confounding in every real study; the classification follows the stated scenario.
Exercise completed during the program is a potential mediator. Joining the program may change how much a patient exercises, and exercise may in turn affect later blood pressure. The proposed pathway is program participation, then exercise, then blood pressure. Because exercise is measured after the program begins, it is not a pre-treatment confounder in this comparison.
Eye color is unrelated for this question. Under the stated scenario, it does not influence who joins the program and does not affect later blood pressure. Recording it does not make it a confounder or mediator.
How a Confounder Can Complicate a Comparison
If treatment groups contain different proportions of people with different baseline risks, their average outcomes can differ partly because of that composition. The following hypothetical example uses reductions in systolic blood pressure, measured in millimeters of mercury (mm Hg). It is observational: patients chose whether to join the program. The table divides patients into high and low baseline severity, a characteristic assumed to influence both participation and expected reduction.
Worked Example: A Confounder and a Crude Difference
Suppose 100 patients join a hypothetical program and 100 do not. Among those who join, 80 have high baseline severity and 20 have low severity. Among those who do not, 20 have high severity and 80 have low severity. The mean blood-pressure reductions are shown below.
| Baseline severity | Join: number of patients | Join: mean reduction | Do not join: number of patients | Do not join: mean reduction |
|---|---|---|---|---|
| High | 80 | 12 mm Hg | 20 | 11 mm Hg |
| Low | 20 | 4 mm Hg | 80 | 3 mm Hg |
Assume, for this illustration, that baseline severity makes people more likely to join and also predicts their reduction in blood pressure. It is measured before participation, so it fits the confounder pattern. Within each severity group, the mean reduction is 1 mm Hg greater among program participants: \(12-11=1\) mm Hg for high severity and \(4-3=1\) mm Hg for low severity.
The overall mean for each group is a weighted average of its two subgroup means. For participants, 80 of 100 patients have high severity and 20 of 100 have low severity:
For those who do not join, the weights are reversed:
The crude difference in mean reductions is \(10.4-4.6=5.8\) mm Hg. This overall difference is much larger than the 1 mm Hg difference within each severity group. The arithmetic shows why: the participant group contains more people in the high-severity category, and that category has larger reductions in both groups. The crude difference mixes the within-category differences with the different group compositions.
This example does not establish what the program would cause in a real population. It shows that a comparison of overall averages can be hard to interpret when a pre-treatment factor is related to both participation and outcome. A difference between groups is not automatically a treatment effect.
A Short Justification: Group Means Depend on Group Composition
The calculation above follows directly from how a mean is formed. If a group has \(n_H\) people in the high-severity category, with mean outcome \(\bar{x}_H\), and \(n_L\) people in the low-severity category, with mean outcome \(\bar{x}_L\), then its overall mean is the sum of the category totals divided by the group size:
Thus, an overall mean depends both on the category-specific means and on the proportions in each category. If treatment groups have different proportions and the categories have different outcome levels, their overall means can differ even when the within-category differences are small. This is the basic reason a confounder can complicate a comparison; identifying a possible confounder is not, by itself, a complete solution to that problem.
Mediators Explain a Possible Pathway
A mediator is different because it is downstream of treatment. For example, if a new study-support service leads students to spend more hours studying, and those extra hours contribute to higher exam scores, study hours may mediate part of the service's effect. The sequence is service, then study hours, then score. The mediator is not simply another pre-existing difference between students.
This distinction matters when describing a treatment’s total effect. If a treatment works partly by changing a mediator, then the pathway through that mediator is part of the overall treatment effect. Treating a mediator as if it were a pre-treatment confounder can change the question being answered. How to account for confounders in a study design is a separate problem; the first step here is to identify each variable's role correctly.
Worked Example: Tutoring, Preparation, and Exam Scores
Consider a hypothetical observational comparison of students who do and do not attend optional tutoring, with final exam score as the outcome. Assume that students with stronger preparation before the term are more likely to seek tutoring and tend to earn higher exam scores. Also assume that tutoring can increase study hours during the term, and that those hours can affect exam scores. A record includes each student's favorite color.
Prior preparation is a potential confounder. It comes before tutoring, is related to who attends, and affects the outcome. Students who attend may already differ in preparation from students who do not, so a score difference cannot automatically be attributed to tutoring alone.
Study hours during the term are a potential mediator. In the stated scenario, tutoring can change study hours, which can then change exam performance. Study hours follow a proposed pathway from tutoring to score.
Favorite color is unrelated to this comparison. The example gives no reason for it to affect tutoring attendance or exam score. It does not become a confounder simply because it is recorded alongside the other variables.
The classifications follow from the stated timing and relationships, not from the names of the variables. For example, study hours measured before tutoring could play a different role from study hours changed by tutoring.
When a Variable Is Related to Only One Side
It is useful to check variables that seem important but do not meet the confounder definition. Suppose a pre-treatment characteristic predicts the outcome but has no relationship to treatment choice. It may help describe who tends to have higher or lower outcomes, but it does not explain why the treatment groups differ in their composition. Conversely, a characteristic related to treatment choice but with no effect on the outcome does not, under the definition here, explain an outcome difference.
In practice, whether a characteristic is related to treatment or outcome can be uncertain, and relationships may be more complicated than a simple example suggests. Avoid classifying variables from a single observed association alone. Consider whether it existed before treatment, whether it plausibly influenced treatment selection, and whether it can affect the outcome.
Worked Example: Checking a Suspected Confounder
In a hypothetical observational study, researchers compare patients who choose a nutrition course with patients who do not, using weight change after three months as the outcome. They record age. For this example, assume that age predicts weight change but has no relationship to choosing the course in the population being studied.
Age is a pre-treatment variable, and it relates to the outcome. However, the scenario says it is not related to course participation. It therefore does not meet the confounder pattern for this comparison: it is not a reason the two groups differ in who chose the course. It may still be useful information, but calling it a confounder here would overstate its role.
If the situation were different—for example, if older patients were more likely to choose the course and age also predicted weight change—age could be a potential confounder. The same variable can therefore have different roles in different comparisons.
Common Mistakes
- Calling every outcome predictor a confounder. A variable that predicts the outcome but is unrelated to treatment choice does not meet the confounder pattern described here.
- Calling a mediator a confounder. A mediator is changed by treatment and lies on a pathway to the outcome; a confounder is a pre-treatment difference that can complicate the comparison.
- Deciding a variable’s role from association alone. Association does not establish causal direction. Use the study context and timing, and state when a classification depends on an assumption.
- Assuming a crude group difference is the treatment effect. When groups differ in a confounder, their overall outcomes may partly reflect those baseline differences.
- Assuming a variable has the same role in every study. Roles depend on the specific treatment, outcome, and causal relationships being considered.
Check Your Understanding
For each question, explain the role of the variable using the treatment, outcome, and timing in the scenario.
- A study compares patients who choose a walking program with those who do not. A health measure recorded before the program affects both the choice to participate and later mobility. Why might it be a confounder?
- A treatment changes a patient's sleep, and sleep can affect the patient's later concentration. What role might sleep play, and why?
- A variable predicts an outcome but, in the stated situation, is unrelated to treatment choice. Does it meet the confounder pattern? Explain.
- Why can two treatment groups have different overall mean outcomes even when their mean outcomes are similar within baseline categories?
- Why is an association between a recorded variable and treatment not enough, by itself, to classify the variable as a confounder?