Causal inference for engineers — the discipline of answering 'what happens if we act?', which prediction and correlation can't. Correlation is not causation (observing vs intervening; the three reasons correlation appears without causation — reverse causation, confounding, selection; why it's an engineering problem in A/B readouts, dashboards, and ML-driven decisions), potential outcomes (defining a causal effect as a counterfactual difference; the fundamental problem that you never observe both; targeting the average treatment effect by making groups comparable), confounding (a variable influencing both treatment and outcome — the central villain behind most spurious causal claims; confident wrong conclusions; the unmeasured-confounder nightmare; over-adjustment traps), randomized experiments (why randomization defeats all confounders at once including unknown ones; the A/B test as a genuine causal tool; the many ways real experiments fail — peeking, power, interference, broken randomization), causal graphs (DAGs that make assumptions explicit; chain/mediator, fork/confounder, collider; why controlling for everything is wrong and which variables to adjust for), observational methods (reconstructing comparable groups via adjustment, matching, and propensity scores; the unprovable 'no unmeasured confounding' assumption; sensitivity analysis), natural experiments (as-if-random variation from policies, lotteries, and cutoffs; instrumental variables, difference-in-differences, regression discontinuity), and causal inference in practice (a workflow for any causal question, how causal thinking fixes the costliest ML/analytics mistakes, and calibrated humility as the real rigor). Grounded in Wikipedia (causal inference, correlation does not imply causation, Rubin causal model, average treatment effect, confounding, randomized controlled trial, design of experiments, directed acyclic graph, propensity score matching, instrumental variables, difference in differences).
Every data-driven engineer knows the phrase "correlation is not causation," and almost everyone violates it anyway — in A/B test readouts, in metric dashboards, in ML models used to make decisions. The gap between "these move together" and "this causes that" is where enormous amounts of money and effort get wasted on changes that don't work. Causal inference is the discipline of crossing that gap rigorously, and this series builds it from first principles for people who build systems.
Everyone knows 'correlation is not causation' and violates it anyway — in A/B readouts, dashboards, and ML used to drive decisions. The real difference (observing vs intervening), the three reasons correlation appears without causation (reverse causation, confounding, selection), and why it's an engineering problem.
To reason about causation rigorously, you first need to define what a "causal effect" even is — and the answer is more subtle than it looks. The potential-outcomes framework defines it through a counterfactual: the difference between what happened and what would have happened otherwise. That single idea, and the "fundamental problem" that you can never observe both, is the foundation on which all of causal inference is built.
To reason about causation you must define a causal effect: the counterfactual difference between what happened and what would have happened otherwise. The potential-outcomes framework, the fundamental problem (you can never observe both), and why everything reduces to making treated and untreated groups comparable.
If you remember one thing about why causal conclusions go wrong, make it confounding. A confounder is a lurking variable that influences both the treatment and the outcome, manufacturing a correlation that looks causal but isn't. It's the reason observational data is so treacherous, the reason randomized experiments are the gold standard, and the single concept that explains most spurious causal claims in business, science, and ML. This post makes confounding concrete and shows why it's so hard to defeat.
A confounder influences both the treatment and the outcome, manufacturing a correlation that looks causal but isn't — the reason observational data is treacherous and experiments are the gold standard. Why it produces confident wrong conclusions, why unmeasured confounders are the nightmare, and how the field fights it.
The most reliable way to establish causation is almost embarrassingly simple: flip a coin to decide who gets the treatment. Randomization is the one technique that defeats confounding completely — including confounders you never thought of — which is why the randomized controlled trial is the gold standard of causal evidence and why the A/B test is the most powerful tool an engineer has. This post explains why randomization works its magic, and the many ways real experiments still go wrong.
The most reliable way to establish causation is almost embarrassingly simple: randomize. Why randomization defeats all confounders at once (even unknown ones), why the A/B test is a genuine causal tool, and the many ways real experiments still go wrong (peeking, power, interference, broken randomization).
Causal reasoning gets dramatically clearer when you draw it. A causal graph is a diagram of what causes what — nodes for variables, arrows for causal influence — and it turns fuzzy debates about confounding and adjustment into visual rules you can actually check. This post introduces causal graphs (DAGs) and the single most useful thing they do: tell you exactly which variables to control for, and which ones you must leave alone.
Causal reasoning gets clearer when you draw it. A causal graph (DAG) turns fuzzy debates about confounding and adjustment into visual rules: the three building blocks (chain/mediator, fork/confounder, collider) and why 'control for everything' is wrong — adjusting the wrong variable adds bias.
Often you can't run an experiment — it's unethical, infeasible, or too slow — but you still need to know whether something causes something. Observational causal inference is the set of techniques for extracting causal conclusions from data you didn't control, by reconstructing the comparable groups that randomization would have given you for free. This post covers the main tools (adjustment, matching, propensity scores) and the uncomfortable assumption they all depend on.
When you can't experiment, observational methods reconstruct the comparable groups randomization gives for free — adjustment, matching, propensity scores. All share one goal (remove confounders' influence) and one unprovable Achilles' heel: the 'no unmeasured confounding' assumption. How to use them honestly.
Sometimes you can't run an experiment, but the world runs one for you. A policy change, a lottery, an arbitrary cutoff, a quirk of timing — these can assign a "treatment" in a way that's effectively random, letting you recover experimental-grade causal evidence from observational data. Natural experiments are the most ingenious tools in causal inference, and the quasi-experimental methods built on them (instrumental variables, difference-in-differences, regression discontinuity) are how economists and data scientists establish causation when a controlled trial is impossible.
Sometimes the world runs the experiment for you — a policy change, a lottery, an arbitrary cutoff assigns treatment as-if-randomly. The three canonical designs (instrumental variables, difference-in-differences, regression discontinuity) that recover experiment-grade credibility from observational data, and their assumptions.
Causal inference isn't an academic exercise — it's the discipline that makes data-driven decisions actually work instead of merely feeling rigorous. This closing post pulls the series into practice: how to approach a real causal question, how causal thinking fixes the most common ML and analytics mistakes, and the honest judgment about what you can and can't conclude. It's the difference between knowing what correlates with success and knowing what causes it.
Causal inference is the discipline that makes data-driven decisions actually work. A practical workflow for any causal question, how causal thinking fixes the most common ML and analytics mistakes (acting on confounded correlations, using predictive features as causal levers), and the calibrated humility that is the real rigor.
This series is part of a larger body of work by Pratik Dhanave, an Agentic AI Architect writing about production AI systems, distributed systems, and cloud-native engineering. Explore all course series, browse every post, or find topics via the tag index.