AI Wiki中文/EN

Confounding: when a common cause imitates an effect

混杂因素

See how a common cause of treatment and outcome biases a naive comparison, why randomisation removes the bias and a bigger sample does not, how standardisation and proxies help, why confounding cannot be read off associations, and how to bound an unmeasured confounder with the Ding–VanderWeele formula.

On this pageIntuitionMathematics & methodImplementationLimitationsExercisesResearch connections

A common cause behind both

Confounding happens when something that influences who gets a treatment also influences the outcome. A plain comparison of treated and untreated people then mixes the treatment’s effect with the effect of that shared cause. For example, if doctors give a drug mainly to the sickest patients, the drug can look harmful simply because sick patients die more often. Chapter 7

Here “treatment” means any action or exposure whose effect we want to know: a drug, a training method, a new feature in an app. The “outcome” is what we measure afterwards. A “common cause” is a third variable that affects both. In the drug example, disease severity is the common cause.

A small synthetic example shows the size of the problem. In our simulation the drug truly raises the chance of the outcome by 0.10. People with a risk factor get the drug far more often, and the risk factor raises the outcome by itself. The naive difference between treated and untreated comes out at +0.3413, more than three times the true effect. Comparing within each risk group, and then averaging, gives +0.1009.

Collecting more data does not fix this. The bias comes from who ends up in each group, not from chance. A study of a million people gives the same wrong answer, just more precisely. Hernán and Robins stress that the gap between association and causation remains even in an arbitrarily large population. p. 91

Randomisation does fix it. If a coin decides who gets the drug, treatment shares no cause with the outcome. The coin decides treatment, and the coin itself does not affect the outcome. In our simulation a coin-flip version gives +0.1009, and the risk factor is equally common in both arms. p. 94

Without randomisation, the usual remedy is adjustment. You compare like with like inside groups that share the common cause, then combine the results. This works only if every relevant common cause, or something that blocks its influence, is measured. That assumption cannot be checked from the data alone. §7.6 §2.3

This article uses Hernán and Robins’s structural definition of confounding: bias that comes from common causes of treatment and outcome. Two other definitions exist and are compared in the theory section. The general framework of causal effects is in causal inference, causal diagrams in causal graphs, and the full rule for choosing what to adjust for in back-door adjustment. The opposite mistake, adjusting for a common effect, is the subject of collider bias.

What confounding is, how it biases, and how big it can be

This section gives the structure of confounding, compares three definitions, shows why associations cannot define it, and then quantifies the bias, including for confounders nobody measured.

The structure: an open back-door path

In a causal diagram, an arrow means “directly causes”. Write AA for the treatment, YY for the outcome and LL for a common cause. Confounding appears as the shape A←L→YA\leftarrow L\rightarrow Y. Hernán and Robins call this a back-door path: a path between treatment and outcome that starts with an arrow pointing into the treatment. §7.1, p. 91 Such a path carries association between AA and YY that is not caused by AA.

They list familiar biases with exactly this shape. Healthy worker bias: being fit affects both who becomes a firefighter and who dies early. Confounding by indication: heart disease makes doctors prescribe aspirin and also raises the risk of stroke. Reverse causation, when early, undetected disease changes the “treatment”. Population stratification in genetics. And pollutants that vary together, so that the effect of one is mixed with the effect of another. pp. 91–92

The confounder need not itself be a common cause. In their Figures 7.2 and 7.3, an unmeasured variable UU causes both sides, and a measured LL lies on the back-door path between UU and one end. Conditioning on LL blocks the path, so LL serves as a confounder. §7.3, pp. 95–96

Hernán and Robins also describe confounding as a lack of exchangeability. Exchangeability, defined in causal inference, means the treated and untreated would have had the same outcome risk had they received the same treatment. A common cause makes the two groups differ in risk from the start. pp. 91, 93

Three definitions that should be kept apart

Writers mean different things by “confounding”. Mixing them inside one argument causes confusion, so here they are side by side.

Structural (used in this article). Confounding is the bias due to common causes of treatment and outcome; it exists when there is an open back-door path. Whether it exists is a fact about the world described by the diagram, not about the analysis. §7.1

Distribution-level. Peters, Janzing and Schölkopf use a definition based on distributions. The effect of AA on YY is confounded when YY is distributed differently after setting AA than among those who happen to have that AA. Definition 6.39, p. 113

P(Y=y∣do(A=a))≠P(Y=y∣A=a)P(Y=y\mid do(A=a))\neq P(Y=y\mid A=a)

In words: confounding means that “seeing” A=aA=a and “doing” A=aA=a give different outcome distributions. Here do(A=a)do(A=a) means an intervention that sets AA to aa for everyone; the notation is explained in structural causal models.

The two can disagree. Hernán and Robins note that strong back-door paths can push the bias in opposite directions and leave only a weak net bias. p. 95 Suppose the offsetting were exact for the whole outcome distribution. Then there would be structural confounding but, by the second definition, no confounding. This is our own inference from the two definitions; neither source discusses this case.

“Any bias removable by randomisation”. Hernán and Robins discuss a third usage. It would also call “confounding” the bias created by adjusting for a common effect, because randomisation removes that bias too. Under that usage, whether confounding exists depends on the method of analysis, not only on the world. They do not adopt it and reserve the word for common causes, while noting that the choice is a matter of taste with no practical consequence for identification. pp. 97–98

Adjustment, exchangeability and the back-door criterion

The back-door criterion, stated in full in back-door adjustment, says when a set of measured variables is enough to adjust for. Roughly, the set must block every back-door path and must contain no descendant of the treatment. A descendant is anything the treatment causes, directly or through other variables. p. 93

