TL;DR
This lesson is an explanation of a statistical idea. It is not medical advice.
Confounding happens when a third factor affects both who gets an exposure, such as a drug, and how the outcome turns out. If you compare exposed and unexposed people directly, you measure the exposure's effect plus the confounder's effect, and the two cannot be separated from the raw numbers alone. Randomisation, stratification and standardisation are the standard ways to remove the confounder's influence.
Where you'll see it: in observational studies of drugs, diet, smoking and screening, where the people who choose a treatment usually differ from those who do not, and in any analysis of registry or hospital data that compares groups without a randomised design.
Intuition
A summer example
Ice cream sales and drowning deaths both rise in the summer. Count them together over a year and the two move together strongly. Nobody thinks ice cream causes drowning. The hot weather is a third factor: it drives both the ice cream purchases and the swimming. Summer is a confounder.
Medicine has the same structure, and it is harder to see because the confounder is often a sign of how sick someone already is. Suppose doctors give a new drug mostly to the sickest patients. Compare patients who got the drug with those who did not, and the drug group may die more often, even if the drug helps. Severity drove both who got the drug and who died. The raw comparison blames the drug for severity.
The picture of the situation is a small graph. The confounder points at both the exposure and the outcome, and the question is about the arrow from exposure to outcome.
flowchart LR C[confounder: illness severity] --> A[exposure: receives the drug] C --> Y[outcome: death] A -.-> Y
The dashed arrow is the effect we want. The other two arrows create a backdoor path that makes the raw association differ from the effect.
Why the problem exists
The clean way to remove confounding is a randomised trial. A coin flip decides who gets the exposure, so the coin is unrelated to severity, age, income or anything else that was true before treatment. Most questions cannot be studied that way. It may be unethical to assign a harmful exposure, it may take decades to see an outcome, or the exposure may already be part of daily life. So we study observational data and have to correct for the confounders we can measure, and be honest about the ones we cannot.
The math
Potential outcomes
Write for exposure, with for exposed and for unexposed, and for the outcome. Let be the outcome a person would have if exposed and the outcome if unexposed. The causal effect of the exposure is the difference in averages of these hypothetical outcomes:
Only one of and is observed for each person, so we estimate from groups. The quantity we can compute from data is the associational difference:
The bias term
Add and subtract , the untreated outcome average among people who were in fact exposed:
The second term is the difference in untreated outcomes between the two groups. It is zero when the groups would have had the same outcome without exposure. A confounder is exactly a variable that makes this term nonzero. For the causal effect to be recovered, we need the groups to be comparable once we condition on the measured confounders , which is the standard exchangeability assumption from Causal Inference.
Adjustment by standardisation
If takes a few discrete values, and within each value the exposure is as good as random, the causal effect of exposure can be recovered by averaging the stratum-specific outcomes over the population distribution of :
Read the sum in words: for each stratum of the confounder, take the outcome rate among those who received , and weight it by how common stratum is in the whole population. Do this for and for , and then compare the two standardised rates. Standardisation uses the population weights, not the group weights, and that choice is what removes the imbalance.
Worked examples
Consider a made-up observational study of 2000 patients. Half are high-severity, half low-severity. Sicker patients are more often given the treatment. The numbers are invented to show the mechanism.
| Stratum | Group | Patients | Deaths | Death rate |
|---|---|---|---|---|
| High severity | Treated | 800 | 240 | 0.30 |
| High severity | Untreated | 200 | 100 | 0.50 |
| Low severity | Treated | 200 | 10 | 0.05 |
| Low severity | Untreated | 800 | 40 | 0.05 |
Step by step:
- Raw treated death rate: .
- Raw untreated death rate: .
- Raw comparison: the treated group has more deaths, so the treatment looks harmful.
- Within high severity, the treatment lowers the death rate by .
- Within low severity, the difference is .
- Standardise to a population that is half high-severity: treated rate , untreated rate .
- Standardised difference: .
Interpretation: the raw comparison says the treatment adds 11 deaths per 100 patients. Standardised, it removes 10 deaths per 100. The sign reversed because the treated group was mostly the sicker stratum. Severity explains the raw harm entirely. The standardised figure is still a made-up number, but it shows why the adjustment is needed.
Use the same invented study. The crude risk ratio is the raw treated rate over the raw untreated rate:
The standardised risk ratio uses the standardised rates from the previous example:
- The ratio of the two is the size of the distortion: .
- The crude comparison overstates the risk of treatment by a factor of about 2.8 relative to the standardised one.
- The standardised ratio of 0.64 says treated patients die at about two-thirds the rate of untreated ones, within the assumptions of the adjustment.
Interpretation: a confounder can flip the direction of an association, not just shrink it. The bias factor 2.81 is a concrete way to report how much the raw comparison was off. The estimate is only as good as the set of confounders adjusted for. If severity were measured poorly, the standardised ratio would still be biased, which is the subject of the tradeoffs below.
Tradeoffs and failure modes
| Situation | What goes wrong | Better choice |
|---|---|---|
| Randomisation is possible and ethical | Observational comparison still carries unmeasured confounding | Randomised controlled trial, which balances measured and unmeasured confounders in expectation |
| Confounders are measured and few | Stratification or standardisation works and is transparent | Stratify or standardise, and report the stratum-specific estimates |
| Many confounders, some strata nearly empty | Stratum rates are unstable and the adjustment fails | Regression, or a propensity score that summarises the confounders into one number |
| A confounder is not measured | No adjustment can remove it, and the estimate can be wrong in any direction | Sensitivity analysis, which asks how strong an unmeasured confounder would need to be to explain the result |
| A variable affected by the exposure is adjusted for | Adjusting for a mediator or for a common effect creates bias instead of removing it | Draw the causal graph first and adjust only for confounders on the backdoor paths |
| A confounder is measured with error | Adjustment leaves residual confounding, so part of the bias remains | Improve the measurement, and include the measurement error in a sensitivity analysis |
The most common failure is confounding by indication: treatment is given because of the condition it is meant to treat. Clinicians' decisions are often the strongest confounder in observational data. The right question is not whether confounding exists, since in observational data it almost always does, but how much of the result survives a reasonable adjustment.
History
The problem of spurious association was recognised long before the modern terminology. In 1903, the statistician George Udny Yule wrote on how the association between two attributes can change when a third is taken into account. In 1951, Edward Simpson described the reversal that now carries his name, where the direction of an association flips between a whole population and its subgroups.
In the late 1950s, the debate over smoking and lung cancer pushed epidemiologists to state precisely when an association could be explained by a third factor. Jerome Cornfield and colleagues gave criteria for when an unmeasured factor would need to be unusually strong to explain the association, and the Mantel–Haenszel methods for stratified tables came out of the same period. The idea caught on because it turned a vague worry into a calculation that could be checked against data. The formal potential-outcomes framework, which the math section uses, was developed later and made the assumptions explicit.
Check yourself
QuestionWhat makes a variable a confounder rather than just a correlate of the outcome?Show answer
A confounder must be associated with the exposure and must affect the outcome through a path that does not run through the exposure. It is a common cause of both, or it leads to a backdoor path between them. A variable that is only a correlate of the outcome, with no link to the exposure, does not bias the comparison. A variable that the exposure itself causes, a mediator, should generally not be adjusted for.
QuestionIn the low-severity stratum of the worked example, treated patients have 10 deaths out of 200 and untreated patients have 40 deaths out of 800. Compute both rates and the difference.Show answer
The treated rate is and the untreated rate is . The difference is . Within this stratum the treatment has no visible effect, and the raw harm in the full study came entirely from the stratum mix.
QuestionWhy does randomisation remove confounding even for confounders nobody measured?Show answer
The coin flip depends only on the randomisation itself, so it is independent of every characteristic a person had before treatment, measured or not. In a large enough sample the two groups are balanced on all such characteristics, so the untreated outcome averages match in expectation. The bias term from the math section then has expected value zero, and the associational difference equals the causal effect.
QuestionA registry study finds that people who take a dietary supplement have fewer hip fractures. The authors adjusted only for age. What is the main concern, and what would address it?Show answer
Supplement users probably differ in other ways that affect fractures, such as exercise, income, general health and how often they see a doctor. Those differences can drive both supplement use and fracture risk, and adjusting only for age leaves them uncontrolled. A sensitivity analysis would show how strong an unmeasured confounder would need to be to explain the result. A randomised trial would address the problem directly. This is an explanation of the statistics, not advice about supplements.