Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 12

The do-operator and the Philosophy of Causal Inference

Recommended resources

Hello! Welcome back.

In our last lesson, we explored how Directed Acyclic Graphs (DAGs) serve as a language for our causal assumptions. We saw that a DAG is not a statistical model but a qualitative representation of a causal theory, where the presence and absence of arrows make strong claims about how the world works. We distinguished between different causal path structures—chains, forks (confounders), and colliders—and saw how they govern the flow of statistical association.

Today, we climb to the second rung of the Ladder of Causation: Intervention. This lesson's outcome is to explain the do-operator and why the distinction between and is philosophically fundamental to causal inference. We will move from the passive act of seeing the world to the active process of doing something to it, formalizing a concept that is central to answering causal questions.

1. The Leap from Seeing to Doing

In your work as a statistician, you are an expert at modeling the world as you find it. You can describe the probability of an outcome given that you have observed a condition . This is the world of association, the first rung of the causal ladder. However, to ask causal questions—"Does this treatment work?", "What is the effect of this policy?"—we need a language to describe what happens when we actively change the world.

Judea Pearl argues that this requires a conceptual and mathematical leap that traditional statistics, built on symmetric equations, cannot make.

Keynote: Judea Pearl - The New Science of Cause and Effect

Let's begin with Judea Pearl himself, as he introduces the Ladder of Causation and the fundamental difference between seeing (association) and doing (intervention).

Please watch the segment from 17:55 to 26:21. Focus on his description of the three levels: Association (what if I see?), Intervention (what if I do?), and Counterfactuals (what if I had done?). This hierarchy is the backbone of our course.

As Pearl explains, each level of this ladder requires a different kind of information and answers a different class of questions. Today, we are focused on formalizing the logic of the second level: Intervention.


2. The do-operator: A Language for Intervention

The core distinction we need to make is between seeing and doing.

  • Seeing: We observe that a variable happens to have a value . We then update our beliefs about another variable . This is a standard conditional probability, written as . It is about passive observation.
  • Doing: We force the variable to take the value , regardless of what its natural causes would have dictated. We then observe the resulting state of . This is an intervention, and it's written using Pearl's do-operator: .

ML beyond Curve Fitting: An Intro to Causal Inference and do(...)

This blog post by Ference Huszar offers a wonderfully clear explanation of this distinction, using a simple but effective thought experiment.

Please read the sections titled 'Basics', 'Aren't they the same thing?', and 'Which one do I want?'. The espresso machine barometer example is a perfect illustration of why P(y|x) and P(y|do(x)) are fundamentally different objects.

As the article makes clear, is for prediction or diagnosis, while is for control or decision-making. For instance, in your research on relationships, observing that people who communicate frequently (X) report high relationship satisfaction (Y) gives you . This is useful for predicting satisfaction. But if you want to design an intervention to improve satisfaction, you need to know the effect of making people communicate more, which is . These two quantities may not be the same, especially if, for example, a third factor like 'shared life goals' causes both frequent communication and high satisfaction.


3. Visualizing the Intervention: A "Surgery" on the Model

How do we conceptualize this do() operation? In the previous lesson, we established that a DAG represents a causal model. An intervention, then, is a modification—a "surgery"—on that model.

When we intervene to set , we are severing the natural causal pathways that lead to . The value of is no longer determined by its parents in the graph; it is determined by our external force.

This image shows the effect of this surgery on the sprinkler system DAG we've seen before.

Observational vs. Interventional Causal Graphs (Sprinkler Example)
On the left is the observational model, where 'Season' influences the 'Sprinkler'. On the right is the interventional model for `do(Sprinkler=ON)`. The arrow from 'Season' to 'Sprinkler' is removed, signifying that the state of the sprinkler is now controlled by our intervention, not by the season.

This "graph surgery" is the graphical representation of the do-operator.

Another way to visualize the difference is to think about populations. Conditioning on means we are zooming in on a sub-population that already has this characteristic. Intervening with do(X=x) means we are creating a new hypothetical population where everyone has been forced to have this characteristic.

