The confounding problem in one picture
A confounder is a variable that influences both a treatment and an outcome, creating an association between them even when the treatment has no effect at all, or distorting the size of a real effect. Ice-cream sales and drowning incidents both rise with summer temperature — the correlation between them is real, but neither causes the other.
A naive regression of an outcome on a treatment, ignoring the confounder, absorbs both the true causal path and the spurious path through the confounder into a single biased coefficient. The stronger the confounding, the further that estimate drifts from the truth.
Backdoor adjustment: blocking the spurious path
If the confounder is measured, including it as a covariate in the regression — adjusting for it — statistically holds it constant, isolating the direct relationship between treatment and outcome. This is called backdoor adjustment, and it is the simplest tool in the causal inference toolkit, alongside propensity score matching, instrumental variables, and full do-calculus for more complex causal graphs.
Adjustment is not automatic — and can backfire
Adjusting for the wrong kind of variable can introduce bias rather than remove it. A collider — a variable caused by both the treatment and the outcome — creates spurious association precisely when you condition on it. Knowing which variables belong in the adjustment set requires a causal diagram of the problem, not just which columns happen to be in the dataset.
Why this matters for production ML
Almost all production ML is trained on observational data collected under whatever policy was already in place, not a randomized experiment. Recommender systems, credit models, and hiring pipelines can all learn spurious associations baked in by confounding rather than the causal relationships they are implicitly assumed to capture — which matters enormously the moment a model's output is used to justify an action rather than just describe a pattern.
🧪 Try it yourself: the Causal Inference Lab simulation lets you experiment with everything described above directly in your browser.