No history yet

Introduction to Causal Inference

More Than Just Correlation

Here’s a classic puzzle: when ice cream sales go up, so do crime rates. If you just look at the numbers, you might conclude that eating a scoop of vanilla fudge leads to a life of crime. This is a perfect example of correlation. Two variables are moving in the same direction, but one isn't causing the other.

So what’s really happening? The answer is a third, hidden factor: hot weather. When the temperature rises, more people buy ice cream. Hot weather also brings more people outdoors, creating more opportunities for crime. The heat is what we call a confounding variable. It affects both ice cream sales and crime rates, creating a statistical relationship that isn't actually causal.

This is the core challenge of causal inference: moving beyond simple observation to understand true cause-and-effect relationships. It’s about asking why something happens, not just that it happens alongside something else.

A fundamental goal of scientific research is to learn about causal relationships.

Causal inference provides a framework for asking these questions in a structured way. It helps us untangle complex relationships in data, identify confounding factors, and get closer to the real story.

The World of 'What If'

To isolate a cause, we need to compare what happened with what would have happened if things were different. Imagine you have a headache and you take a new medication. An hour later, your headache is gone. Did the medication work?

It's impossible to know for sure from this one instance. To truly know, you'd have to see what would have happened if you hadn't taken the medication. This unobserved, alternate reality is called a counterfactual. Maybe your headache would have gone away on its own. We can't rewind time and live out both scenarios, which is often called the fundamental problem of causal inference.

Counterfactual

adjective

Relating to or expressing what has not happened or is not the case.

Since we can't observe counterfactuals directly for individuals, we use a structured approach called the Potential Outcomes Framework. This framework helps us think clearly about the problem.

For any individual, there are two potential outcomes:

  1. The outcome if they receive the treatment (e.g., your headache status after taking the pill).
  2. The outcome if they do not receive the treatment (e.g., your headache status without the pill).

Let's formalize this a bit. We can represent the outcome for an individual ii as YiY_i. If the individual takes the treatment (we'll call this T=1T=1), their outcome is Yi(1)Y_i(1). If they don't (T=0T=0), their outcome is Yi(0)Y_i(0).

Yi(1)=Outcome if person i is treatedYi(0)=Outcome if person i is not treatedY_i(1) = \text{Outcome if person } i \text{ is treated} \\ \\ Y_i(0) = \text{Outcome if person } i \text{ is not treated}

The individual causal effect is the difference between these two potential outcomes.

Causal Effect for person i=Yi(1)Yi(0)\text{Causal Effect for person } i = Y_i(1) - Y_i(0)

The problem, of course, is that we can only ever see one of these outcomes for any given person. If you take the pill, we observe Yi(1)Y_i(1), but Yi(0)Y_i(0) remains a counterfactual. If you don't take it, we see Yi(0)Y_i(0), and Yi(1)Y_i(1) is the counterfactual. The goal of many causal inference methods, like randomized controlled trials, is to estimate the average causal effect across a whole group of people, which gets us around this individual-level impossibility.

Ready to test your understanding?

Quiz Questions 1/5

The observation that ice cream sales and crime rates both increase during the summer is a classic example of:

Quiz Questions 2/5

In the scenario where a person takes a pill for a headache, what is the 'counterfactual'?

Understanding these core ideas—the limits of correlation, the role of confounders, and the logic of counterfactuals—is the first step into the powerful world of causal inference. It's a way of thinking that allows us to ask more meaningful questions of our data.