Hernán and Robins state that the criterion holds if and only if conditional exchangeability holds, under faithfulness and a further condition on the causal model. p. 93 Faithfulness, explained in causal graphs, is the extra assumption that every independence in the data comes from the diagram’s structure, not from exact cancellations. The step from “the criterion holds” to “exchangeability holds” needs neither assumption. The reverse step needs both: faithfulness, and the type of causal model the book assumes throughout. Technical Point 7.1, p. 94

The criterion is about descendants of treatment, not about time. A variable measured after treatment but not caused by it can be a valid adjuster, if it blocks the back-door paths. A variable caused by the treatment cannot be one. Fine Point 7.4, p. 103

With one discrete confounder LL that satisfies the criterion, the causal mean is obtained by standardisation. p. 93

E[Y∣do(A=a)]=∑lE[Y∣A=a,L=l] P(L=l)E[Y\mid do(A=a)]=\sum_{l}E[Y\mid A=a,L=l]\,P(L=l)

In words: compute the average outcome under treatment aa separately in each stratum L=lL=l. Then average those numbers, weighting each stratum by how common it is in the whole population, not in the treated group.

Confounding versus “a confounder”

Given the diagram, confounding is absolute: the back-door paths are either there or not. Being “a confounder” is relative to what else is adjusted for. In the U→LU\to L example above, LL is needed only because UU is unmeasured. If UU were measured, adjusting for UU would be enough and LL would not be needed. p. 100 So “this variable is the confounder” is shorthand, not a property of the variable.

Why associations cannot define confounding

Pearl argues that confounding is a causal concept, so it cannot be defined from the joint distribution of the data. If it could, one could find and remove confounders from observational data alone. That would contradict the principle that every causal conclusion rests on some causal assumption the data cannot test. §2.2–2.3, pp. 99–100

A simple failure: a mediator, a variable on the causal path A→M→YA\rightarrow M\rightarrow Y, is associated with both AA and YY, yet it is not a confounder. footnote 2, p. 100

The traditional textbook rule has three conditions: the variable is associated with treatment, associated with the outcome given treatment, and not on the causal path. Hernán and Robins show it agrees with the back-door criterion in simple diagrams. In the M-shaped diagram, however, the rule calls a variable a confounder when adjusting for it creates bias. §7.4, pp. 98–99 That diagram is treated in collider bias.

Pearl adds that an irreducible sufficient set, one with no member that could be dropped, taken as a whole, is associated with treatment and outcome, but its single members need not be. Conversely, a pre-treatment variable associated with both may have to be left out. §3.3.1, p. 115

An older practice judged confounding by whether the estimate changed after adjustment. Hernán and Robins report that it has been abandoned, because estimates can change for other reasons. Adjusting for a non-confounder can add selection bias. Some effect measures change under stratification even without confounding, a property called noncollapsibility. p. 100

The size of the bias in a linear model

For continuous variables a short formula shows where the bias comes from. Take an unmeasured UU with variance 1, a treatment A=αU+eAA=\alpha U+e_A and an outcome Y=βA+γU+eYY=\beta A+\gamma U+e_Y, with independent noises of variance 1. The true effect is β\beta. Regressing YY on AA alone gives the slope Cov⁡(A,Y)/Var⁡(A)\operatorname{Cov}(A,Y)/\operatorname{Var}(A). Here Cov⁡(A,Y)=β(α2+1)+γα\operatorname{Cov}(A,Y)=\beta(\alpha^2+1)+\gamma\alpha and Var⁡(A)=α2+1\operatorname{Var}(A)=\alpha^2+1, so

Cov⁡(A,Y)Var⁡(A)=β+γ αα2+1\frac{\operatorname{Cov}(A,Y)}{\operatorname{Var}(A)}=\beta+\gamma\,\frac{\alpha}{\alpha^2+1}

In words: the naive slope equals the true effect plus the confounder’s effect on the outcome, γ\gamma, times how strongly the treatment tracks the confounder. If either link is zero, the bias vanishes. This is our own derivation of the familiar omitted-variable-bias formula; Cinelli, Forney and Pearl give the analogous path formula for their linear Model 1. Appendix, pp. 22–23

Hernán and Robins note that the back-door criterion says nothing about the size or direction of the bias. Weak paths cause little bias, and paths pushing in opposite directions can offset each other. p. 95 For a single binary confounder with binary treatment and outcome, there is a simple sign rule. If the confounder pushes treatment and outcome in the same direction, the bias is upward; if in opposite directions, downward. The rule can fail in more complex diagrams. Fine Point 7.1, p. 96 A large bias needs strong links from the confounder to both treatment and outcome. Fine Point 7.1

Bounding an unmeasured confounder

When a confounder was not measured, one can still ask how strong it would have to be to explain an observed result. This is sensitivity analysis. Cornfield and colleagues did an early version for smoking and lung cancer. As Ding and VanderWeele report, it assumed a single binary confounder and no interaction, and it only asked whether the effect could be explained away entirely. §1, pp. 2–3

Ding and VanderWeele derived a bound that needs none of these assumptions. Their notation uses EE, DD, CC and UU for exposure, outcome, measured and unmeasured confounders; we write AA, YY, LL and UU. Let RRobsRR_{\text{obs}} be the observed risk ratio, already adjusted for the measured LL. A risk ratio is the outcome risk among the treated divided by the risk among the untreated. Let RREURR_{EU} be the largest risk ratio linking treatment to any category of UU. Let RRUDRR_{UD} be the largest ratio of outcome risks between categories of UU, computed within the treated and within the untreated, taking the larger of the two. Their Result 1 is: §2, pp. 5–7, eq. (1)

