Day 48. Chains, Forks & Colliders
Every path in a DAG is built from three junctions. Chains and forks transmit association unless you condition on their middle node; colliders block it unless you do. This asymmetry drives everything in Phase 4.
- ●Classify each three-node junction on a path as a chain, fork or collider.
- ●Compute correlations in linear models by multiplying path coefficients.
- ●Prove that conditioning on a chain or fork middle removes association while conditioning on a collider (or its descendant) creates it.
- ●Recognise collider bias in hiring, hospital and birth-weight data.
Theory
Three junctions
Any path through a middle node looks like one of these:
| Name | Shape | Unconditionally | Conditioning on |
|---|---|---|---|
| Chain (mediator) | associated | association blocked | |
| Fork (confounder) | associated | association blocked | |
| Collider | independent | association created |
Conditioning on a descendant of a collider also opens it, partially.
Intuition
- Chain: job training raises skills, skills raise wages. Among workers with the same skills, training tells you nothing more about wages.
- Fork: income raises both gym membership and health. Among people with the same income, gym membership and health are unrelated (in this story).
- Collider: ability and connections both help land a job at a top firm. Among employees, a worker with weak connections must have had high ability to get in: the two become negatively related.
Linear path analysis
Take standardised variables (mean 0, variance 1) in a linear model where each arrow has a coefficient. Sewall Wright's path-tracing rule: the correlation between two variables is the sum, over all paths without colliders, of the products of the coefficients along the path.
Chain : . Fork : . Collider : .
Conditioning in the Gaussian case
For jointly normal variables, conditioning on leaves the covariance
which is what a regression of on and estimates (Frisch–Waugh–Lovell, Day 28). For the collider the first term is 0 and the second is non-zero, so conditioning creates a covariance.
Ways of "conditioning"
Conditioning happens whenever you stratify, add a variable to a regression, match on it, or select the sample on it: studying only hospital patients, only employed workers, only firms that survived, only people who answered a survey. Selection is conditioning you may not notice (Day 57).
Part 1 · Warm-up
Exercise 1 · Name the junction
In the DAG , , , , classify: (a) ; (b) ; (c) (on the path ); (d) .
Show solution
Step 1. (a) : chain.
Step 2. (b) : collider at .
Step 3. (c) : arrows run in one direction through , so a chain (read backwards).
Step 4. (d) : fork at .
Exercise 2 · A chain's correlation
Standardised variables follow . Find .
Show solution
Step 1. One path without colliders: .
Step 2. Multiply the coefficients: .
Answer: 0.30.
Exercise 3 · A fork's correlation
Standardised variables follow . Find and the correlation given .
Show solution
Step 1. One path: ; product .
Step 2. Given , the fork is blocked: partial correlation 0.
Answer: −0.28 unconditionally; 0 given .
Exercise 4 · A collider's correlation
and are independent standard normals and (no noise). Find and .
Show solution
Step 1. Unconditionally they are independent: correlation 0.
Step 2. Given , exactly.
Step 3. So is a decreasing linear function of : correlation −1.
Answer: 0 and −1. Conditioning on a collider can create the strongest possible association.
Exercise 5 · Open or blocked?
For each path, say whether it transmits association: (a) given ; (b) given nothing; (c) given a child of ; (d) given nothing.
Show solution
Step 1. (a) Chain, middle conditioned: blocked.
Step 2. (b) Collider, not conditioned: blocked.
Step 3. (c) Collider with a conditioned descendant: open.
Step 4. (d) Fork, not conditioned: open.
Part 2 · Proofs
Exercise 6 · The linear chain
Let and , with independent, mean 0. Prove and (in the partial-covariance sense).
Show solution
Step 1. Substitute: .
Step 2. , since is independent of .
Step 3. and .
Step 4. Partial covariance:
Exercise 7 · The linear fork
Let and with independent. Prove and the partial covariance given is 0.
Show solution
Step 1. .
Step 2. and .
Step 3. Partial covariance: .
Exercise 8 · Conditioning on a collider
Let be independent and with independent. Prove that the partial correlation of and given is .
Show solution
Step 1. , , .
Step 2. Partial covariance: .
Step 3. Partial variances: .
Step 4. Partial correlation:
With it is −0.5; with no noise it is −1 (Exercise 4).
Exercise 9 · Conditioning on a collider's descendant
In Exercise 8 add with independent. Prove the partial correlation of and given is .
Show solution
Step 1. , so and .
Step 2. This has exactly the form of Exercise 8 with noise variance in place of .
Step 3. So the partial correlation is .
A noisy descendant opens the collider partially: weaker, but not zero.
Exercise 10 · Regression in a chain
In the chain of Exercise 6, regress on both and . Prove that the population coefficient on is 0.
Show solution
Step 1. By Frisch–Waugh–Lovell, the coefficient on equals , where is residualised on .
Step 2. is the partial covariance of and given .
Step 3. By Exercise 6 it is 0, so the coefficient is 0. Controlling for a mediator removes the whole effect that passes through it.
Part 3 · Applied
Exercise 11 · Hiring at a top firm
Applicants' ability and family connections are independent standard normals. A firm hires when . In simulation (code below), what share is hired, and what is among employees? Explain the HR department's finding that "well-connected hires are less able".
Show solution
Step 1. Hiring is a collider: .
Step 2. Studying employees conditions on it. Among those hired, low must be offset by high to pass the threshold.
Step 3. The simulation gives about 14% hired and a correlation of about −0.68 among them (0 in the applicant pool).
Answer: the negative relation is created by selection; it says nothing about whether connections reduce ability. The firm would see the same pattern even if the two were unrelated in the population.
Exercise 12 · The birth-weight paradox
Maternal smoking (30% of mothers) and a serious birth defect (5%) are independent. Both cause low birth weight : is 0.05 (neither), 0.15 (smoking only), 0.6 (defect only), 0.7 (both). Infant mortality is ; smoking affects mortality only through birth weight. Compare mortality for babies of smokers and non-smokers (a) overall and (b) among low-birth-weight babies.
Show solution
Step 1. Overall, and .
Step 2. Overall mortality: : ; : . Smoking raises mortality.
Step 3. Among low-birth-weight babies, use Bayes: .
Step 4. .
Step 5. Mortality among low-birth-weight babies: : ; : .
Answer: among low-birth-weight babies, those of smokers die less often. Low birth weight is a collider; a small baby of a non-smoker is more likely to have a defect. Smoking is harmful overall.
Exercise 13 · Controlling for a mediator
In standardised form, job training , with no direct arrow from to . An analyst regresses wages on training "controlling for skills" and finds no effect. What is the total effect, and what went wrong?
Show solution
Step 1. Total effect of a one-sd increase in : sd of wages (path tracing).
Step 2. Skills is the middle of a chain; conditioning on it blocks the only causal path (Exercise 10).
Answer: the total effect is 0.30, but the regression with skills reports 0. Don't control for mediators when you want the total effect.
Exercise 14 · Gyms and health
In standardised form, income gym membership and health , with no arrow between and . What correlation between gym membership and health will a survey find, with and without controlling for income?
Show solution
Step 1. One open path: the fork .
Step 2. .
Step 3. Given income, the fork is blocked: partial correlation 0.
Answer: 0.20 without control, 0 with it. Here the confounder must be controlled.
Exercise 15 · Which to control?
For each study, identify the junction and say whether to condition on the middle variable: (a) effect of a cash transfer on child schooling, middle variable household consumption; (b) effect of air pollution on asthma visits, middle variable temperature (affects both); (c) effect of a new drug on recovery, studying only patients who completed follow-up, when both side effects of the drug and poor health cause dropout.
Show solution
Step 1. (a) Transfer consumption schooling: chain. Do not condition if you want the total effect.
Step 2. (b) Pollution temperature asthma: fork (confounder). Condition on temperature.
Step 3. (c) Drug dropout poor health recovery: dropout is a collider.
Step 4. Analysing completers conditions on it and opens a non-causal path from drug to recovery.
Answer: don't condition in (a) or (c); do condition in (b). For (c), analyse everyone randomised (intention to treat) with methods for missing outcomes (Day 14).
Verify in Python
import numpy as np
def pcorr(a, b, c):
"""Partial correlation of a and b given c (residualise both on c)."""
C = np.column_stack([np.ones_like(c), c])
ra = a - C @ np.linalg.lstsq(C, a, rcond=None)[0]
rb = b - C @ np.linalg.lstsq(C, b, rcond=None)[0]
return np.corrcoef(ra, rb)[0, 1]
rng = np.random.default_rng(48)
n = 1_000_000
# chain, fork and collider with standardised coefficients
Z = rng.normal(size=n); X = .5 * Z + np.sqrt(1 - .25) * rng.normal(size=n); Y = .6 * X + np.sqrt(1 - .36) * rng.normal(size=n)
print(f"chain: corr {np.corrcoef(Z, Y)[0, 1]:.3f} (0.30) given X {pcorr(Z, Y, X):.3f}")
X = rng.normal(size=n); Z = .7 * X + np.sqrt(1 - .49) * rng.normal(size=n); Y = -.4 * X + np.sqrt(1 - .16) * rng.normal(size=n)
print(f"fork: corr {np.corrcoef(Z, Y)[0, 1]:.3f} (-0.28) given X {pcorr(Z, Y, X):.3f}")
Z = rng.normal(size=n); Y = rng.normal(size=n); X = Z + Y + rng.normal(size=n); W = X + rng.normal(size=n)
print(f"collider: corr {np.corrcoef(Z, Y)[0, 1]:.3f} given X {pcorr(Z, Y, X):.3f} (-1/2) given W {pcorr(Z, Y, W):.3f} (-1/3)")
# Exercise 11: hiring
A = rng.normal(size=n); C = rng.normal(size=n); hired = A + C > 1.5
print(f"hired {hired.mean():.3f}; corr(A, C) all {np.corrcoef(A, C)[0, 1]:.3f}, hired {np.corrcoef(A[hired], C[hired])[0, 1]:.3f}")
# Exercise 12: birth-weight paradox (exact)
pL = {(0, 0): .05, (1, 0): .15, (0, 1): .6, (1, 1): .7} # key (s, d)
mort = lambda l, d: .005 + .02 * l + .10 * d
for s in (0, 1):
overall = sum((.05 if d else .95) * (pL[s, d] * mort(1, d) + (1 - pL[s, d]) * mort(0, d)) for d in (0, 1))
pd = .05 * pL[s, 1] / (.05 * pL[s, 1] + .95 * pL[s, 0])
print(f"smoker={s}: mortality overall {overall:.5f}; P(defect|LBW) {pd:.3f}; mortality | LBW {mort(1, 0) + .10 * pd:.4f}")
Key takeaways
- Chains and forks transmit association; conditioning on their middle node blocks it.
- Colliders block association; conditioning on them, or on their descendants, or selecting the sample on them, creates it.
- In linear models, correlations are sums of products of path coefficients over collider-free paths.
Simulation Lab: Selecting on the Middle Variable
Open full screen →Keep only the top of the middle variable and watch chains and forks lose their correlation while colliders gain one.
1,500 simulated people. Keep only those with the highest values of the middle variable (selection), and compare the correlation of the two outer variables in the kept group with the full population and with the partial correlation from regression. Chains and forks lose their association; colliders gain one.