AI Wiki中文/EN

Collider bias: how selecting or adjusting can create a link

碰撞变量偏差

See why looking only at cases with the same common effect makes its independent causes look related, recognise the pattern in Berkson's paradox, dropout from trials, M-shaped diagrams and adjustment for a consequence of the outcome, and learn when inverse probability weighting can repair it.

On this pageIntuitionMathematics & methodImplementationLimitationsExercisesResearch connections

A link made by looking

A collider is a variable that is caused by two other variables. If you look only at cases that share a value of the collider, its two causes can look related even when they are completely unrelated. This happens when a study selects who is in the data, and also when an analysis “controls for” the collider. p. 106 §8.1

An example makes this concrete. Imagine a programme that admits applicants whose two test scores add up to more than a cut-off. In the whole population the two scores are independent. Among those admitted, a high score on one test usually means a lower score on the other, because either score can earn a place. In our synthetic simulation the correlation is +0.0024 in everyone and −0.6150 among the admitted.

Some words used below. To “condition on” a variable means to look only within groups that share its value. Restricting a sample, splitting it into strata, or putting the variable into a regression as a control all condition on it. “Correlation” is a number from −1 to 1 that measures how closely two quantities move together.

The reasoning behind the effect is everyday logic. If you know someone was admitted and their first score is low, their second score must be high, or they would not be there. Knowing the effect and one cause tells you about the other cause. The Bayesian networks article calls this “explaining away”.

The same pattern turns up in research. Take a randomised trial in which both the drug’s side effects and being sicker make people drop out. Among those who finish, a useless drug can look protective. Adjusting for the wrong pre-treatment variable can bias a regression that was correct without it. In our dropout simulation the drug has no effect, yet the completers show a difference of −0.0954. §8.1

Hernán and Robins call this structure selection bias. Other fields use “selection bias” for different things, including confounding, so this article says “collider bias” when it means the structure. For the survey-sampling view of how samples differ from populations, see sampling bias. §8.3

The basic rule is part of the d-separation rules in causal graphs, and the two-coin illustration is in correlation and causation. The mirror-image problem, a shared cause rather than a shared effect, is confounding. Which variables are safe to adjust for is the subject of back-door adjustment.

The mechanism, its forms in studies, and its repair

This section states the collider rule, explains Berkson’s paradox and what decides the sign of the bias, then goes through selection bias, bad controls and repair by weighting.

The collider rule

On a path through a causal diagram, a collider is a node where two arrowheads meet, as in A→C←BA\rightarrow C\leftarrow B. A path with a collider is blocked unless the collider or one of its descendants is conditioned on. A descendant is anything the collider causes, directly or indirectly. Definition 1, p. 106 p. 3

A⊥ ⁣ ⁣ ⁣⊥Bbut in generalA⊥̸ ⁣ ⁣ ⁣⊥B∣Cfor A→C←BA\perp\!\!\!\perp B\quad\text{but in general}\quad A\not\perp\!\!\!\perp B\mid C\qquad\text{for } A\rightarrow C\leftarrow B

In words: if AA and BB are linked only through a common effect CC, they are independent, but within a fixed value of CC they usually are not. The symbol ⊥ ⁣ ⁣ ⁣⊥\perp\!\!\!\perp means “independent of”, and the vertical bar means “within groups that share the value of”.

Conditioning on a descendant of the collider partly opens the path, in the same way that conditioning on a descendant of a confounder partly blocks one. p. 3; pp. 22–23

Berkson’s paradox

Pearl links this rule to Berkson’s paradox, citing Berkson’s 1946 paper. Observing a common consequence of two independent causes makes them dependent. His illustration: two independent coins become dependent once we learn that at least one shows tails. p. 106 We did not read Berkson’s paper, so this article describes the paradox only as Pearl, Peters and colleagues, and Hernán and Robins present it.

Peters, Janzing and Schölkopf give a toy version. In their model, a man’s handsomeness and friendliness are independent, and whether he is in a relationship depends on both. Among men not in a relationship, the two traits become dependent. Example 6.30, pp. 104–105 They take the story from a popular book by Ellenberg, which we did not read. They also note more generally that two variables can become dependent through hidden conditioning on a third, with no causal link and no common cause between them. Remark 6.29, p. 104

Hernán and Robins note that some biases Berkson described fit the selection-bias structure. Fine Point 8.1, p. 112

What decides the sign and size

The sign is not always negative. Hernán and Robins explain that it depends on how the two causes combine. If either cause alone is enough to produce the effect, an “or” mechanism, the causes become negatively associated among those with the effect. If both are needed, an “and” mechanism, they become positively associated. A standard causal diagram does not show which mechanism holds. Fine Point 8.2, p. 123

The admission rule in our example rewards either score, so it acts like an “or” and gives a negative correlation. A different rule could give a positive one.

On size, Hernán and Robins state that a large selection bias generally needs strong associations between the collider and both treatment and outcome. They cite Greenland’s 2003 study of the size of this “collider-stratification bias” when there is no true effect. Fine Point 8.2, p. 123 We did not read Greenland’s paper.

Selection bias as collider bias