B=RREU RRUDRREU+RRUD−1,RRtrue≥RRobsBB=\frac{RR_{EU}\,RR_{UD}}{RR_{EU}+RR_{UD}-1},\qquad RR_{\text{true}}\ge\frac{RR_{\text{obs}}}{B}

In words: a hidden confounder with strengths RREURR_{EU} and RRUDRR_{UD} can shrink an observed risk ratio by at most the factor BB, called the bounding factor. They show the bound is sharp, meaning it can be reached. pp. 6–7

Setting the two strengths equal gives the smallest common strength that could explain the result away completely, that is, push the true risk ratio down to 1. §2, pp. 9–11

RREU=RRUD≥RRobs+RRobs (RRobs−1)RR_{EU}=RR_{UD}\ge RR_{\text{obs}}+\sqrt{RR_{\text{obs}}\,(RR_{\text{obs}}-1)}

In words: to turn an observed risk ratio into no effect at all, a confounder with equal links to treatment and outcome needs both links at least this large. More generally, the larger of the two must reach this value. The classical Cornfield conditions, each strength at least RRobsRR_{\text{obs}}, are limiting cases. §3, pp. 12–13 Later papers commonly call this threshold the “E-value”. That name does not appear in the arXiv version we read, so we do not attribute it to this paper.

Ding and VanderWeele apply it to historical data reported by Hammond and Horn. The observed risk ratio of smoking for lung cancer was 10.73. Explaining it away with equal strengths would need both RREURR_{EU} and RRUDRR_{UD} to be at least 20.95. §4, pp. 14–16 As a check, 10.73+10.73×9.73=10.73+10.22=20.9510.73+\sqrt{10.73\times9.73}=10.73+10.22=20.95.

Pearl adds a general warning. Sensitivity to causal assumptions does not shrink as the sample grows, unlike sensitivity to statistical prior beliefs. §2.4, p. 101

Three synthetic simulations

This section runs three small simulations: a measured confounder, an unmeasured one with a noisy stand-in, and a sensitivity bound. The program is an original synthetic simulation, numpy only, seed 2016, with 400,000 draws per part. The numbers describe toy models, not any real drug or exposure. Printed values wobble around the exact ones by up to about 0.01, and the output shows both. The helper function is named e_value after the later common name discussed above.

# Confounding in three synthetic models (original toy simulations, not real data).
import numpy as np

rng = np.random.default_rng(2016)
N = 400_000

print("Part A. A measured binary confounder L")
print("  L ~ Bern(0.5);  P(A=1|L) = 0.2 or 0.8;  P(Y=1|A,L) = 0.2 + 0.1*A + 0.4*L")
L = (rng.random(N) < 0.5).astype(int)
A = (rng.random(N) < np.where(L == 1, 0.8, 0.2)).astype(int)
Y = (rng.random(N) < 0.2 + 0.1 * A + 0.4 * L).astype(int)
naive = Y[A == 1].mean() - Y[A == 0].mean()
strata = [Y[(A == 1) & (L == l)].mean() - Y[(A == 0) & (L == l)].mean() for l in (0, 1)]
pl = [np.mean(L == l) for l in (0, 1)]
adjusted = sum(d * p for d, p in zip(strata, pl))
print("  true average causal effect E[Y|do(A=1)] - E[Y|do(A=0)] = +0.1000")
print(f"  naive difference E[Y|A=1] - E[Y|A=0] = {naive:+.4f}  (exact +0.3400)")
print(f"  stratum differences: L=0 {strata[0]:+.4f}, L=1 {strata[1]:+.4f}  (exact +0.1000 each)")
print(f"  back-door adjusted (standardized over P(L)) = {adjusted:+.4f}  (exact +0.1000)")
A_r = (rng.random(N) < 0.5).astype(int)
Y_r = (rng.random(N) < 0.2 + 0.1 * A_r + 0.4 * L).astype(int)
print(f"  randomized A (coin flip, same L and outcome rule): difference = "
      f"{Y_r[A_r == 1].mean() - Y_r[A_r == 0].mean():+.4f}  (exact +0.1000)")
print(f"  share with L=1: treated {L[A == 1].mean():.4f}, untreated {L[A == 0].mean():.4f} (observational); "
      f"treated {L[A_r == 1].mean():.4f}, untreated {L[A_r == 0].mean():.4f} (randomized)")


def ols_slope(y, *cols):
    X = np.column_stack([np.ones_like(y)] + list(cols))
    return np.linalg.lstsq(X, y, rcond=None)[0][1]


def pop_slope(cov, yi, xi):
    # population coefficient on the first regressor in xi, from a covariance matrix
    S = cov[np.ix_(xi, xi)]
    c = cov[np.ix_(xi, [yi])]
    return float(np.linalg.solve(S, c)[0, 0])


