Causal Calculus

Counterfactual Reasoning: The Third Rung of the Ladder of Causation

A judge asks: 'Would the victim have survived if the defendant had not pulled the trigger?' An epidemiologist: 'Would the cancer have developed if the patient had not smoked?' An Amazon economist: 'Would the customer have bought if the price had been $1 lower?' These are rung 3 of Pearl's ladder of causation (2009): counterfactuals. Neither observations nor interventions are sufficient to answer - the full structural causal model with exogenous variables that capture each unit's individuality is required.

  • **Uplift modeling (Amazon, Netflix, Uber):** personalized ads, recommendations, discounts. For each customer the counterfactual treatment effect is estimated. T-learner, X-learner and causal forests are trained on A/B data but predict individual counterfactual uplift
  • **Counterfactual explanations in ML fairness:** LIME and SHAP give feature importance but do not answer: 'What minimum change to features would flip the decision?' Counterfactual explanations (Wachter et al. 2017) are rung 3: what would the specific applicant need to change to get the loan approved
  • **Legal but-for causation:** in discrimination, medical malpractice and industrial accident cases courts apply the but-for standard: 'Would the harm have occurred without the defendant's action?' Formally this is $Y_0(u) < \text{threshold}$, counterfactual rung 3
  • **Policy evaluation without a new RCT:** DoWhy (Microsoft) and CausalML (Uber) estimate counterfactual policy effects from historical data. Netflix measures the value of recommendation algorithms without new A/B tests via importance sampling counterfactual estimation

Предварительные знания

  • do-operator: intervention differs from observation
  • Counterfactual notation: Y(x) as the potential outcome under do(X=x)
  • Backdoor adjustment and identifiability conditions
  • do(X) Operator: Intervention vs Observation
  • Mediation analysis: NDE and NIE

Counterfactuals: the twin network formalism

Three rungs of the ladder of causation

Pearl (2009) identifies three levels of causal questions. **Rung 1 (associations)**: $P(Y|X=x)$ - what is observed. **Rung 2 (interventions)**: $P(Y|\mathrm{do}(X=x))$ - what would happen under an intervention. **Rung 3 (counterfactuals)**: $P(Y_x|X=x', Y=y')$ - what would have happened for a specific unit had things been different. Observational data and interventions are not enough for rung 3 - the full structural model is required.

A **Structural Causal Model (SCM)** is a set of equations $X_i = f_i(\mathrm{Pa}(X_i), U_i)$ where $U_i$ are exogenous noise variables. The $U$ encode everything that makes a unit unique. The counterfactual $Y_x(u)$ is the value of $Y$ under $\mathrm{do}(X=x)$ for a unit with exogenous noise $U=u$.

**Twin network** is the main tool for computing counterfactuals. The idea: duplicate the SCM graph into two copies that share the same exogenous noise $U$. In the 'factual' world - the real observations. In the 'counterfactual' world - the intervention $\mathrm{do}(X=x)$. Since $U$ is shared, the unit's individuality is preserved in both worlds.