Hernán and Robins define selection bias as bias from conditioning on a common effect of two variables. One is the treatment or a cause of it; the other is the outcome or a cause of it. §8.1, p. 111 Write AA for treatment, YY for outcome and CC for selection, with C=0C=0 meaning “selected into the analysis”. The bias is a mismatch between what the selected data show and the causal effect.

Pr⁡[Y=1∣A=1,C=0]Pr⁡[Y=1∣A=0,C=0]≠Pr⁡[Ya=1=1]Pr⁡[Ya=0=1]\frac{\Pr[Y=1\mid A=1,C=0]}{\Pr[Y=1\mid A=0,C=0]}\neq\frac{\Pr[Y^{a=1}=1]}{\Pr[Y^{a=0}=1]}

In words: the risk ratio among the selected people does not equal the causal risk ratio. On the right, Ya=1Y^{a=1} is the outcome a person would have under treatment and Ya=0Y^{a=0} under no treatment; these potential outcomes are explained in causal inference.

Unlike confounding, selection bias does not need a common cause of treatment and outcome. It can occur in randomised trials as well as in observational studies. p. 109

Their first example restricts a study to fetuses that survived to birth. Death before birth is a common effect of the treatment and the outcome, so the restriction opens a path between them. Conditioning on a descendant of death does the same, for example restricting the study to parents who are not grieving. §8.1, pp. 109–110 These structures create bias even when the treatment has no effect at all. p. 110

Loss to follow-up is the version most relevant to trials. Suppose side effects of the treatment and a hidden risk factor both make people drop out. Analysing only those who stay conditions on a common effect. Among those who stay, a treated person is less likely to carry the hidden risk factor, since they stayed despite the side effects. Fig. 8.3, pp. 110–111

Many named biases share this structure. Hernán and Robins list informative censoring, missing data and nonresponse, healthy worker bias (studying only people still at work), self-selection or volunteer bias, and poorly chosen controls in case-control studies. §8.2, pp. 111–112; Fine Point 8.1

Randomisation protects against confounding but not against selection that happens after randomisation. Selection before randomisation, such as enrolling only volunteers, does not bias the comparison inside the trial. p. 113

The hazard ratio, a common summary in survival studies, has a built-in version. The hazard at a time is the risk of dying then among those still alive. So a later hazard conditions on earlier survival, which is a common effect of treatment and of a hidden trait that affects the risk of death (a “frailty”). In their example of a randomised trial, the hazard ratio is below 1 at the first time and above 1 at the second: the hazards cross, although treatment has no direct effect at the second time. Technical Point 8.1, p. 114

Terminology differs. Hernán and Robins note that statisticians and econometricians often use “selection bias” for both selection into the analysis and selection into treatment. Social scientists call unmeasured confounding “selection on unobservables”. §8.3, p. 113 Cinelli, Forney and Pearl likewise note that some economists use “selection bias” for confounding. footnote 3, p. 9

Adjustment as conditioning: bad controls

Adding a variable to a regression conditions on it. If that variable is a collider, adjustment opens a path.

M-bias. In the diagram A←U2→L←U1→YA\leftarrow U_2\rightarrow L\leftarrow U_1\rightarrow Y, with U1U_1 and U2U_2 unmeasured, the variable LL comes before treatment and is associated with both AA and YY. Yet there is no confounding. Adjusting for LL opens the path through the collider and creates bias. §7.3, pp. 95–97 Model 7, p. 5 Hernán and Robins credit the name to Greenland, after the M shape of the diagram. margin, p. 97 Cinelli, Forney and Pearl point out that this contradicts the common advice that any pre-treatment variable is a good control. p. 5

Our example uses the linear model Z=U1+U2+eZ=U_1+U_2+e, A=U1+eA=U_1+e, Y=A+U2+eY=A+U_2+e, where every ee is independent noise with variance 1 and the true effect is 1. From the model, Var⁡A=2\operatorname{Var}A=2, Var⁡Z=3\operatorname{Var}Z=3, Cov⁡(A,Y)=2\operatorname{Cov}(A,Y)=2, Cov⁡(A,Z)=1\operatorname{Cov}(A,Z)=1 and Cov⁡(Y,Z)=2\operatorname{Cov}(Y,Z)=2. The regression coefficients follow by hand.

βYA=1,βYA⋅Z=σZ2σAY−σAZσYZσA2σZ2−σAZ2=3⋅2−1⋅22⋅3−1=0.8\beta_{YA}=1,\qquad \beta_{YA\cdot Z}=\frac{\sigma_{Z}^{2}\sigma_{AY}-\sigma_{AZ}\sigma_{YZ}}{\sigma_{A}^{2}\sigma_{Z}^{2}-\sigma_{AZ}^{2}}=\frac{3\cdot 2-1\cdot 2}{2\cdot 3-1}=0.8

In words: regressing YY on AA alone gives the correct 1, while adding ZZ moves the coefficient down to 0.8. Here σ2\sigma^2 is a variance and σAY\sigma_{AY} a covariance; βYA⋅Z\beta_{YA\cdot Z} is the coefficient on AA when ZZ is also in the regression.

