
Defining Causation
Conditional counterfactuals and average treatment effects
- counterfactual world
- causation between events
- causation between random variables
- outcome variable and treatment variable
- potential outcomes
- (individual) treatment effect
- average treatment effect
- difference in sample means
Intro: a spider web of causes
What does it mean to say that “A causes B”?
We speak of causes and effects all the time, even though the language we use varies widely. “I took an aspirin and my headache got better” implies that taking the aspirin is what caused your headache to get better. “She was able to find a good job because she graduated from Berkeley” is more direct: graduating from Berkeley was the cause of her being able to find a good job.
Identifying a causal statement is one thing, but we’re still left the conundrum: what definition can we use to be precise about the meaning of a causal statement?
You don’t believe that’s a big deal, right?
Try yourself.
Try to create a definition of causation that is not just a tautology, i.e. that does not just go back on itself and try to define causation by using causation.
Alas! Our human intuition for causation is not enough, unfortunately!
Let’s see what your intuition tells you about what is a cause and what is not a cause. Which causes do you identify in the following scenario?
Suppose there is Stat 20 class tomorrow. The professor has prepared the warmup for the reader. The Reader will print the warmup sheets. The 3 Tutors will be handing out the sheets to the people who come in on time, as long as they were printed.
Now, imagine you are in class and have a warmup sheet in your hands. (Call this event “S”)
What caused you to have the warmup sheet in your hands?
“P”: The Professor preparing the sheet.
“R”: The Reader printing the sheets.
“T1”: Tutor 1 handing out the sheets.
“T2”: Tutor 2 handing out the sheets.
“T3”: Tutor 3 handing out the sheets.
“C”: You coming to class on time.
As you ponder where to draw the line to determine which of these events are the cause of you holding the sheet, you are working out your own internal definition of causation. Keep your answers in mind: we will discuss this example in class. For now, though, let’s introduce the most widely used definitions of cause and effect.
Causation in Statistics: The Conditional Counterfactual
One of the earliest articulations of what it means to be a cause, in the way we use it in Statistics, can be found in the writing of Thucydides, the ancient Greek historian. It comes at the end of a passage where he describes a village called Orobiae, which experienced an earthquake followed by a tsunami.
About the same time that these earthquakes were so common, the sea at Orobiae, in Euboea, retiring from the then line of coast, returned in a huge wave and invaded part of the town, and retreated leaving some of it still under water; so that what was once land is now sea…
The cause, in my opinion of this phenomenon must be sought in the earthquake. At the point where its shock has been the most violent, the sea is driven back, and suddenly recoiling with redoubled force, causes the inundation.
Without the earthquake, I do not see how such an accident could happen.
In the final line, Thucydides makes a leap: he imagines a world where the earthquake didn’t happen, and can’t imagine the tsunami happening. This, for him, is what makes the earthquake the cause of the tsunami. This form of reasoning about causation was summarized centuries later by the Scottish philosopher David Hume, who characterized a cause as a scenario in which “If the first object had not been, the second never had existed.”
Both of these thoughts rely upon imagining a world that was different from the one that was observed, a notion in logic called a counterfactual.
Other fields disagree with this definition…
In Analytical Philosophy for example there are certainly approaches that are skeptical that causation even exists as a real thing or a helpful concept. Hume definitely was skeptical of causality and even the author of this notes generally agrees with this and considers counterfactuals meaningless
Theoretical Physics also has a generally very different approach to causation. In Physics pretty much anything that could cause something else (based on space-time connectedness) is considered a cause of it. The past causes the future in Physics. Theoretical physicists tend to de-emphasize causation as a different thing from prediction.
But I digress, and gave only a very small taste of a very vast and complex debate.
The following is the core of how Statistics and the Social Sciences think about causation.
def: Counterfactual
A hypothetical alternative universe where a certain event, that happened in our actual universe, didn’t happen. (Or vice versa).
This notion is the core component of the most widely used definition of a cause: the conditional counterfactual definition.
def: Causation between events
We say that event \(A\) causes event \(B\) if, in a world where \(A\) didn’t happen, \(B\) wouldn’t happen either.
Using this definition of causation, let’s revisit two examples from above.
Consider the claim, “I took an aspirin and my headache got better”.
Using the conditional counterfactual definition, what would you need to know to determine if the aspirin caused the headache to improve?
Check your answer
You would need to know that, if they hadn’t taken an aspirin, their headache wouldn’t have gotten better.
Consider the claim, “She was able to find a good job because she graduated from Berkeley”.
Using the conditional counterfactual definition, what would you need to know to determine if graduating from Berkeley caused her to find a good job?
Check your answer
You would need to know that, if she hadn’t graduated from Berkeley, she wouldn’t have been able to find a good job.
These scenarios are way way too simplistic, however. Good for understanding the general idea, but bad for most applications. For example, they do not cover the situation where a variable (e.g. amount of time studied) only increases your chances of observing a value of another variable (e.g. final score in the class).
So let’s come to a better definition of causation for the Social Sciences
Causation between variables
def: Causation between two variables
We say that random variable \(D\) (treatment variable or explanatory variable) causes random variable \(Y\) (outcome variable or response variable) if, in a counterfactual universe where the value of \(D\) is different, then the probability distribution of \(Y\) is different.
Better yet, we should say that \(Y\) is causally dependent on \(D\).
E.g. Aspirin again
- \(D\) = they take the aspirin or not (discrete, binary, 1 or 0)
- \(Y\) = how long until the headache goes away (continuous)
In a world where I take the aspirin, \(D = 1\), I expect the headache to go away in 43 minutes \(E(Y) = 43\) minutes
In a world where I don’t take the aspirin, \(D = 0\), I expect the headache to go away in 318 minutes \(E(Y) = 318\) minutes
The distribution of \(Y\) changed between the two worlds where you took the aspirin and didn’t (the expectation went down), therefore \(D\) caused \(Y\).
E.g. Studying for Stat 20
- \(D =\) amount of time studied per day (continuous)
- \(Y =\) letter grade at the end of the semester (categorical ordinal)
In a world where I study \(D = 23\) minutes per day, I have a 35% chance of geting an “A” or higher, i.e. \(\mbox{Prob}(Y \geq \mbox{"A"}) = 0.35\).
In a different world, where I study \(D = 38\) minutes per day, I have a 52% chance of geting an “A” or higher, i.e. \(\mbox{Prob}(Y \geq \mbox{"A"}) = 0.52\).