print("\nPart B. An unmeasured confounder U and a noisy proxy W = U + noise")
print("  U ~ N(0,1);  A := 0.8 U + e_A;  Y := 1.0 A + 1.0 U + e_Y;  W := U + s * e_W  (all e ~ N(0,1))")
U = rng.standard_normal(N)
A2 = 0.8 * U + rng.standard_normal(N)
Y2 = 1.0 * A2 + 1.0 * U + rng.standard_normal(N)
print("  true effect of A on Y = 1.0000")
print(f"  regress Y on A          : {ols_slope(Y2, A2):.4f}  (exact {1 + 0.8 / 1.64:.4f})")
print(f"  regress Y on A and U    : {ols_slope(Y2, A2, U):.4f}  (exact 1.0000; impossible if U is unmeasured)")
for s in (1.0, 0.3):
    W = U + s * rng.standard_normal(N)
    # covariance of (U, A, Y, W) under the model
    cov = np.array([
        [1.0, 0.8, 1.8, 1.0],
        [0.8, 1.64, 2.44, 0.8],
        [1.8, 2.44, 5.24, 1.8],
        [1.0, 0.8, 1.8, 1.0 + s * s],
    ])
    exact = pop_slope(cov, 2, [1, 3])
    print(f"  regress Y on A and W, s = {s:.1f} (proxy reliability {1 / (1 + s * s):.3f}): "
          f"{ols_slope(Y2, A2, W):.4f}  (exact {exact:.4f})")

print("\nPart C. Sensitivity analysis: how strong must an unmeasured confounder be?")
print("  Null world: true effect of A on Y is zero; a binary U drives both.")
print("  U ~ Bern(0.5);  P(A=1|U) = 0.25 or 0.75;  P(Y=1|U) = 0.10 or 0.40 (A has no effect)")
U3 = (rng.random(N) < 0.5).astype(int)
A3 = (rng.random(N) < np.where(U3 == 1, 0.75, 0.25)).astype(int)
Y3 = (rng.random(N) < np.where(U3 == 1, 0.40, 0.10)).astype(int)
rr_obs = Y3[A3 == 1].mean() / Y3[A3 == 0].mean()
pu1 = U3[A3 == 1].mean()
pu0 = U3[A3 == 0].mean()
rr_eu = max(pu1 / pu0, (1 - pu1) / (1 - pu0))
# RR_UD uses the unexposed stratum; under this null model the exposed stratum gives the same ratio
py = [Y3[(A3 == 0) & (U3 == k)].mean() for k in (0, 1)]
rr_ud = max(py) / min(py)
bf = rr_eu * rr_ud / (rr_eu + rr_ud - 1)
print(f"  observed risk ratio RR_obs = {rr_obs:.4f}  (exact {0.325 / 0.175:.4f}); true RR = 1")
print(f"  RR_EU = {rr_eu:.4f} (exact 3.0000), RR_UD = {rr_ud:.4f} (exact 4.0000)")
print(f"  bounding factor RR_EU*RR_UD/(RR_EU+RR_UD-1) = {bf:.4f}  (exact 2.0000) >= RR_obs: {bf >= rr_obs}")


def e_value(rr):
    return rr + np.sqrt(rr * (rr - 1))


print(f"  threshold both strengths must reach to explain RR_obs away: {e_value(rr_obs):.4f}  "
      f"(exact {e_value(0.325 / 0.175):.4f}); here max(RR_EU, RR_UD) = 4")
print("  For a hypothetical observed RR = 2.0:")
for eu, ud in [(1.5, 1.5), (2.0, 2.0), (3.0, 3.0), (2.0, 6.0)]:
    b = eu * ud / (eu + ud - 1)
    print(f"    confounder strengths ({eu:.1f}, {ud:.1f}): bounding factor {b:.4f}, "
          f"true RR could be as low as {2.0 / b:.4f}")
print(f"    equal strengths needed to explain RR = 2.0 away completely: {e_value(2.0):.4f}")

The output is:

Part A. A measured binary confounder L
  L ~ Bern(0.5);  P(A=1|L) = 0.2 or 0.8;  P(Y=1|A,L) = 0.2 + 0.1*A + 0.4*L
  true average causal effect E[Y|do(A=1)] - E[Y|do(A=0)] = +0.1000
  naive difference E[Y|A=1] - E[Y|A=0] = +0.3413  (exact +0.3400)
  stratum differences: L=0 +0.1033, L=1 +0.0986  (exact +0.1000 each)
  back-door adjusted (standardized over P(L)) = +0.1009  (exact +0.1000)
  randomized A (coin flip, same L and outcome rule): difference = +0.1009  (exact +0.1000)
  share with L=1: treated 0.8012, untreated 0.1997 (observational); treated 0.5001, untreated 0.5008 (randomized)

Part B. An unmeasured confounder U and a noisy proxy W = U + noise
  U ~ N(0,1);  A := 0.8 U + e_A;  Y := 1.0 A + 1.0 U + e_Y;  W := U + s * e_W  (all e ~ N(0,1))
  true effect of A on Y = 1.0000
  regress Y on A          : 1.4842  (exact 1.4878)
  regress Y on A and U    : 0.9988  (exact 1.0000; impossible if U is unmeasured)
  regress Y on A and W, s = 1.0 (proxy reliability 0.500): 1.3016  (exact 1.3030)
  regress Y on A and W, s = 0.3 (proxy reliability 0.917): 1.0612  (exact 1.0627)

Part C. Sensitivity analysis: how strong must an unmeasured confounder be?
  Null world: true effect of A on Y is zero; a binary U drives both.
  U ~ Bern(0.5);  P(A=1|U) = 0.25 or 0.75;  P(Y=1|U) = 0.10 or 0.40 (A has no effect)
  observed risk ratio RR_obs = 1.8621  (exact 1.8571); true RR = 1
  RR_EU = 2.9724 (exact 3.0000), RR_UD = 3.9906 (exact 4.0000)
  bounding factor RR_EU*RR_UD/(RR_EU+RR_UD-1) = 1.9892  (exact 2.0000) >= RR_obs: True
  threshold both strengths must reach to explain RR_obs away: 3.1292  (exact 3.1188); here max(RR_EU, RR_UD) = 4
  For a hypothetical observed RR = 2.0:
    confounder strengths (1.5, 1.5): bounding factor 1.1250, true RR could be as low as 1.7778
    confounder strengths (2.0, 2.0): bounding factor 1.3333, true RR could be as low as 1.5000
    confounder strengths (3.0, 3.0): bounding factor 1.8000, true RR could be as low as 1.1111
    confounder strengths (2.0, 6.0): bounding factor 1.7143, true RR could be as low as 1.1667
    equal strengths needed to explain RR = 2.0 away completely: 3.4142