A variable that is both confounder and collider. Now let the middle variable also cause the treatment, as in Hernán and Robins’s Figure 7.5, or the outcome, as in Cinelli, Forney and Pearl’s variant of Model 7. Our example below has both arrows. Adjusting for the middle variable closes one back-door path and opens another. Neither choice is unbiased, and which is worse depends on the numbers. Hernán and Robins call this bias intractable unless another variable on the paths is measured. Fig. 7.5, p. 97 Cinelli, Forney and Pearl describe the analyst as “damned if you do, damned if you don’t”. p. 6; p. 27

Adjusting for a consequence of the outcome. Cinelli, Forney and Pearl show that controlling for a variable caused by the outcome biases the effect estimate. This holds even with no arrow from treatment to that variable. The reason is that the outcome is itself a collider, between the treatment and the outcome’s own other causes. They call this case-control bias. There is one exception: if the true effect is zero, the test of “no effect” stays valid. Model 18, pp. 10–11, 24

Not every post-treatment variable is bad. Take a variable caused by the treatment that opens no path, as in their Models 14 and 15. It is neutral for bias, although it can make estimates less precise. p. 9 Their summary: a good set of controls blocks every noncausal path, leaves the causal paths alone, and opens no new spurious path, for example through a collider. p. 12

Pearl warns in the same spirit that adding a covariate such as a collider can increase bias in propensity-score analyses. That runs against advice to adjust for every pre-treatment variable. §3.3.3, p. 117; footnote 20, p. 130 Peters, Janzing and Schölkopf note, citing Berkson’s paradox, that making the adjustment set as large as possible is not always a good idea. p. 113

Repair by inverse probability weighting

Selection bias can sometimes be removed by weighting. Inverse probability weighting gives each selected person a weight equal to one over their chance of being selected. §8.5, p. 117

WC=1Pr⁡[C=0∣L,A]W^{C}=\frac{1}{\Pr[C=0\mid L,A]}

In words: each person who stayed in the data counts for themselves and for the similar people, with the same LL and AA, who were not selected. LL stands for measured variables that predict selection.

This works only under conditions. Given AA and LL, selection must carry no further information about the outcome. Hernán and Robins call this exchangeability for selection; it holds when AA and LL block every back-door path between selection and outcome. Every combination of AA and LL must have some chance of being selected, which is positivity. Consistency, defined in causal inference, must also hold. pp. 118–120

Stratifying on LL can fail where weighting works. If LL is itself affected by treatment, conditioning on it blocks one path but opens A→L←U→YA\rightarrow L\leftarrow U\rightarrow Y. Fig. 8.4, p. 120

Conditioning on a collider does not always create bias. Hernán and Robins show that it always induces an association in at least one stratum. Yet in special structures, such as independent mechanisms or a multiplicative survival model, the causes stay independent within one level of the collider. §8.6, pp. 121–122; Technical Point 8.2

The size of the Berkson effect in our example

For the admission rule we can compute the exact correlation. Let T1T_1 and T2T_2 be independent standard normal scores and S=T1+T2S=T_1+T_2. Select people with S>1S>1, and let vv be the variance of SS among the selected. Then

corr⁡(T1,T2∣S>1)=v−2v+2\operatorname{corr}(T_1,T_2\mid S>1)=\frac{v-2}{v+2}

In words: the correlation among the selected depends only on how much the sum still varies after selection; the less it varies, the closer the correlation gets to −1.

The derivation is ours, using standard algebra for a truncated normal distribution; it is not from a source. The difference D=T1−T2D=T_1-T_2 is independent of SS and has variance 2. Since T1=(S+D)/2T_1=(S+D)/2 and T2=(S−D)/2T_2=(S-D)/2, among the selected the covariance is (v−2)/4(v-2)/4 and each variance is (v+2)/4(v+2)/4. For SS, which has variance 2, cut at 1: write c=1/2=0.7071c=1/\sqrt2=0.7071. The standard normal density at cc is 0.3107, and the chance of exceeding cc is 0.2398. Their ratio is λ=1.2959\lambda=1.2959. Then v=2(1+cλ−λ2)=2(1+0.9164−1.6794)=0.4739v=2(1+c\lambda-\lambda^2)=2(1+0.9164-1.6794)=0.4739, and the correlation is (0.4739−2)/(0.4739+2)=−0.6169(0.4739-2)/(0.4739+2)=-0.6169.

Four synthetic simulations

This section runs four small simulations: Berkson-type selection, dropout from a trial, M-bias with its two-sided variant, and adjustment for a consequence of the outcome. The program is an original synthetic simulation, numpy and math only, seed 1946, with 400,000 draws per part. The numbers describe toy models, not real schools, hospitals or trials. Printed values wobble around the exact ones, and the output shows both.

# Collider bias in four synthetic models (original toy simulations, not real data).
import math

import numpy as np

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


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


