Association Is Not Causation
Red sky in the morning, sailors take warning.
The old saying works surprisingly well. Weather tends to travel from west to east, so a red sunrise means the low sun in the east is lighting up clouds rolling in from the west — a weather system on its way. But if you aimed giant red floodlights at the morning sky, would a storm follow? Of course not. A red sky and rain move together; the red sky doesn't cause the rain. If you actually want rain, you have to intervene on its cause, the clouds themselves. Cloud seeding — spraying particles into clouds so water droplets form around them — is exactly that kind of intervention.
The questions we answer with data split the same way:
- Prediction: "What will happen?" For example: when a user opens the app today, which product are they most likely to buy?
- Causal (counterfactual): "What would change if I intervened?" For example: if we give users one-click checkout, will they spend more?
Prediction only needs association. Grabbing an umbrella after a red sunrise is perfectly sensible. But a question about the effect of an intervention needs causation. Shipping one-click checkout might be like floodlighting the sky, or it might be like cloud seeding — and a correlation alone can't tell you which.
- The product team turned on one-click checkout first for users who had visited often in the last 30 days. So the feature went mostly to active users.
- Average 7-day spend of users who got one-click checkout: $61
- Average 7-day spend of users who didn't: $46
- So can we say one-click checkout raised spending by $15?
This chapter is about answering that question properly.
Treatment and Potential Outcomes
We write whether unit was treated as :
A treatment can be any intervention whose effect you want to know. In our example, the treatment is "getting one-click checkout." The outcome we observe for unit is , here the user's 7-day spend.
A potential outcome is the outcome a unit would have under each treatment status:
- : the potential outcome of unit without the treatment
- : the potential outcome of the same unit with the treatment
You'll also see these written as and ; this book uses subscripts.
is what user would spend with one-click checkout, and it's defined whether or not they actually got it. If they got the feature, we observe ; if they didn't, we observe . Even when they didn't get it, still exists — we just can't see it. The outcome that actually happened is the factual outcome; the one that didn't is the counterfactual outcome.
Let's shrink the example to four users. Users 1 and 2 rarely visit, so they didn't get one-click checkout; users 3 and 4 visit often, so they did. Here is the table from a "God's-eye view" that can see every potential outcome:
| User i | Visit days (last 30) | Y₀ (no feature) | Y₁ (with feature) | T | Y (observed) | Individual effect |
|---|---|---|---|---|---|---|
| 1 | 4 | $42 | $44 | 0 | $42 | $2 |
| 2 | 6 | $50 | $50 | 0 | $50 | $0 |
| 3 | 19 | $58 | $64 | 1 | $64 | $6 |
| 4 | 17 | $56 | $58 | 1 | $58 | $2 |
In reality, this is the table we get:
| User i | Y₀ | Y₁ | T | Y |
|---|---|---|---|---|
| 1 | $42 | ? | 0 | $42 |
| 2 | $50 | ? | 0 | $50 |
| 3 | ? | $64 | 1 | $64 |
| 4 | ? | $58 | 1 | $58 |
Users who got one-click checkout (users 3 and 4) spent (64 + 58) / 2 = $61 on average; users who didn't (users 1 and 2) spent (42 + 50) / 2 = $46. These are the same numbers as in the example above.
Any one user either got the feature or didn't, so we can never see both potential outcomes, and , for the same user. This is the fundamental problem of causal inference.
Individual Effects, ATE, and ATT
The individual treatment effect is the difference between the same user's two potential outcomes:
From the God's-eye view, user 3 spent $6 more because of one-click checkout. But because of the fundamental problem, individual effects can never be known in reality. So we focus on an easier target, the average treatment effect (ATE):
Another quantity that is relatively easy to estimate is the average treatment effect on the treated (ATT): how much the feature helped the users who actually got it.
From the four-user table:
So for the users who got one-click checkout, its true effect was $4 on average.
In reality, though, we can't see the counterfactuals. So why not just subtract the control group's average from the treated group's average?
That doesn't work. The naive $15 is nearly four times the true effect (an ATT of $4). We have just committed the cardinal sin of mistaking association for causation.
Bias
Bias is what makes association differ from causation. The users who got one-click checkout were already heavier shoppers. The feature went to "users who visited often" — that is, users likely to buy even without it. They would have spent more anyway, so the group that got the feature and the group that didn't can't be compared as they are.
In potential-outcome terms, the treated group's differs from the control group's . The treated group's ("what users who got the feature would have spent without it") is a counterfactual, so we can't see it — but we can reason about it. Since the feature went to active users, we can say .
Decomposing the Bias
Association is measured by ; causation by . In the treated group we observe , and in the control group we observe , so:
Now add and subtract the counterfactual term — what the treated group would have shown without the treatment:
Rearranging and combining the expectations gives:
Let's check it with the four users. If users 3 and 4 hadn't gotten the feature, ; for users 1 and 2, who didn't get it, .
Of the $15 the naive comparison shows, only $4 is due to one-click checkout. The other $11 is selection bias: the feature went to users who would have spent more anyway.
Why It Happens, and When It Goes Away
Bias appears because many things we don't control change along with the treatment (later chapters on confounding cover this in detail). Users who got one-click checkout don't differ only in having the feature. Their whole shopping profile differs — visit frequency, purchase history, wishlist and cart behavior, favorite categories. And the targeting rule this time, visit days, is itself strongly tied to spending.
Plot visit_days on the x-axis and spend on the y-axis and you'll see an upward trend, with the users who got the feature clustered at the top right. The four-user table shows the same thing: users 3 and 4, who visit most, got the feature, and their spend without it () is also higher. So the naive comparison mixes the feature's effect (ATT) with the effect of being active in the first place (bias), and there's no way to pull them apart.
Association equals causation under this condition:
It means the treated and control groups are comparable before the treatment: users who got the feature would have spent the same as users who didn't, had they not gotten it. Then the bias term disappears:
When the condition holds, the algebra works out like this:
In other words, the difference in means is the causal effect:
If, on top of that, both groups would respond to the feature the same way — that is, also holds — then the two groups are exchangeable not only before the treatment but after it too. In that case , and:
Two Sources of Difference
The naive gap between users who got one-click checkout and users who didn't comes from two sources:
- The treatment effect: the extra spending caused by the feature ($4 in the four-user example)
- Differences other than the treatment: the part that exists because users who got the feature were more active to begin with ($11 in the four-user example)
Imagine using the God's-eye view to put every user in the "no feature" state () and then comparing the two groups. If the feature were the only difference, the groups should spend the same. In the four-user example they don't: the treated group would spend $57 and the control group $46, still $11 apart. Something other than the feature — shopping propensity — made the groups different, and that is the bias.
Randomizing Removes the Bias
Now turn on one-click checkout at random instead. Active and inactive users have the same chance of getting it, so the users who got the feature spread evenly across every level of visit days. The only thing that differs between the two groups is the feature itself, so the spending gap you observe is the average causal effect. Put every user in the "no feature" state (), and the two groups look identical.
This is why product teams ship new features as a randomized rollout — a random share of eligible users gets the feature while the rest keep the old checkout — instead of giving it to the most engaged users first. Because both groups are split at random from the same eligible population, their shopping propensity is the same, and the gap between them can be read as the feature's effect. The next chapter looks at exactly how randomization eliminates the bias term, and at the checks you should run before trusting a randomized result.
Discussion Questions
1. Find the bias in your own work
Think of one recent metric that compared "users who did A" with "users who didn't." What are the treatment and the outcome ? Is the bias term likely positive or negative, and why?
2. ATE or ATT — which one decides?
In the one-click checkout rollout, is the number we need the ATE or the ATT?
- Which value should decide whether to keep the feature on for the users who already have it?
- Which value should decide whether to roll it out to every user? (Hint: if you roll it out, the people newly getting the feature are the users who never had it.)
3. When the bias is negative
In this chapter's example the feature went to users who already spent more, so the bias was positive. Find a case where the bias is negative, so the naive comparison underestimates the effect.
- Example: a live-chat help button shown only to users whose last checkout attempt failed
4. Does an unbiased result hold everywhere?
A randomized experiment (A/B test) run during Black Friday has no bias. Can you apply its result to an ordinary week as-is?
- Something to think about: how is "free of bias" (internal validity) different from "carries over to other situations" (external validity)?