Part A: a measured confounder

Half the population has the risk factor L=1L=1. They get the treatment with probability 0.8, the others with probability 0.2. The outcome probability is 0.2+0.1A+0.4L0.2+0.1A+0.4L, so the true effect is exactly 0.10 in every stratum.

The exact naive difference follows by hand. Among the treated, the share with L=1L=1 is 0.5×0.8/(0.5×0.8+0.5×0.2)=0.80.5\times0.8/(0.5\times0.8+0.5\times0.2)=0.8. Among the untreated it is 0.2. So E[Y∣A=1]=0.3+0.4×0.8=0.62E[Y\mid A=1]=0.3+0.4\times0.8=0.62 and E[Y∣A=0]=0.2+0.4×0.2=0.28E[Y\mid A=0]=0.2+0.4\times0.2=0.28. The difference is 0.34. The extra 0.24 is the confounder’s effect, 0.4, times the gap in its share between the groups, 0.8−0.20.8-0.2.

The simulation prints +0.3413 for the naive difference, and shares of 0.8012 and 0.1997 for L=1L=1. The stratum differences are +0.1033 and +0.0986. Standardising them over P(L)P(L) gives +0.1009. Randomising the treatment gives +0.1009 as well, with shares 0.5001 and 0.5008: the coin balances the risk factor.

Part B: an unmeasured confounder and a proxy

Now the common cause UU is continuous and unmeasured. The true effect is 1. The linear formula above, with α=0.8\alpha=0.8 and β=γ=1\beta=\gamma=1, predicts a naive slope of 1+0.8/1.64=1.48781+0.8/1.64=1.4878. The simulation prints 1.4842. Adding UU to the regression gives 0.9988, but in practice UU is not available.

Suppose instead we measure a proxy W=U+s eWW=U+s\,e_W, a noisy reading of UU. Its reliability, the share of its variance that comes from UU, is 1/(1+s2)1/(1+s^2). With reliability 0.500 the slope is 1.3016 (exact 1.3030). With reliability 0.917 it is 1.0612 (exact 1.0627). The exact bias falls from 0.4878 to 0.3030 to 0.0627: a better proxy removes more of it, but never all of it.

Hernán and Robins describe the same idea for a binary proxy, which they call a surrogate confounder. Adjusting for it can partly block the back-door path under weak conditions, and they usually prefer to adjust for it. Fine Point 7.3, p. 100 Part B is a linear illustration of that idea, not a proof that a proxy always helps.

Part C: a sensitivity bound in a null world

Here the treatment has no effect at all, and a binary UU drives both treatment and outcome. By hand: P(Y=1∣A=1)=0.75×0.4+0.25×0.1=0.325P(Y=1\mid A=1)=0.75\times0.4+0.25\times0.1=0.325 and P(Y=1∣A=0)=0.25×0.4+0.75×0.1=0.175P(Y=1\mid A=0)=0.25\times0.4+0.75\times0.1=0.175. The observed risk ratio is 0.325/0.175=1.85710.325/0.175=1.8571, although the true risk ratio is 1.

The confounder’s strengths are RREU=0.75/0.25=3RR_{EU}=0.75/0.25=3 and RRUD=0.4/0.1=4RR_{UD}=0.4/0.1=4. The bounding factor is 3×4/(3+4−1)=23\times4/(3+4-1)=2. The simulation prints 1.8621, 2.9724, 3.9906 and 1.9892. As Result 1 requires, a confounder that manufactures a risk ratio of about 1.86 out of nothing has a bounding factor at least that large. The equal-strength threshold for this risk ratio is 3.1188 (printed 3.1292), and the larger strength here, 4, exceeds it.

The last block applies the bound to a hypothetical observed risk ratio of 2.0. A confounder of strengths (2, 2) has B=4/3=1.3333B=4/3=1.3333, so the true risk ratio could be as low as 1.5000, still above 1. Strengths (3, 3) give 1.1111, and (2, 6) give 1.1667. Explaining 2.0 away entirely needs equal strengths of 2+2=3.41422+\sqrt2=3.4142.

What confounding analysis cannot do

This section lists the limits of detecting, removing and bounding confounding, and the limits of this article’s example.

Data alone cannot reveal it. No association test shows whether a variable is a confounder, because confounding is a causal notion. §2.3, p. 100 Every adjustment rests on a diagram the data cannot fully check.

No unmeasured confounding is an assumption. Observational causal inference rests on the claim that the measured variables are enough to block every back-door path. Hernán and Robins call this assumption uncheckable. §7.6, pp. 102–103

Randomisation removes confounding, not every bias. Selection after randomisation, such as dropout that depends on treatment, can still bias a trial. §8.2, p. 113 So can measurement error. p. 105 Dropout bias is covered in collider bias.

Adjusting for more is not always safer. Hernán and Robins advise against adjusting for variables affected by the treatment or by the outcome. p. 104 A pre-treatment variable can also be harmful, as the M-shaped diagram in collider bias shows. When one variable is both a confounder and a collider, adjusting closes one path and opens another. Cinelli, Forney and Pearl say the choice then needs further assumptions or a sensitivity analysis. pp. 6, 13