def pop_coef(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("Part A. Berkson-type selection: two independent traits, admission if their sum is high")
print("  T1, T2 ~ N(0,1) independent;  selected if T1 + T2 > 1")
T1 = rng.standard_normal(N)
T2 = rng.standard_normal(N)
sel = T1 + T2 > 1.0
# exact values: S = T1 + T2 ~ N(0, 2) is independent of T1 - T2; truncate S at 1
c = 1 / math.sqrt(2)
p_sel = 0.5 * (1 - math.erf(c / math.sqrt(2)))
lam = math.exp(-c * c / 2) / math.sqrt(2 * math.pi) / p_sel
v = 2 * (1 + c * lam - lam * lam)
print(f"  share selected = {sel.mean():.4f}  (exact {p_sel:.4f})")
print(f"  corr(T1, T2), everyone     = {np.corrcoef(T1, T2)[0, 1]:+.4f}  (exact +0.0000)")
print(f"  corr(T1, T2), selected only = {np.corrcoef(T1[sel], T2[sel])[0, 1]:+.4f}  (exact {(v - 2) / (v + 2):+.4f})")
print(f"  slope of T2 on T1, selected only = {ols(T2[sel], T1[sel]):+.4f}  (exact {(v - 2) / (v + 2):+.4f})")
near = np.abs(T1 + T2 - 1.0) < 0.05
print(f"  corr(T1, T2) in a thin slice T1 + T2 ~ 1 = {np.corrcoef(T1[near], T2[near])[0, 1]:+.4f}  (limit -1)")

print("\nPart B. Randomized trial, null effect, dropout depends on treatment and on a hidden risk")
print("  A ~ Bern(0.5) randomized;  U ~ Bern(0.5) hidden;  P(Y=1) = 0.2 + 0.5 U  (A has no effect)")
print("  P(stay in study) = 0.9 - 0.4 A - 0.4 U;  outcome seen only for those who stay")
A = (rng.random(N) < 0.5).astype(int)
U = (rng.random(N) < 0.5).astype(int)
Y = (rng.random(N) < 0.2 + 0.5 * U).astype(int)
stay = rng.random(N) < 0.9 - 0.4 * A - 0.4 * U
d_all = Y[A == 1].mean() - Y[A == 0].mean()
d_stay = Y[stay & (A == 1)].mean() - Y[stay & (A == 0)].mean()
exact_stay = (0.2 + 0.5 * 0.1 / 0.6) - (0.2 + 0.5 * 0.5 / 1.4)
print(f"  difference in everyone (not observable) = {d_all:+.4f}  (exact +0.0000)")
print(f"  difference among stayers                = {d_stay:+.4f}  (exact {exact_stay:+.4f})")
print(f"  P(U=1 | A, stay): A=0 {U[stay & (A == 0)].mean():.4f} (exact {0.5 / 1.4:.4f}), "
      f"A=1 {U[stay & (A == 1)].mean():.4f} (exact {0.1 / 0.6:.4f})")
dstr = [Y[stay & (A == 1) & (U == u)].mean() - Y[stay & (A == 0) & (U == u)].mean() for u in (0, 1)]
print(f"  within strata of U (if U were measured): U=0 {dstr[0]:+.4f}, U=1 {dstr[1]:+.4f}  (exact +0.0000)")

print("\nPart C. M-bias and its butterfly variant (linear, all noises N(0,1))")
print("  M:         U1 -> A, U1 -> Z <- U2, U2 -> Y;  Z := U1 + U2 + e;  A := U1 + e;  Y := 1.0 A + U2 + e")
U1 = rng.standard_normal(N)
U2 = rng.standard_normal(N)
Z = U1 + U2 + rng.standard_normal(N)
A2 = U1 + rng.standard_normal(N)
Y2 = 1.0 * A2 + U2 + rng.standard_normal(N)
# covariance of (A, Y, Z)
cM = np.array([[2.0, 2.0, 1.0], [2.0, 4.0, 2.0], [1.0, 2.0, 3.0]])
print("  true effect = 1.0000")
print(f"  Y on A     : {ols(Y2, A2):.4f}  (exact {pop_coef(cM, 1, [0]):.4f})")
print(f"  Y on A, Z  : {ols(Y2, A2, Z):.4f}  (exact {pop_coef(cM, 1, [0, 2]):.4f})")
print("  butterfly: same, plus Z -> A and Z -> Y;  A := U1 + 0.5 Z + e;  Y := 1.0 A + U2 + 0.5 Z + e")
A3 = U1 + 0.5 * Z + rng.standard_normal(N)
Y3 = 1.0 * A3 + U2 + 0.5 * Z + rng.standard_normal(N)
# exact covariances from the linear model, variables (U1, U2, Z, A, Y) as weights on independent noises
W = np.zeros((5, 5))
W[0, 0] = 1                       # U1
W[1, 1] = 1                       # U2
W[2] = W[0] + W[1]; W[2, 2] = 1   # Z
W[3] = W[0] + 0.5 * W[2]; W[3, 3] = 1          # A
W[4] = 1.0 * W[3] + W[1] + 0.5 * W[2]; W[4, 4] = 1  # Y
C = W @ W.T
cB = C[np.ix_([3, 4, 2], [3, 4, 2])]
print(f"  Y on A     : {ols(Y3, A3):.4f}  (exact {pop_coef(cB, 1, [0]):.4f})")
print(f"  Y on A, Z  : {ols(Y3, A3, Z):.4f}  (exact {pop_coef(cB, 1, [0, 2]):.4f})")
print(f"  Y on A, Z, U1 (U1 not measured in practice): {ols(Y3, A3, Z, U1):.4f}  (exact 1.0000)")

print("\nPart D. Adjusting for a consequence of the outcome")
print("  A ~ N(0,1);  Y := 1.0 A + e;  D := Y + e  (D is caused by Y only)")
A4 = rng.standard_normal(N)
Y4 = 1.0 * A4 + rng.standard_normal(N)
D4 = Y4 + rng.standard_normal(N)
print(f"  Y on A     : {ols(Y4, A4):.4f}  (exact 1.0000)")
print(f"  Y on A, D  : {ols(Y4, A4, D4):.4f}  (exact 0.5000)")
A5 = rng.standard_normal(N)
Y5 = rng.standard_normal(N)
D5 = Y5 + rng.standard_normal(N)
print(f"  same with no effect (Y := e): Y on A, D = {ols(Y5, A5, D5):+.4f}  (exact +0.0000)")

The output is:

Part A. Berkson-type selection: two independent traits, admission if their sum is high
  T1, T2 ~ N(0,1) independent;  selected if T1 + T2 > 1
  share selected = 0.2403  (exact 0.2398)
  corr(T1, T2), everyone     = +0.0024  (exact +0.0000)
  corr(T1, T2), selected only = -0.6150  (exact -0.6169)
  slope of T2 on T1, selected only = -0.6148  (exact -0.6169)
  corr(T1, T2) in a thin slice T1 + T2 ~ 1 = -0.9991  (limit -1)

Part B. Randomized trial, null effect, dropout depends on treatment and on a hidden risk
  A ~ Bern(0.5) randomized;  U ~ Bern(0.5) hidden;  P(Y=1) = 0.2 + 0.5 U  (A has no effect)
  P(stay in study) = 0.9 - 0.4 A - 0.4 U;  outcome seen only for those who stay
  difference in everyone (not observable) = -0.0019  (exact +0.0000)
  difference among stayers                = -0.0954  (exact -0.0952)
  P(U=1 | A, stay): A=0 0.3565 (exact 0.3571), A=1 0.1681 (exact 0.1667)
  within strata of U (if U were measured): U=0 -0.0009, U=1 -0.0003  (exact +0.0000)

Part C. M-bias and its butterfly variant (linear, all noises N(0,1))
  M:         U1 -> A, U1 -> Z <- U2, U2 -> Y;  Z := U1 + U2 + e;  A := U1 + e;  Y := 1.0 A + U2 + e
  true effect = 1.0000
  Y on A     : 1.0029  (exact 1.0000)
  Y on A, Z  : 0.8034  (exact 0.8000)
  butterfly: same, plus Z -> A and Z -> Y;  A := U1 + 0.5 Z + e;  Y := 1.0 A + U2 + 0.5 Z + e
  Y on A     : 1.4662  (exact 1.4667)
  Y on A, Z  : 0.8006  (exact 0.8000)
  Y on A, Z, U1 (U1 not measured in practice): 1.0002  (exact 1.0000)

Part D. Adjusting for a consequence of the outcome
  A ~ N(0,1);  Y := 1.0 A + e;  D := Y + e  (D is caused by Y only)
  Y on A     : 1.0010  (exact 1.0000)
  Y on A, D  : 0.5005  (exact 0.5000)
  same with no effect (Y := e): Y on A, D = +0.0012  (exact +0.0000)

The code’s labels use the informal word “butterfly” for the second model in Part C. None of the sources we read use that term, and this article does not rely on it. In the prose we call it the two-sided case: the middle variable is both a confounder and a collider.

Part A: Berkson-type selection

Two independent standard normal scores, admitted if their sum exceeds 1. The share admitted is 0.2403 (exact 0.2398). The correlation is +0.0024 in everyone and −0.6150 among the admitted, against the exact −0.6169 derived in the theory section. In a thin slice where the sum is almost exactly 1, the correlation is −0.9991. There, knowing one score nearly fixes the other.

Part B: dropout in a randomised trial

Treatment is assigned by a coin and has no effect. A hidden risk factor UU raises the outcome probability from 0.2 to 0.7. The chance of staying in the study is 0.9−0.4A−0.4U0.9-0.4A-0.4U: both the treatment and the risk factor make people drop out. This is the structure of Hernán and Robins’s Figure 8.3, with our own numbers.

By Bayes’ rule, among untreated stayers the share with U=1U=1 is 0.5×0.5/(0.5×0.9+0.5×0.5)=0.25/0.70=0.35710.5\times0.5/(0.5\times0.9+0.5\times0.5)=0.25/0.70=0.3571. Among treated stayers it is 0.5×0.1/(0.5×0.5+0.5×0.1)=0.05/0.30=0.16670.5\times0.1/(0.5\times0.5+0.5\times0.1)=0.05/0.30=0.1667. The outcome rates are 0.2+0.5×0.3571=0.37860.2+0.5\times0.3571=0.3786 and 0.2+0.5×0.1667=0.28330.2+0.5\times0.1667=0.2833. Their difference is −0.0952.

The simulation prints −0.0019 for everyone, which no one could observe, and −0.0954 among stayers. The shares with U=1U=1 are 0.3565 and 0.1681. The drug “looks protective” by about 9.5 percentage points only because treated completers are healthier. Within each level of UU the differences are −0.0009 and −0.0003, near zero, which shows that the bias runs through UU.

Part C: M-bias and the two-sided case

In the M-shaped model the regression of YY on AA alone gives 1.0029 (exact 1). Adding ZZ gives 0.8034, close to the exact 0.8 computed by hand above. Here not adjusting is right.

In the two-sided case, ZZ also causes AA and YY with weight 0.5. Now leaving ZZ out gives 1.4662 (exact 1.4667): confounding through ZZ adds +0.47. Adding ZZ gives 0.8006 (exact 0.8): collider bias through U1U_1 and U2U_2 subtracts 0.20. Only also adding U1U_1, which a real study would not have, gives 1.0002. This matches Hernán and Robins’s point that the bias can be removed only if another variable on the paths is measured. p. 97 The exact values come from the model’s covariance matrix, computed in the code.

Part D: adjusting for a consequence of the outcome

The treatment AA causes YY with weight 1, and DD is a noisy copy of YY. Regressing YY on AA gives 1.0010. Adding DD halves it to 0.5005. The exact value follows from one step: given AA and DD, the best guess of YY is (A+D)/2(A+D)/2, so the coefficient on AA is 0.5. When the true effect is zero, the coefficient with DD included is +0.0012, close to zero, so the test of “no effect” survives, as Cinelli, Forney and Pearl say. p. 11

Limits and common misreadings

This section lists what the collider idea does not say and what this article could not check.

The sign is not fixed. “Or” mechanisms give negative associations and “and” mechanisms give positive ones. Fine Point 8.2, p. 123 Our Part A gives a negative correlation only because of its rule.

Not every collider conditioning biases. Some structures leave the causes independent within a level of the collider. §8.6 Some post-treatment variables are neutral. p. 9 Adjusting for a descendant of the outcome still gives a valid test of no effect. p. 11

Time order is not the test. Rules such as “adjust for everything before treatment” or “never adjust for anything after it” both fail. The M-shaped diagram is a pre-treatment counterexample to the first. A neutral post-treatment variable is a counterexample to the second. What matters is the diagram. p. 12 §3.3.3, p. 117

Repairs need assumptions. Inverse probability weighting needs exchangeability for selection, positivity and consistency, and none of them can be fully checked from the selected data. pp. 118–120 In the two-sided case, no adjustment set without another measured variable removes the bias. p. 97

Applied stories are hypotheses. Cinelli, Forney and Pearl suggest collider bias as a plausible explanation for several published puzzles. Among them are the birth-weight paradox, the “antebellum puzzle” in historical height records and the “obesity paradox”. pp. 11–12 These are offered as possible explanations, not settled findings, and we did not read the underlying studies.

Berkson’s original paper was not read. We describe Berkson’s paradox only as presented by Pearl, by Peters and colleagues, and by Hernán and Robins. No story or number here comes from Berkson’s 1946 paper.

The example is a toy. All four models are synthetic, with chosen numbers and known truth. The size of collider bias in real data depends on how strongly selection depends on each cause, which a toy cannot tell you.

Exercises

These exercises cover recognising a collider, a hand calculation, counterexamples to time-order rules, judging a published claim and choosing a repair.

  1. A dating app shows only profiles whose combined score for looks and humour is high enough. Users notice that the funniest profiles they see tend to be less attractive. Explain with a diagram why this pattern says nothing about people in general.

    Answer: Looks → shown ← humour: being shown is a collider. In the whole population the traits can be independent. Conditioning on “shown” opens the path. Because either trait can earn a place, an “or”-type rule, the traits become negatively associated among the profiles shown (Hernán and Robins, Fine Point 8.2; Pearl, p. 106; Peters and colleagues, Example 6.30). Part A shows the size for a sum-threshold rule: correlation near 0 overall and −0.615 among the selected.

  2. Use Part B: P(U=1)=0.5P(U=1)=0.5, P(Y=1)=0.2+0.5UP(Y=1)=0.2+0.5U, P(stay∣A,U)=0.9−0.4A−0.4UP(\text{stay}\mid A,U)=0.9-0.4A-0.4U. Compute the outcome rate among stayers for A=0A=0 and A=1A=1 and the difference.

    Answer: For A=0A=0 the staying chances are 0.9 for U=0U=0 and 0.5 for U=1U=1, so P(U=1∣A=0,stay)=0.25/0.70=0.3571P(U=1\mid A=0,\text{stay})=0.25/0.70=0.3571 and the outcome rate is 0.2+0.5×0.3571=0.37860.2+0.5\times0.3571=0.3786. For A=1A=1 they are 0.5 and 0.1, so P(U=1∣A=1,stay)=0.05/0.30=0.1667P(U=1\mid A=1,\text{stay})=0.05/0.30=0.1667 and the rate is 0.2+0.0833=0.28330.2+0.0833=0.2833. The difference is −0.0952, although the true effect is 0. The simulation prints −0.0954.

  3. Give one counterexample from this article to each rule: “always adjust for everything measured before treatment” and “never adjust for anything measured after treatment”.

    Answer: (a) Before treatment but harmful: in the M-shaped diagram ZZ comes before treatment. Yet adjusting for it moves the coefficient from 1.0 to 0.8 (Part C; Hernán and Robins, Fig. 7.4; Cinelli and colleagues, Model 7). (b) After treatment but harmless for bias: a variable caused by treatment that opens no path (Models 14–15, p. 9). A descendant of the outcome biases the estimate when there is an effect (Part D: 0.5 instead of 1). Yet it still gives a valid test of no effect (null row +0.0012; p. 11). What matters is the diagram, not the time order.

  4. A hypothetical study of hospital patients finds that, among people admitted, disease X and disease Y are negatively associated. It concludes that X protects against Y. What must you know before believing it?

    Answer: Whether admission depends on both diseases. If either disease raises the chance of admission, admission is a collider, and selection alone can produce the negative association. This is the structure Pearl and Hernán and Robins connect with Berkson (Pearl, p. 106; Fine Point 8.1). You would need data on people regardless of admission, or a model of admission given both diseases that allows reweighting. Weighting needs the selection probabilities and exchangeability for selection (pp. 117–120). The sign and size depend on how the two diseases combine to cause admission (p. 123).

  5. A randomised trial loses 30% of participants. Dropout depends on side effects of the treatment and on baseline symptoms LL that also predict the outcome. (a) What bias threatens the completers-only analysis? (b) Can stratifying on LL fix it? (c) What would you do instead?

    Answer: (a) Selection bias from conditioning on the collider “stayed”, which is caused by treatment and by LL, while LL is linked to the outcome (Hernán and Robins, Fig. 8.3). Randomisation does not protect against selection after randomisation (p. 113). (b) If LL is measured at baseline and not affected by treatment, stratifying on LL blocks the path through dropout and gives effects within levels of LL (p. 120). If LL is affected by treatment, as with symptoms after starting the drug (Fig. 8.4), stratifying opens A→L←U→YA\rightarrow L\leftarrow U\rightarrow Y and fails. (c) Inverse probability weighting by 1/Pr⁡[C=0∣A,L]1/\Pr[C=0\mid A,L]. This assumes that AA and LL explain the link between dropout and outcome and that every group has some chance of staying (pp. 117–120). Report the result as resting on those untestable conditions.

History and further reading

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

The rule that conditioning on a common effect makes its causes dependent is part of Pearl’s d-separation criterion. Pearl connects it with Berkson’s 1946 paper on what is now called Berkson’s paradox. p. 106 Hernán and Robins credit the name “M-bias” to Greenland in 2003 and cite the same paper on the size of “collider-stratification bias”. pp. 97, 123 Hernán and Robins base their general definition of selection bias on a 2004 paper by Hernán, Hernández-Díaz and Robins. margin, p. 111 We read none of these older papers directly.

For a full treatment, Chapter 8 of Hernán and Robins covers selection bias, including a worked numerical example with their own data and the conditions for weighting. Chapter 8 Cinelli, Forney and Pearl’s “crash course” catalogues good, bad and neutral controls with small diagrams and linear formulas. pp. 1–14, 22–28 Peters, Janzing and Schölkopf give a compact treatment of Berkson’s paradox in structural causal models. pp. 104–105 The rule itself, with the rest of d-separation, is taught in causal graphs.

Make a prediction, then check

In a randomised trial the drug has no effect on the outcome. Side effects make treated people more likely to drop out, and an unmeasured high-risk factor also makes people drop out and raises the risk of a bad outcome. What happens if only completers are analysed?

Choose one answer

Learning objectives

  • Explain why conditioning on a collider (or a descendant of one) makes independent causes dependent, and recognise the same structure behind Berkson's paradox, loss to follow-up, nonresponse and healthy worker bias.
  • Decide whether pre- and post-treatment variables may be adjusted for (M-bias, a variable that is both confounder and collider, descendants of the outcome), compute by hand the bias that dropout creates in a randomised trial, and state the conditions IP weighting needs to repair it.

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. A Crash Course in Good and Bad Controls (technical report R-493, revised March 2022) — scoped
    Carlos Cinelli; Andrew Forney; Judea Pearl · 2022
  4. Elements of Causal Inference: Foundations and Learning Algorithms — scoped
    Jonas Peters; Dominik Janzing; Bernhard Schölkopf · 2017

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 in the prose matches. I re-derived the truncated-normal correlation step by step (c = 0.7071, density 0.3107, tail 0.2398, lambda 1.2959, v = 0.4739, correlation -0.6169; our own derivation, labelled as such), the M-bias coefficient 0.8, the two-sided-case values 1.4667 and 0.8 from the covariance matrix, the Bayes-rule dropout numbers (0.3571, 0.1667, -0.0952) and the Part D coefficient 0.5. I downloaded the sources myself and re-read Hernán & Robins (19 August 2026 PDF) pp. 95-98 and Chapter 8 pp. 109-123, including Technical Point 8.1 (hazard ratios), the IP-weighting conditions on pp. 117-120, §8.6 and Fine Points 8.1-8.2; Pearl 2009 p. 106 (Berkson's paradox, two coins) and footnote 20 on p. 130; Peters, Janzing & Schölkopf pp. 104-105 and 113; and Cinelli, Forney & Pearl pp. 3, 5-6, 9-13, 22-24 and 27. I compared zh and en paragraph by paragraph, checked equations, source IDs, anchors, MDX compilation, links (unpublished causal topics stay inline code; bayesian-networks and sampling-bias are published), 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: Berkson 1946, Greenland 2003, the applied studies Cinelli et al. cite, and the journal version of Cinelli et al.; the article describes these only second-hand and says so.

  • The example was rerun with the pinned interpreter and matches example.stdout.txt exactly; each step of the truncated-normal correlation −0.6169, the M-bias 0.8, the two-sided values 1.4667 and 0.8, and the Bayes-rule dropout numbers were re-derived.
  • Berkson's paradox is described only via Pearl p. 106, Peters et al. pp. 104–105 and Hernán and Robins Fine Point 8.1; the hospital exercise is labelled hypothetical; 'butterfly' appears only in code and output, with a note that it is informal, and the prose says 'two-sided case'.
  • Crossing hazards (Technical Point 8.1), the three IP-weighting conditions (pp. 118–120), the stratification counterexample (Fig. 8.4) and Cinelli et al.'s applied cases (as possible explanations) were checked against the pages.
  • zh and en were compared paragraph by paragraph (definitions, numbers, exercises, answers, caveats); the MDX compiles, 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. For this topic: pp. 95-98 (Fig. 7.4 M-structure, adjustment for L biased, M-bias margin crediting Greenland 2003, Fig. 7.5 intractable, collider is path-specific margin, alternative definition of confounding); p. 104 (avoid adjusting for variables affected by treatment or outcome); Chapter 8 pp. 109-123: p. 109 opening and §8.1 Fig. 8.1; p. 110 Fig. 8.2, selection bias under the null, Fig. 8.3 intuition; p. 111 general definition (margin, Hernán, Hernández-Díaz & Robins 2004), Figs 8.5-8.6 M-bias, §8.2 list; p. 112 Fine Point 8.1 (case-control; Berkson 1946 mentioned), self-selection; p. 113 randomisation vs post-randomisation selection, §8.3 terminology; p. 114 Technical Point 8.1 hazard ratios, firefighters; p. 115 Simpson margin, magnitude; pp. 115-116 wasabi 0.89; p. 117 §8.5 IP weight W^C; pp. 118-120 conditions and the stratification counterexample (Fig. 8.4); pp. 121-122 §8.6 and Technical Point 8.2; p. 123 Fine Point 8.2 (or/and mechanisms, magnitude, Greenland 2003). NOT read: Chapter 9 onward; Greenland 2003 and Berkson 1946 themselves.
  • Causal inference in statistics: An overview · pdftotext of R-350, journal page numbers. For this topic: p. 106 (Definition 1 d-separation; collider handling; Berkson's paradox (Berkson, 1946); two-coin example); pp. 114-115 (Definition 3; the set {Z3} opens the path through the collider Z3); p. 117 (§3.3.3 conditioning on as many pre-treatment measurements as possible should be approached with caution); p. 130 footnote 20. NOT read: Berkson 1946.
  • 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. For this topic: p. 3 (colliders; controlling for a descendant partially controls); p. 5 (Model 7 M-bias); p. 6 (variation of Model 7, 'damned if you do, damned if you don't'); p. 9 (Models 14-15 neutral; footnote 3 on economists' 'selection bias'); p. 10 (Models 16-17 selection bias, Model 18 case-control bias); p. 11 (null exception; birth-weight paradox; homophily; antebellum puzzle start); p. 12 (antebellum end; COVID-19 and obesity-paradox mentions; multiple controls conditions (i)-(iii); software); pp. 13-14 (beyond adjustment; sensitivity; concluding remarks); pp. 22-24 (path rules, virtual colliders and Model 18); p. 27 (Model 7 and its variation, linear formulas); p. 28 (Model 10 bias amplification formula). NOT read: the cited applied papers, the R/Kaggle code, the journal version.
  • Elements of Causal Inference: Foundations and Learning Algorithms — scoped · pdftotext of the MIT Press open-access PDF, printed pages. For this topic: p. 104 (Proposition/Reichenbach discussion end; Remark 6.29 selection bias); pp. 104-105 (Example 6.30 Berkson's paradox, SCM H := N_H, F := N_F, R := min(H,F) xor N_R with N_R ~ Ber(0.1); F not independent of H given R = 0); p. 113 (larger adjustment sets not always better, Berkson). NOT read for this topic: Ellenberg 2014, Berkson 1946, other chapters.

Related topics

No matches. Try a synonym or acronym.

0 results shown

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