Guide · foundations
Confounders, colliders and mediators
“Control for everything you have” is the single most expensive piece of folk statistics in circulation. A variable's position decides whether adjusting for it removes bias, creates bias, or answers a different question — and the three positions are indistinguishable from the correlations alone.
The three shapes
Same three variables, three different worlds
In all three, X is what you might change, Y is what you
care about, and Z is the variable you are deciding whether to put in the
model. The arrows are different, and that is the whole difference.
Confounder — adjust
Z causes both. It creates a correlation between
X and Y that is not an effect of X.
Staff numbers and patient outcomes: sicker wards get more staff. Leave severity out and staffing looks harmful.
Collider — do not
Both cause Z. X and Y
start out unrelated; conditioning on Z makes them related.
Admission to a study requires being either very ill or very rich. Among those admitted, wealth predicts health — in the world, it did not.
Mediator — it depends
X acts through Z. Adjusting
for it removes the part of the effect you probably wanted.
Filters reduce illness by improving water quality. Adjust for water quality and the filter's effect vanishes — correctly, and uselessly.
Why you cannot tell them apart from the data
All three shapes above produce correlations among
X, Y and Z. The confounder and the mediator
can produce identical joint distributions. Which one you are in is a claim
about what causes what — knowledge from outside the dataset — which is exactly what
a causal graph is for writing down.
The collider deserves its own section
Adjusting can create the bias it was meant to remove
The confounder story is well known. The collider one is not, and it is worse, because the fix people reach for is the thing that causes it.
Suppose two entirely unrelated things — say, a candidate's technical skill and their interviewing skill — both help you get hired. Among people who were hired, the two become negatively correlated: someone who got in with weak interviewing must have been technically strong, and vice versa. Look only at employees and you will discover that technical skill hurts interview performance. It does not. You conditioned on the thing they both cause.
This is why “I put in every variable I had” is not a conservative choice. Every variable you had includes the ones caused by the treatment and the ones that decided who is in the sample at all. Each of those turns a clean comparison into a contaminated one, silently.
Selection is a collider you did not choose
If being in the dataset at all depends on both the treatment and the outcome — survey responders, surviving customers, patients who came back — you have conditioned on a collider before writing a line of code. The education example works one of these end to end.
The rule that actually works
Never adjust for anything caused by the
treatment. Beyond that, do not pick the adjustment set by hand at all — write
the graph, and let identification derive
a licensed set from it. On the identify page axiom
names that set as Z before
anything is fitted.
Summary
The table to keep
X ← Z → Y · a common cause. Leaving it out biases
the estimate; adjusting removes the bias.
adjust
X → Z ← Y · a common effect. Adjusting
creates a correlation that was not there.
never
X → Z → Y · on the path. Adjusting gives the
direct effect only — a different, valid quantity that is usually not the one the
decision needs.
depends
Z → X → Y, with no other route to Y
· a lever on the treatment. Not adjusted for — used, as a
separate route when the back door is
shut.
use