Proxies and sign rules have conditions. A proxy partly blocks a back-door path only under conditions such as those in Fine Point 7.3. p. 100 The simple sign rule for the direction of bias can fail outside the three-variable binary case. Fine Point 7.1, p. 96

Other designs swap one assumption for another. Difference-in-differences, instrumental variables, proximal inference and the front-door criterion can tolerate unmeasured confounding. Each needs its own unverifiable assumptions. p. 104; Technical Points 7.3–7.4 The front-door approach is in front-door adjustment.

“May be confounded” is not a criticism. Every observational study may be confounded. Hernán and Robins argue that a useful critique names a specific common cause through which a back-door path may stay open. The investigator can then adjust for it or study it with a sensitivity analysis. pp. 104–105

The bound has a scope. The Ding–VanderWeele formula here applies to risk ratios. We read only the first 16 pages of the arXiv version 1 preprint and not its later journal version, so other scales and extensions are not covered. Choosing plausible values for RREURR_{EU} and RRUDRR_{UD} is a judgment the formula cannot make.

The example is a toy. All three models are synthetic, with chosen numbers and known truth. They show the mechanics, not the size of confounding in any real field.

Exercises

These exercises cover the idea of a back-door path, a hand calculation, a counterexample to a common rule, a sensitivity judgment and method choice.

  1. A hospital database shows that patients given drug A die more often than those not given it. The drug is prescribed mainly to the sickest patients. Explain, in terms of paths, why this comparison may say nothing about the drug’s effect, and why ten times more patients will not help.

    Answer: Severity is a common cause. It raises both the chance of getting the drug and the risk of death, creating the back-door path drug ← severity → death. This is confounding by indication (Hernán and Robins, p. 92). The association mixes the causal path with this noncausal one. The bias is structural, not random error, so it remains however large the sample (p. 91). Randomisation removes it, because then nothing causes both (p. 94). Without randomisation, one must adjust for severity and anything else on back-door paths, if they are measured.

  2. Use Part A’s model: P(L=1)=0.5P(L=1)=0.5, P(A=1∣L=0)=0.2P(A=1\mid L=0)=0.2, P(A=1∣L=1)=0.8P(A=1\mid L=1)=0.8, P(Y=1∣A,L)=0.2+0.1A+0.4LP(Y=1\mid A,L)=0.2+0.1A+0.4L. Compute the naive difference and the standardised difference.

    Answer: P(L=1∣A=1)=0.5×0.8/(0.5×0.8+0.5×0.2)=0.8P(L=1\mid A=1)=0.5\times0.8/(0.5\times0.8+0.5\times0.2)=0.8 and P(L=1∣A=0)=0.2P(L=1\mid A=0)=0.2. Then E[Y∣A=1]=0.3+0.4×0.8=0.62E[Y\mid A=1]=0.3+0.4\times0.8=0.62 and E[Y∣A=0]=0.2+0.4×0.2=0.28E[Y\mid A=0]=0.2+0.4\times0.2=0.28, so the naive difference is 0.34. Within each stratum the difference is 0.1, and standardising gives 0.5×0.1+0.5×0.1=0.100.5\times0.1+0.5\times0.1=0.10. The bias, 0.24, equals 0.4×(0.8−0.2)0.4\times(0.8-0.2): the confounder’s effect on the outcome times its imbalance between the groups. The simulation prints +0.3413 and +0.1009.

  3. A colleague defines a confounder as “any variable associated with both treatment and outcome” and adjusts for all such variables. Give two structures where this fails and say what goes wrong.

    Answer: (a) A mediator on A→M→YA\rightarrow M\rightarrow Y is associated with both (Pearl, footnote 2, p. 100). Adjusting for it removes part of the very effect being estimated. (b) In the M-shaped diagram A←U2→L←U1→YA\leftarrow U_2\rightarrow L\leftarrow U_1\rightarrow Y, the variable LL is pre-treatment and associated with both AA and YY. Yet there is no confounding, and adjusting for LL opens a path through the common effect and creates bias (Hernán and Robins, Fig. 7.4, pp. 95–99; see collider bias). Whether to adjust depends on causal structure, not on associations.

  4. A study reports an adjusted risk ratio of 2.0. A reviewer writes that an unmeasured confounder could explain it. (a) How far could a confounder with RREU=RRUD=2RR_{EU}=RR_{UD}=2 reduce it? (b) How strong would equal-strength confounding need to be to explain it away? (c) What is wrong with the reviewer’s sentence?

    Answer: (a) B=2×2/(2+2−1)=1.3333B=2\times2/(2+2-1)=1.3333, so the true risk ratio is at least 2.0/1.3333=1.52.0/1.3333=1.5, still above 1. (b) 2+2×1=3.41422+\sqrt{2\times1}=3.4142: both links must be at least about 3.4, as the example prints. (c) “Could be confounded” is true of every observational study, so it says nothing. A useful criticism names a specific common cause and argues it is strong enough (Hernán and Robins, pp. 104–105). The bound needs no assumption about the confounder’s type or number (Ding and VanderWeele, §1), but choosing plausible strengths is itself a judgment.

  5. Choose a strategy for each case and name the assumption it rests on. (a) A clinic can randomise reminder messages. (b) Observational data with age, sex and severity measured, and a diagram in which these block every back-door path. (c) An unmeasured confounder, but a mediator that fully carries the effect and meets the front-door conditions. (d) An unmeasured confounder and no extra structure.

    Answer: (a) Randomise: there are no common causes by design (Hernán and Robins, p. 94). Watch for dropout after randomisation, which is selection bias, not confounding (p. 113; collider bias). (b) Adjust, by standardisation, inverse probability weighting or matching. This assumes no unmeasured confounding given the set, which cannot be checked (p. 102; back-door adjustment). (c) Front-door adjustment (front-door adjustment), assuming its conditions hold (Technical Point 7.4). (d) The effect is not identified from these data. Report a sensitivity analysis such as the bounding factor. Or use a proxy, accepting that it reduces but does not remove the bias (Part B: 1.4878 to 1.3030 with a reliability-0.5 proxy).

