Mental model

Counterfactuals and DAGs

Using visual maps of causes (DAGs) to rigorously answer 'what if' questions about events that never happened.

Discover

A city finds that ice cream sales are high when the number of drownings is high. They consider banning ice cream to save lives. What would likely happen to the number of drownings if they did?

Imagine a city-wide ice cream ban is enacted.

Let's see how visual models can solve this.

Understand

Understand

If a city banned ice cream, drowning rates would likely stay the same. The real cause is a hidden factor: hot weather makes people both buy ice cream and go swimming.

This is an example of a counterfactual—a 'what if' question about an alternate reality. We can analyze them using Directed Acyclic Graphs (DAGs), which are simple visual maps of cause and effect. A DAG would show arrows from 'Hot Weather' to both 'Ice Cream Sales' and 'Drownings', revealing that there's no direct causal link between ice cream and drowning.

Ask this: What hidden cause might be connecting two things that seem related?

Full explanation

Full explanation

A Directed Acyclic Graph, or DAG, is a tool for making our assumptions about cause and effect explicit. 'Directed' means arrows point from a cause to an effect, and 'acyclic' means the arrows never loop back on themselves—an effect can't be its own cause.

These graphs allow us to reason about counterfactuals systematically. When we ask, "What if we banned ice cream?", we are simulating an intervention. On the DAG, this means we erase any arrows pointing to 'Ice Cream Sales'. We can then see that the path from 'Hot Weather' to 'Drownings' remains completely untouched, showing the ban would be ineffective.

This method is powerful because it helps us identify confounding variables—the hidden common causes like 'hot weather'. For example, a company might notice that users of a new feature are also its most valuable customers. A DAG could help them determine if the feature creates value or if valuable customers were just the first to adopt it. The counterfactual is: what would happen if we pushed the feature to everyone?

In medicine, DAGs are crucial for designing studies. To test a new pill for headaches, a DAG would map out different causal pathways: the pill's chemical effect, the patient's expectation (placebo effect), and other factors. This clarity helps researchers isolate the true effect of the drug from the noise of other influences, answering the counterfactual, "What would have happened to this patient if they hadn't received the active ingredient?"

Research

Research

The formal logic for using graphs in causal reasoning was developed by computer scientist Judea Pearl, primarily through his framework known as the do-calculus. This system provides a set of mathematical rules for determining when and how a causal effect can be estimated from data, even in non-experimental settings. It allows researchers to simulate interventions by mathematically representing the act of 'doing' something (e.g., assigning a treatment), denoted as do(X=x), and observing its effect on the system.

  • Pearl's "Ladder of Causation" places counterfactual reasoning at the highest level of causal inference, above simply observing associations or testing interventions, as it requires modeling a world that does not exist. [1, 2]
  • A central tool from this framework is the back-door criterion, a graphical rule used on a DAG to identify a sufficient set of confounding variables that must be statistically controlled for to isolate the true causal effect between a treatment and an outcome. [1]
  • Researchers in fields like epidemiology use DAGs to untangle complex causal questions that are difficult to study with randomized trials, such as the long-term effects of a particular diet or the impact of a public health policy. [3]

Limitations

Limitations

The primary limitation of a DAG is that it represents assumed causal relationships, not discovered ones. If the underlying model is wrong (e.g., an arrow is missing or points the wrong way), the conclusions drawn from it will be incorrect. They also become very complex and difficult to manage in systems with many interconnected variables. Finally, DAGs are tools for testing existing hypotheses about causal structure; they cannot discover that structure from data alone.

Try it

Synthesize

Choose a pattern from the guide, then pick an action to try with it.

Which pattern stands out?

What will you try?

Choose a pattern above to select an action.

Sources

Sources

Try it

Check your understanding

A team notices projects using a new software are more successful. A DAG reveals the software was only given to the most experienced engineers. What does this suggest about the counterfactual: 'What if we gave the software to everyone?'

Show the guide's explanation

Answer: Success rates would likely not change much

The DAG shows that engineer experience is a common cause (a confounder) of both software adoption and project success. The software itself may have little to no direct causal effect on its own.

What is the primary benefit of drawing a DAG *before* analyzing data?

Show the guide's explanation

Answer: It makes your causal assumptions explicit and testable

A DAG is a tool for thinking. It forces you to state your beliefs about the causal structure of a problem, which can then guide your analysis and help you identify potential flaws like confounding.

In the ice cream and drowning example, what role does 'hot weather' play in the DAG?

Show the guide's explanation

Answer: A confounding variable (common cause)

Hot weather is a common cause that creates a spurious correlation between ice cream sales and drownings. It causally influences both, but they don't directly influence each other.

Keep exploring

Find another idea for the decision in front of you.

The complete Reframo library is free to read. Explore another guide whenever you are ready.