The distribution of \(Y\) changed between the two worlds where you studied for 23 vs. 38 minutes per day (the probability of “A” or higher went up), therefore \(D\) caused \(Y\).
Let’s introduce some more language then.
The language of causation: Potential Outcomes and Treatment Effect
def: Potential Outcomes
Given an outcome variable \(Y\) and a treatment variable \(D\), we define
\[Y(d) \mbox{ or } Y(D=d)\]
as the value of \(Y\) in a (counterfactual) world where we set the value of \(D\) equal to \(d\).
If the treatment variable is binary, as in most cases, taking just two values, \(D=0\) (control) and \(D=1\) (treatment), then we use this notation:
\[Y(0) \mbox{ or } Y(D=0) \mbox{ or } Y_c\] The potential outcome in control conditions. \[Y(1) \mbox{ or } Y(D=1) \mbox{ or } Y_t\] The potential outcome in treatment conditions.
Think about what we just did. We are pretending that, for every data point (\(Y_c\)) you could observe under control (\(D=0\)), there would be an imaginary unobserved evil-twin data point (\(Y_t\)) that happened under all the same exact circumstances except for having a different value of the treatment variable (\(D=1\)), and vice versa.
E.g.
- \(Y_c\) = Amount of water I drank after I, the author of these notes, got home at 3:15pm on 11/02/2026, took off my shoes in the hallway and sneezed, walked up the stairs, poured 246 g of water in a plastic cup.
- \(Y_t\) = Amount of water I drank after I, the author of these notes, got home at 3:15pm on 11/02/2026, took off my shoes in the hallway and sneezed, walked up the stairs, poured 246 g of water in a glass.
- \(D\) = Type of container I poured the water in. (Glass or plastic cup, binary)
Now we’re ready to finally define the effect of taking the treatment vs. not taking it.
def: (Individual) Treatment Effect
Given an outcome variable \(Y\) and a treatment variable \(D\), for simplicity taking just two values \(D=0\) (control) and \(D=1\) (treatment), We define the (individual) treatment effect as:
\[ \mbox{(I)TE} \mbox{ or } \delta \equiv Y(1) - Y(0) \mbox{ or } Y_t - Y_c \]
Okay, no big surprises so far. The effect of taking the treatment is the difference between what would happen if you took the treatment and what would happen if you took the control.
Wait a minute…
A new type of impossible task
A shiver goes down our spines. How are we gonna do that?
The conditional counterfactual definition of causation feels about right in an abstract sense, but it is challenging when you start to think through what sort of data you could collect as evidence of causation. In the second example, we have data on the after-graduation salary (the outcome variable) and that she went to Berkeley (the treatment variable), but the counterfactual - that remains purely theoretical.
Poor us! This is a God-level power, we would need! It’s even more impossible than in the Generalization unit, when we didn’t have access to the entire population, or in the Prediction unit, when we didn’t know the future.
In an idealized world, to demonstrate that graduating from Cal caused Evelyn to have a higher salary, you would have to observe this data frame1.
| Student Name | Went to Cal | Salary ($) |
|---|---|---|
| Evelyn Fix | yes | 150000 |
| Evelyn Fix | no | 112000 |
In this idealized data frame, the two rows are both observations of the same person, making the decision to go to Cal at exactly the same time and situation of their lives, so they have the same values of every possible other variable: work experience, GPA, letters of recommendation, health, etc. The only difference is one of them went to Cal and the other (from the counterfactual world) did not. Because they differed on their outcome variable (salary after graduation), this would mean that going to Cal caused Evelyn to get a higher-paying job.
We can reshape the dataframe as follows:
| Student Name | Salary if went to Cal (\(Y_t\)) | Salary if didn't go to Cal (\(Y_c\)) |
|---|---|---|
| Evelyn Fix | 150000 | 112000 |
The “challenge” (to use a euphemism) is that we only ever get to observe one of the two rows above. Said another way, there are two potential outcomes for this scenario. One was observed (the job outcome after going to Cal) and the other was not (the job outcome without going to Cal).
| Student Name | Salary if went to Cal (\(Y_t\)) | Salary if didn't go to Cal (\(Y_c\)) |
|---|---|---|
| Evelyn Fix | 150000 | not observed! |
Example: GPS routing
If you’ve ever used a GPS navigation app, you’re already accustomed to thinking in terms of potential outcomes. Here is the guidance Google Maps provides to travel from Pimentel Hall at Cal to downtown Oakland by car.