**Key distinction from interventions.** $P(Y|\mathrm{do}(X=x'))$ is a population-level distribution under forced $X=x'$. $Y_{x'}(u)$ is the outcome for a specific unit $u$ under $\mathrm{do}(X=x')$. These are different questions: average effect vs individual counterfactual outcome.

In a twin network, the exogenous noise $U$ is shared between the factual and counterfactual worlds. Why is this necessary?

Identification of counterfactual effects and ATT

When can a counterfactual effect be estimated from data?

A full counterfactual answer requires knowing $P(U|\text{observations})$, which means knowing the complete SCM including exogenous distributions. This is strictly harder than identifying interventional distributions. Nevertheless, for several important quantities identification is possible.

**ATT (Average Treatment Effect on the Treated)** is the counterfactual effect within the group that actually received the treatment:

The second term $\mathbb{E}[Y_0 \mid X=1]$ is counterfactual: 'what would have happened to those who were treated, had they not been treated'. This is not the same as $\mathbb{E}[Y \mid X=0]$ when confounding is present. Under no unmeasured confounders and Markovian SCM, ATT is identified via a backdoor-weighted formula:

**Principal stratification (Frangakis, Rubin 2002).** Units are classified by the pair of potential treatments $(X_0, X_1)$: - Always-takers: $X_0 = 1$ and $X_1 = 1$ - Never-takers: $X_0 = 0$ and $X_1 = 0$ - Compliers: $X_0 = 0$ and $X_1 = 1$ (follow the assignment) - Defiers: $X_0 = 1$ and $X_1 = 0$ IV-based estimation (LATE / CACE) = ATT on compliers. Important: stratum membership is a counterfactual characteristic, not directly observable.

ATE = $\mathbb{E}[Y_1 - Y_0]$ and ATT = $\mathbb{E}[Y_1 - Y_0 | X=1]$. When does ATE = ATT?

Uplift modeling, but-for causation and counterfactual attribution

Counterfactual reasoning in ML systems

**Uplift modeling** (Radcliffe 2007) estimates the individual counterfactual treatment effect: $\tau_i = Y^1_i - Y^0_i$. For a specific customer $i$ both potential outcomes cannot be observed simultaneously (fundamental problem of causal inference). So the target is $\tau(x) = \mathbb{E}[Y^1 - Y^0 | X_i = x]$, modeled from experimental data.

**T-learner (two separate regressors):**

**S-learner**: a single model with treatment as a feature: $\hat{\tau}(x) = \hat{\mu}(x, 1) - \hat{\mu}(x, 0)$. **X-learner** (Kunzel et al. 2019): a two-stage estimator, more efficient under imbalanced treatment groups.

**But-for causation in law.** The legal standard: 'Would the harm have occurred but for the defendant's action?' - formally this is the counterfactual question $Y_0(u) < \text{threshold}$ given observed $Y_1(u) \geq \text{threshold}$ and $X(u) = 1$. In toxic exposure, discrimination and accident cases this is a rung 3 question. Courts frequently apply the but-for test without an explicit SCM, which leads to logical errors in the presence of multiple causes (overdetermination, preemption).

**Counterfactual attribution without A/B.** Netflix and Amazon use counterfactual estimates to measure the value of recommendation algorithms without running a new A/B test for each feature. The approach: train a reward model on historical data with exploration, then estimate the counterfactual outcome $\mathbb{E}[Y|\hat{\pi}_{new}]$ via importance sampling.

Counterfactual analysis is the same as sensitivity analysis or scenario modeling

Counterfactual reasoning requires a specific SCM with exogenous variables $U$; 'what-if' scenarios without fixing $U$ are interventions (rung 2), not counterfactuals (rung 3)

'What would happen to sales if we cut the price by 10%' is do(price = price_0 * 0.9), rung 2, a population-level effect. 'What would this specific customer have done if the price were $1 lower' is rung 3 - it requires fixing the $U$ of this particular customer, which encodes everything about their individual behavior that led to the observed outcome. The difference is fundamental: the second question needs individual-level structural information.

An uplift model predicts $\hat{\tau}(x) = \hat{\mu}_1(x) - \hat{\mu}_0(x)$. Why can it not be validated like a classifier - by comparing $\hat{\tau}(x_i)$ with the true $\tau_i = Y^1_i - Y^0_i$ for each $i$?

Key takeaways

  • **Rung 3 of Pearl's ladder**: counterfactuals $Y_x(u)$ - what would have happened to a specific unit $u$ under $\mathrm{do}(X=x)$. Unreachable from observations or interventions alone - requires a full SCM
  • **Twin network**: duplicate the SCM, share $U$, apply $\mathrm{do}(X=x)$ in one copy. 3 steps: Abduction (P(U|obs)), Action (do), Prediction (Y_cf)
  • **ATT**: $\mathbb{E}[Y_1 - Y_0 | X=1]$ is identified under no unmeasured confounders via IPW with propensity score weighted to the treated distribution
  • **Principal stratification**: units are classified by pairs $(Y_0, Y_1)$ - compliers, always-takers, etc. LATE/CACE = ATT on compliers
  • **Uplift modeling**: T-learner, X-learner, causal forests estimate $\tau(x) = \mathbb{E}[Y^1 - Y^0 | X_i = x]$. True $\tau_i$ is unobservable (fundamental problem), validation uses Qini / AUUC rank metrics
  • **But-for causation in law**: the 'but for the defendant's action' test is formally $Y_0(u)$, rung 3. Without an SCM courts cannot correctly handle overdetermination and preemption

What comes next

Counterfactual reasoning opens transportability and individualized effect estimation:

  • Transportability — Transporting counterfactual effects across populations with different U distributions
  • Double ML and CATE — CATE is the counterfactual difference estimated via Double ML with orthogonal scores

Вопросы для размышления

  • Amazon uses counterfactual estimation to measure recommendation value without A/B testing: they train a reward model and estimate $\mathbb{E}[Y | \hat{\pi}_{new}]$ via importance sampling. Under what conditions is this estimate biased, and how does that connect to the overlap assumption that importance sampling requires?
  • In a wrongful termination case the company argues it would have fired the employee even without the discriminatory act (preemption / alternative causation). How does this break the but-for test, and what counterfactual object (which rung, which $U$) needs to be defined to correctly assess counterfactual causation?
  • X-learner (Kunzel et al. 2019) is more efficient than T-learner under imbalanced treatment groups. It imputes counterfactual outcomes: $\tilde{\tau}_i^{(1)} = Y_i - \hat{\mu}_0(X_i)$ for treated units. What assumptions about the SCM does this make, and how does violating them affect the bias of the uplift estimate?

Связанные уроки

  • cc-05-do-operator — do-operator is rung 2; counterfactuals are rung 3, strictly stronger than interventions
  • cc-08-mediation — NDE is formally defined via the counterfactual Y(x, M(x')) - without SCM semantics it has no rigorous grounding
  • cc-07-identifiability — Counterfactual identification is stricter: requires knowing the SCM, not just the graph
  • cc-10-transportability — Transporting counterfactual effects across populations is a direct extension of the twin network
  • cc-12-double-ml-cate — Uplift model = E[Y^1 - Y^0 | X] - a counterfactual difference estimated via Double ML
  • stat-01-sampling
Counterfactual Reasoning: The Third Rung of the Ladder of Causation

0

1

Sign In