Search

Search papers and lessons

Confounding Bias

Level 3 · 10 min read

A confounder is a third factor that affects both who receives an exposure and how the outcome turns out, so a raw comparison mixes its effect with the effect being studied.

On this page

  • Colour = topic mix
  • Probability
  • Methods
  • Epidemiology
  • Sign in to see your progress

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 AA for exposure, with A=1A = 1 for exposed and A=0A = 0 for unexposed, and YY for the outcome. Let Y1Y^1 be the outcome a person would have if exposed and Y0Y^0 the outcome if unexposed. The causal effect of the exposure is the difference in averages of these hypothetical outcomes:

causal effect=E[Y1]−E[Y0].\text{causal effect} = \mathbb{E}[Y^1] - \mathbb{E}[Y^0].

Only one of Y1Y^1 and Y0Y^0 is observed for each person, so we estimate from groups. The quantity we can compute from data is the associational difference:

E[Y∣A=1]−E[Y∣A=0].\mathbb{E}[Y \mid A = 1] - \mathbb{E}[Y \mid A = 0].

The bias term

Add and subtract E[Y0∣A=1]\mathbb{E}[Y^0 \mid A = 1], the untreated outcome average among people who were in fact exposed:

E[Y∣A=1]−E[Y∣A=0]=(E[Y1∣A=1]−E[Y0∣A=1])⏟effect in the exposed+(E[Y0∣A=1]−E[Y0∣A=0])⏟confounding bias.\mathbb{E}[Y \mid A = 1] - \mathbb{E}[Y \mid A = 0] = \underbrace{\big(\mathbb{E}[Y^1 \mid A = 1] - \mathbb{E}[Y^0 \mid A = 1]\big)}_{\text{effect in the exposed}} + \underbrace{\big(\mathbb{E}[Y^0 \mid A = 1] - \mathbb{E}[Y^0 \mid A = 0]\big)}_{\text{confounding bias}}.

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 CC, which is the standard exchangeability assumption from Causal Inference.

Adjustment by standardisation

If CC 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 CC:

E[Ya]=∑cE[Y∣A=a,C=c]  P(C=c).\mathbb{E}[Y^a] = \sum_{c} \mathbb{E}[Y \mid A = a, C = c]\; P(C = c).

Read the sum in words: for each stratum cc of the confounder, take the outcome rate among those who received aa, and weight it by how common stratum cc is in the whole population. Do this for a=1a = 1 and for a=0a = 0, 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

Example
Stratifying a hypothetical treatment study

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.

StratumGroupPatientsDeathsDeath rate
High severityTreated8002400.30
High severityUntreated2001000.50
Low severityTreated200100.05
Low severityUntreated800400.05

Step by step:

  1. Raw treated death rate: (240+10)/1000=0.25(240 + 10)/1000 = 0.25.
  2. Raw untreated death rate: (100+40)/1000=0.14(100 + 40)/1000 = 0.14.
  3. Raw comparison: the treated group has 0.25−0.14=+0.110.25 - 0.14 = +0.11 more deaths, so the treatment looks harmful.
  4. Within high severity, the treatment lowers the death rate by 0.50−0.30=0.200.50 - 0.30 = 0.20.
  5. Within low severity, the difference is 0.05−0.05=00.05 - 0.05 = 0.
  6. Standardise to a population that is half high-severity: treated rate =0.5⋅0.30+0.5⋅0.05=0.175= 0.5 \cdot 0.30 + 0.5 \cdot 0.05 = 0.175, untreated rate =0.5⋅0.50+0.5⋅0.05=0.275= 0.5 \cdot 0.50 + 0.5 \cdot 0.05 = 0.275.
  7. Standardised difference: 0.175−0.275=−0.100.175 - 0.275 = -0.10.

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.

Example
Measuring how much the confounder distorts the answer

Use the same invented study. The crude risk ratio is the raw treated rate over the raw untreated rate:

crude risk ratio=0.250.14=1.79.\text{crude risk ratio} = \frac{0.25}{0.14} = 1.79.

The standardised risk ratio uses the standardised rates from the previous example:

standardised risk ratio=0.1750.275=0.64.\text{standardised risk ratio} = \frac{0.175}{0.275} = 0.64.

  1. The ratio of the two is the size of the distortion: 1.79/0.64=2.811.79 / 0.64 = 2.81.
  2. The crude comparison overstates the risk of treatment by a factor of about 2.8 relative to the standardised one.
  3. 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

SituationWhat goes wrongBetter choice
Randomisation is possible and ethicalObservational comparison still carries unmeasured confoundingRandomised controlled trial, which balances measured and unmeasured confounders in expectation
Confounders are measured and fewStratification or standardisation works and is transparentStratify or standardise, and report the stratum-specific estimates
Many confounders, some strata nearly emptyStratum rates are unstable and the adjustment failsRegression, or a propensity score that summarises the confounders into one number
A confounder is not measuredNo adjustment can remove it, and the estimate can be wrong in any directionSensitivity analysis, which asks how strong an unmeasured confounder would need to be to explain the result
A variable affected by the exposure is adjusted forAdjusting for a mediator or for a common effect creates bias instead of removing itDraw the causal graph first and adjust only for confounders on the backdoor paths
A confounder is measured with errorAdjustment leaves residual confounding, so part of the bias remainsImprove 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 10/200=0.0510/200 = 0.05 and the untreated rate is 40/800=0.0540/800 = 0.05. The difference is 00. 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.

Sources