Each one of the three paths is a potential route I could take and each of those times are the app’s predictions for what the potential outcomes will be. Importantly, though, these are just predictions, not data. To collect data, I have to select one of these routes to drive, then I could record data on the time it took me. If I choose the blue path and it ends up taking me 16 minutes, I’ll never know for sure that it was my choice of the blue route that led to this apparently short drive time. To know that, I’d have to rewind the clock and, in a different world, decide to take one of the gray routes and observe a drive time that is more than 16 minutes.
While our definition of causation prevents us from ever making completely airtight conclusions about cause and effect in scenarios like these, over the years, scientists and statisticians have crafted many clever strategies for working around these constraints to build convincing causal claims.
From individual-level claims to population-level claims
Our desperate inability to observe both counterfactuals (both potential outcomes) and the randomness in each datapoint (after all maybe Evelyn got the higher paying job in treatment completely by luck) pushes us to slightly change our target to something less ambitious.
Let’s take the stairs down slowly:
- Going to Cal would make Evelyn get a higher-paying job. (Individual-level predictive causal claim)
- Going to Cal would increase Evelyn’s salary expectation for her job. (Individual-level generalization causal claim)
- Going to Cal would increase people’s salary expectation for their job. (Population-level generalization causal claim)
The first is a strong statement about a single individual, Evelyn and their future observed salary. It’s an individual causal prediction. Very very ambitious. The second is still individual but it’s generalized to Evelyn’s salary variable distribution instead of claiming to be able to predict the outcome. It’s an individual causal generalization. Still very ambitious. The third is a much more general statement that creates expectations for a “generic” individual in a population, in the hopes that it can be helpful advice for everyone in that population. It’s a population-level causal generalization.
Have you ever been worried that population-level causal statements didn’t apply to you?
For example, what if you’re allergic to a specific medicine that helps people on average?
Other examples?
Population-level causation is the focus of many sciences, which aim to make general claims about the causal mechanisms of the world. The goal is to estimate the (population) average treatment effect.
def: Average Treatment Effect
Given a population, the average treatment effect is the population expectation of the individual treatment effect:
\[ \mbox{ATE} \mbox{ or } \tau \equiv E(Y_t - Y_c) \mbox{ or } \mu_{Y_t - Y_c} \]
You will have recognized the notorious population/distribution expectation \(E()\). Yes: on top of the new challenges with counterfactuals, we will still be facing our traditional enemy: generalization! We’ll fight it with the traditional methods: confidence intervals, hypothesis testing, and the like.
I’ll repeat that, because you didn’t believe me. Solving a causal problem will also involve creating a confidence interval for a population parameter (the \(\mbox{ATE}\)) or conducting a hypothesis test for that (e.g. \(H_0: \mbox{ATE} =0\)).
E.g. Average Treatment Effect on Salary from going to Cal
Imagine the following population and its potential outcomes
| Student Name | Salary if went to Cal (\(Y_t\)) | Salary if didn't go to Cal (\(Y_c\)) |
|---|---|---|
| Evelyn Fix | 150000 | 115000 |
| Yiwen Lin | 135000 | 141000 |
| ... | ... | ... |
| Owen Brooks | 132000 | 125000 |
| Maya Singh | 145000 | 118000 |
from which we mutate and select, then summarize:
| Student Name | Treatment Effect (\(Y_t - Y_c\)) |
|---|---|
| Evelyn Fix | 35000 |
| Yiwen Lin | -6000 |
| ... | ... |
| Owen Brooks | 7000 |
| Maya Singh | 27000 |
| Average Treatment Effect (\(E(Y_t - Y_c)\)) |
|---|
| 7950 |
So, it looks like on average it’s beneficial for your future salary to graduate from Cal rather than not.
How to estimate the ATE from data?
Eh but again:
1. we only observe one of the two potential outcomes for each individual
2. we only observe a sample, not the entire population
Actual data will look like this:
| Student Name | Went to Cal? (D) | Salary (Y) |
|---|---|---|
| Evelyn Fix | 1 | 150000 |
| Nikhil Kote | 1 | 105500 |
| Sofia Chen | 0 | 120000 |
| Amara Patel | 0 | 108000 |
| Isabella Cruz | 1 | 112000 |
| Maya Singh | 0 | 118000 |
It seems pretty natural to take the average for the people who did go to Cal and subtract the average for the ones who didn’t. A nice group_by should do it:
| Went to Cal? (D) | Sample Average Salary (\(\bar{Y}\)) |
|---|---|
| 0 | 115333.3 |
| 1 | 122500.0 |
| Difference in Sample Average Salary (\(\bar{Y}_{D=1} - \bar{Y}_{D=0}\)) |
|---|
| 7166.667 |
def: Difference in Sample Means Estimator
Given a sample with \(n_t\) treated (\(D=1\)) and \(n_c\) controls (\(D=0\)), the difference in sample means is \[ \bar{Y}_{D=1}-\bar{Y}_{D=0} = \frac1{n_t} \sum_{D_i =1} Y_i - \frac1{n_c} \sum_{D_i =0} Y_i \]
But is this a good estimator of the true population Average Treatment Effect (ATE)?
Spoiler Alert
Nope.
It is easier to come up with plausible-seeming estimates of average treatment effects than individual treatment effects because at least we see both some subjects under treatment and some others under control conditions. That’s really nice. But, to decide if estimates like the one we’ve just given are reliable, we need to think about how the data for the two groups was generated and whether they serve as good approximations to each other’s counterfactuals.
This question will be the focus of the rest of the causality unit.
Summary
We set the stage for reasoning about causation by defining cause and effect in terms of a conditional counterfactual. We say “A causes B” if, in a world where A didn’t happen, B no longer happens. Variable \(D\) causes variable \(Y\) if, in a world where we set the value of \(D\) to something different, then the distribution of \(Y\) changes. This definition is problematic, because we can’t simultaneously observe the same subject under both values of \(D\). However, there is more hope to say something meaningful about Average Treatment Effects across a population, though it’s also defined using counterfactuals.
In the remainder of the causality unit, we will discuss strategies for estimating ATEs using carefully-designed comparisons that leverage knowledge and assumptions about how the data was produced.

Footnotes
An a historical aside, Evelyn Fix is the name of a past professor of statistics at UC Berkeley and the co-inventor of the k-nearest neighbors algorithm.↩︎
A drawing from “The Book of Why” depicting the notion of potential outcomes described in Robert Frost’s poem The Road Not Taken.↩︎