History and further reading

This section notes where the idea came from, as reported by the sources we read, and where to go next.

Hernán and Robins report that early statistical descriptions came from Pearson and colleagues in 1899, for continuous variables, and from Yule in 1903, for discrete ones. These authors called such associations “spurious” or “fictitious”. Hernán and Robins point out that the associations are real; they just cannot be read as treatment effects. margin note, p. 92 We did not read the 1899 and 1903 papers.

Ding and VanderWeele describe Cornfield and colleagues’ 1959 work on smoking and lung cancer as an early sensitivity analysis for an unmeasured confounder. They generalise it and re-analyse Hammond and Horn’s data. §§1, 4 We know both older works only through that paper.

For a book-length treatment, Hernán and Robins’s Chapter 7 covers confounding and Chapter 8 the contrasting case of selection bias. Chapters 7–8 Pearl’s overview explains why confounding is a causal and not a statistical concept. §2 Peters, Janzing and Schölkopf give the distribution-level definition and work through a kidney-stone example. §6.6 Simpson’s paradox is discussed in correlation and causation. Cinelli, Forney and Pearl give a practical catalogue of good and bad control variables. pp. 1–14

Make a prediction, then check

In an observational study, sicker patients receive drug A more often, and sickness itself raises the risk of death. The researchers enlarge the sample 100-fold. What happens to the naive comparison of death rates between treated and untreated?

Choose one answer

Learning objectives

  • Explain confounding as a common cause that opens a back-door path, compute the naive and standardised differences in a binary example, and say why randomisation removes confounding while a larger sample does not.
  • Distinguish confounding from 'a confounder' and measured from unmeasured confounding, explain why confounding cannot be defined by associations alone, and run a sensitivity analysis with the Ding–VanderWeele bounding factor.

Prerequisites & connections

Explore related knowledge →

References

  1. Causal Inference: What If (online version of 19 August 2026) — scoped
    Miguel A. Hernán; James M. Robins · 2026
  2. Causal inference in statistics: An overview
    Judea Pearl · 2009
  3. Elements of Causal Inference: Foundations and Learning Algorithms — scoped
    Jonas Peters; Dominik Janzing; Bernhard Schölkopf · 2017
  4. Sensitivity Analysis Without Assumptions (arXiv v1) — scoped
    Peng Ding; Tyler J. VanderWeele · 2015
  5. A Crash Course in Good and Bad Controls (technical report R-493, revised March 2022) — scoped
    Carlos Cinelli; Andrew Forney; Judea Pearl · 2022

Version1 · Editorial status: Recorded technical checks completed

View technical check record (AI)

Claude · 2026-12-03 · Independent AI check (Claude subagent, not the author; not a human or expert review). This article did not receive a Gemini style pass, so the checker made the D012 readability edits to the intuition section itself before the factual check; research was done by a separate research subagent (facts.md) and the prose by a writer subagent. I ran example.py with the pinned interpreter (numpy 1.26.4) and confirmed the output matches example.stdout.txt byte for byte, that the python and output blocks in en.mdx and zh.mdx are identical to example.py and example.stdout.txt, and that every number quoted in the prose matches. I re-derived the standardisation hand calculation (0.62 - 0.28 = 0.34, bias 0.4 x 0.6), the omitted-variable-bias formula (our own derivation, labelled as such), the Part B covariances and exact slopes, the Part C null-world risk ratio 0.325/0.175, the bounding factors and the thresholds 3.1188, 3.4142 and 20.95. I downloaded the sources myself and re-read Hernán & Robins (19 August 2026 PDF) Chapter 7 pp. 91-107 and Chapter 8 pp. 109-123, including p. 93 and Technical Point 7.1 on faithfulness and Fine Point 7.4 on descendants versus time; Pearl 2009 pp. 99-101 and 115 and footnote 2; Peters, Janzing & Schölkopf Definition 6.39 on p. 113; Ding & VanderWeele arXiv v1 pp. 1-16 (Result 1, thresholds, Cornfield conditions, Hammond-Horn illustration; the term 'E-value' does not occur in that file); and Cinelli, Forney & Pearl pp. 3, 5-6, 13 and 22-27. I compared zh and en paragraph by paragraph, checked equations, source IDs, anchors, MDX compilation, links (unpublished causal topics stay inline code), aliases for case-insensitive uniqueness and collisions with src/data/aliases.json, the catalogue and the other 016 drafts, and the lint stock-phrase list. Not checked: the journal versions of Ding & VanderWeele and Cinelli et al., and the older works (Yule, Pearson, Cornfield, Hammond and Horn), which the article reports only second-hand and labels as such.

  • The example was rerun with the pinned interpreter and matches example.stdout.txt exactly; numbers in prose, exercises and quiz match the output, and the hand calculations and derivations (standardisation, omitted-variable bias, bounding factor and thresholds) were re-derived.
  • The three definitions are kept apart (Hernán and Robins's structural one, Peters et al.'s distribution-level one, 'any bias removable by randomisation'), and the exact-cancellation case is labelled as our own inference.
  • The 'if and only if' link between the back-door criterion and conditional exchangeability now states that it needs faithfulness and a further model condition (p. 93, Technical Point 7.1); the descendants-not-time point matches Fine Point 7.4.
  • The Ding–VanderWeele formulas, thresholds and the Hammond–Horn numbers were checked against arXiv v1; 'E-value' is described as a later name absent from that version, and the code's e_value helper is explained in the prose.
  • zh and en were compared paragraph by paragraph (definitions, numbers, exercises, answers, caveats); the MDX compiles, unpublished causal topics remain inline code, aliases are case-insensitively unique and collide with no other topic, and no lint-listed stock phrase appears.

