Skip to content
tezvyn:
Menu

The Counterfactual Framework for Causal Inference

Source: Wikipedia: Rubin causal modelMediumHow cards are made

The Counterfactual Framework models causality by imagining two parallel universes for each person: one with a treatment, one without. It's the basis for A/B tests and analyzing observational data.

The mental model

The Counterfactual Framework, or Rubin Causal Model, defines a causal effect by comparing potential outcomes. For any individual unit (a user, a patient, a server), there are two potential states of the world: the outcome if the unit receives a treatment, and the counterfactual outcome if it does not. The individual causal effect is the difference between these two potential outcomes.

How it works

The core challenge, often called the "fundamental problem of causal inference," is that it's impossible to observe both potential outcomes for the same unit at the same time. If a user sees a new feature, you can't also see what they would have done had they not seen it. Because individual causal effects are unobservable, we use statistics to estimate the Average Treatment Effect (ATE) across a population. In a randomized experiment (like an A/B test), we assume the treatment and control groups are statistically identical, so any difference in their average outcomes can be attributed to the treatment.

When to use it

This framework is the conceptual foundation for any analysis aiming to establish a cause-and-effect relationship. It's essential for designing and interpreting A/B tests. It also guides more complex methods for observational studies (like propensity score matching or regression discontinuity) where a clean experiment isn't feasible but you still need to estimate the impact of an intervention, such as a new policy or marketing campaign.

When not to use it

The framework is overkill for simple descriptive analytics or forecasting where you only need to identify correlations, not prove causation. If you just want to know "which users are most active?" or "what will next month's revenue be?", you don't need a causal model. Remember, this is a framework for structuring a problem, not a specific statistical test. You use it to design a study, which you then analyze with a tool like a t-test or regression.

One canonical example

Suppose you want to measure the causal effect of a redesigned signup button on user registration. For any single visitor, there's a potential outcome if they see the new button and a potential outcome if they see the old one. We can only show them one. By randomly assigning thousands of visitors to either the 'treatment' group (new button) or 'control' group (old button), we can measure the average registration rate for each group. The difference in these averages is our estimate of the Average Treatment Effect of the new button design.

Interview question

According to the Counterfactual Framework, what is the "fundamental problem of causal inference"?

  • a.Distinguishing correlation from causation requires advanced statistical software.
  • b.Random assignment of treatment is often impractical in real-world settings.
  • c.It is impossible to observe both potential outcomes for a single unit simultaneously.Correct
  • d.Measuring individual treatment effects is less useful than population-level averages.
Why?

Option C directly states the fundamental problem as described in the card: for any single unit, you can only observe one outcome (either treated or untreated), never both. Option B describes a practical difficulty in study design, not the inherent theoretical limitation of observing potential outcomes.

Just read this? Test yourself on what you have been reading.

Read the original → en.wikipedia.org

Put your scrolling time to good use

Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Open roles that interview on causal inference — each one lists the topics its interview covers.

See open roles