Visualizing Conditioning vs. Intervening (do-operator)
This diagram illustrates the difference between conditioning and intervening. Conditioning restricts our view to an existing subgroup (the red or blue slices). Intervening creates a new hypothetical world where the entire population is transformed to have the intervened property.

4. Why the Distinction is Philosophically Fundamental

This distinction isn't just a technical nicety; it's the very heart of causal reasoning. Conflating with is the source of countless fallacies and poor decisions. Formally, we can define confounding as the situation where the observational and interventional distributions are not equal:

The most famous example of this is Simpson's Paradox, where the observational data seems to give one answer, while the causal question demands another. Let's see how the do-operator resolves this.

An introduction to Causal inference | Fabian Dablander

This article provides a brilliant, step-by-step walkthrough of Simpson's Paradox, showing explicitly how to use the do-operator to arrive at the correct decision.

Please read the section Example Application: Simpson’s Paradox. Pay close attention to how the question 'should a doctor prescribe the drug?' is translated into a calculation of a do-expression, P(Recovery | do(Drug=1)). Notice how the causal DAG dictates which variables to adjust for to compute this quantity from observational data. The comparison with the second example (post-treatment blood pressure) using the same data is crucial for seeing why the causal story (the DAG) is paramount.

As the example demonstrates, the observational quantity was approximately 0.78, while was 0.83, suggesting the drug is harmful. However, calculating the causal effect via the do-operator yielded and .

The do-operator forces us to confront the causal question directly: "What would happen if we force everyone to take the drug?" To answer this, we must use our causal model (the DAG) to block the non-causal "backdoor" path Drug ← Sex → Recovery. The distinction between seeing and doing is the difference between a misleading correlation and a life-saving causal conclusion.


5. From Concept to Calculation: The Idea of Identification

You might be asking: if describes a hypothetical world, how can we ever calculate it from real-world, observational data? This is the central challenge of causal inference.

The process of translating a causal quantity (with a do-operator) into a purely statistical quantity (without one) is called identification. This is possible if and only if our causal model (the DAG) provides enough assumptions to isolate the causal effect from the statistical noise of confounding.

4.2 - Intervening, the do-operator, and Identifiability

This short video provides a very clear explanation of interventional distributions and the concept of identification.

Please watch from 01:40 to 06:23. The key idea here is that do-expressions are causal estimands, while expressions without the do-operator are statistical estimands. 'Identification' is the process of turning the former into the latter, using the assumptions encoded in our causal model.

The adjustment formula we saw in the Simpson's Paradox example is one tool for identification. The complete set of rules for this translation is known as the do-calculus. For our purposes, it's most important to grasp the philosophical point: we can only answer "what if I do?" questions from "what if I see?" data if we are willing to posit a causal theory that connects them. Data alone is not enough.


Conclusion

Today we have formalized the crucial step from observation to intervention. This distinction is the bedrock upon which all of causal inference is built.

Key Takeaways:

  • Seeing vs. Doing: Observational probability, , describes our updated belief about after seeing . Interventional probability, , describes the distribution of in a world where we have forced to a certain value.
  • The do-operator as "Surgery": An intervention do(X=x) is modeled as a "surgery" on the causal DAG, where all arrows pointing into are cut.
  • Philosophical Importance: The distinction is fundamental because it separates correlation from causation. Confounding exists precisely when seeing is not the same as doing (). This allows us to resolve paradoxes like Simpson's and make correct decisions.
  • Identification: The goal of causal inference is often to identify an interventional quantity, expressing it in terms of observational data, which is made possible by the assumptions encoded in a causal model.

In our previous lessons, we built up the language of causal models and interventions. We have now reached the top two rungs of the ladder. In our next lesson, we will ascend to the final, most powerful level: Counterfactuals. We will explore how SCMs provide the formal language for asking "what if?" questions about past events that did not happen.