Source locations checked:

  • Causal Inference: What If (online version of 19 August 2026) — scoped · pdftotext of hernanrobins_WhatIf_19aug26.pdf; printed page = PDF page - 9. Read in full Chapter 7 pp. 91-107: p. 91 chapter opening (confounding as lack of exchangeability; holds in arbitrarily large populations) and §7.1 (structure, back-door path margin definition); p. 92 examples (healthy worker, confounding by indication, reverse causation, linkage disequilibrium, pollutants; Yule 1903 / Pearson 1899 margin); p. 93 §7.2 (exchangeability, standardisation margin formula, back-door criterion; conditional exchangeability holds iff the criterion holds only under faithfulness and a further condition, see Technical Point 7.1); p. 94 Technical Point 7.1 (criterion implies exchangeability even without faithfulness; the converse needs faithfulness and an FFRCISTG model) and the two settings (randomisation); p. 95 magnitude/direction and §7.3 Figs 7.1-7.4; p. 96 Fine Point 7.1 (signed DAGs, magnitude, Cornfield, sensitivity analyses) and confounder definition; p. 97 M-bias margin, Fig. 7.5, alternative definition; p. 98 Fine Point 7.2 and §7.4 start; p. 99 traditional definition fails; p. 100 Fine Point 7.3 (surrogate confounders), change-in-estimate abandoned, absolute vs relative; p. 101 Technical Point 7.2, §7.5; p. 102 SWIGs, §7.6; p. 103 Fine Point 7.4, g-methods vs stratification, propensity margin; p. 104 alternative methods, avoid adjusting for variables affected by treatment or outcome, noninformative critic; p. 105; p. 106 Technical Point 7.3; p. 107 Technical Point 7.4. Also p. 113 (randomisation vs post-randomisation selection). NOT read for this topic: Chapters 1-6, 9 onward.
  • Causal inference in statistics: An overview · pdftotext of R-350, journal page numbers. Read pp. 99-102 (§2.1-2.4: associational vs causal concepts; confounding listed as causal; §2.3 associational definition must fail, footnote 2 intermediate variable; §2.4 sensitivity to causal assumptions does not shrink with sample size); pp. 113-117 (§3.3, Eq. 24, §3.3.1 Definition 3 and Fig. 4, Eq. 25, irreducible sufficient sets p. 115, §3.3.2, §3.3.3 propensity-score caution p. 117); pp. 128-130 (§4.2 conditional ignorability, footnote 20). NOT read for this topic: §§3.4-3.5, 5, 6.
  • Elements of Causal Inference: Foundations and Learning Algorithms — scoped · pdftotext of the MIT Press open-access PDF, printed pages. Read §6.6 pp. 109-117: Eq. 6.7-6.10, Example 6.37 (kidney stones, ACE 0.832 - 0.782 vs conditional 0.78 - 0.83), Definition 6.38 (valid adjustment set), Definition 6.39 (confounding: p(y|do(x)) != p(y|x)), the remark that larger adjustment sets are not always better (Berkson), Remark 6.40, Proposition 6.41, Example 6.42. Licence statement on the copyright page (CC BY-NC-ND 4.0). NOT read for this topic: other chapters.
  • Sensitivity Analysis Without Assumptions (arXiv v1) — scoped · pdftotext of arXiv:1507.03984v1, PDF page numbers. Read pp. 1-2 abstract; pp. 2-4 §1 (Cornfield's three simplifying assumptions; what 'without assumptions' means); pp. 5-7 §2 definitions of RR_EU, RR_UD, Result 1 eq. (1), sharpness; pp. 7-8 worked numbers (RR 2.1); p. 9 Table 1; pp. 9-11 thresholds (RR_UD given RR_EU; equal strengths RR + sqrt(RR(RR-1)); high threshold; preventive exposures eq. (2)); pp. 12-13 §3 Cornfield conditions eqs (3)-(6); pp. 14-16 §4 Hammond-Horn RR 10.73, bounding factor 5.63, threshold 20.95. NOT read: §5 onward, eAppendix, SAS code, journal version. The term 'E-value' does not appear in this file.
  • A Crash Course in Good and Bad Controls (technical report R-493, revised March 2022) — scoped · pdftotext of R-493 (March 2022), report page numbers. Read for this topic pp. 1-5 (abstract; introduction and Angrist-Pischke quote p. 2; chains, forks, colliders, descendants p. 3; Models 1-3 p. 4; Models 4-6 p. 5), p. 6 (Figure 4 variation: adjustment both closes and opens a path, sensitivity analysis), p. 13 (sensitivity analysis paragraph), pp. 22-26 (appendix: linear Model 1 beta_yx = lambda_xy + lambda_zx lambda_zy; path-blocking rules; Definitions 1-2; Eq. 1; Model 1-5 algebra). NOT read for this topic: the R/Kaggle code, the journal version.

Related topics

No matches. Try a synonym or acronym.

0 results shown

Wrap the whole query in double quotes for a phrase match.