Suppose two patients with similar cancer diagnoses both have a high predicted risk of disease progression. Does that mean they are equally likely to benefit from the same treatment?

Not necessarily. A model predicting disease progression tells us about prognosis. It does not necessarily tell us how much a treatment would change that prognosis.

Consider two hypothetical patient groups:

GroupProgression risk without treatmentProgression risk with treatment
A40%20%
B40%38%

Both groups have the same baseline risk. Yet the expected absolute risk reduction is 20 percentage points in one group and only 2 in the other. These are illustrative population-level probabilities, not two observed outcomes for one person.

I've encountered questions around estimating treatment effects from real-world clinical data and wanted to understand the methods more deeply. These notes are my attempt to work through the concepts, assumptions and tradeoffs.

This builds on my earlier note, Causal inference: understanding the data, which introduces disease models, treatment-assignment models and confounding.

The question we are trying to answer

For a patient receiving Treatment A, we observe what happened after Treatment A. We do not observe what would have happened to the same patient, in the same circumstances, under Treatment B.

These are the potential outcomes. The missing alternative is the counterfactual, and it is why causal inference differs from ordinary prediction.

An average treatment effect (ATE) asks how much treatment changes the expected outcome across a population. But an overall average can hide meaningful differences between patients.

A conditional average treatment effect (CATE) asks how that average effect varies with patient characteristics, such as disease stage, biomarker status or comorbidities. A CATE predicted for an individual patient's features is still a conditional average, not an observed individual causal effect.

Before getting into algorithms, I find it useful to distinguish three questions:

  • Prognosis: who is likely to experience an outcome?
  • Treatment effect: how would that outcome change under a different treatment strategy?
  • Treatment decision: which option should we choose, accounting for benefit, harms, preferences and uncertainty?

The learners below primarily address the second question.

Why treatment assignment matters

Imagine clinicians preferentially give a new therapy to people with more advanced disease. A naive treated-versus-untreated comparison might show worse outcomes in the treated group even if the therapy helps, because the treated patients started with worse prognosis.

That is confounding by indication.

Three assumptions are central to many observational treatment-effect analyses:

  1. Consistency: the treatment strategies are well defined and observed outcomes correspond to the strategy received.
  2. Conditional exchangeability: after accounting for relevant pretreatment covariates, no unmeasured factors jointly determine treatment assignment and potential outcomes.
  3. Positivity: patients with the characteristics being studied have a nonzero chance of receiving either treatment strategy.

Randomization helps address confounding, although missing data, adherence and small subgroups still matter. In observational data, careful design is essential. No learner can recover a causal effect automatically if crucial confounders are missing or one treatment is essentially never observed in a patient subgroup.

Two models appear repeatedly: an outcome model, predicting an outcome from patient characteristics and treatment, and an assignment model, predicting the probability of receiving treatment (the propensity score).

S-learner: one model, two questions

An S-learner trains a single supervised model with both patient features and the treatment indicator as inputs.

For a given patient's characteristics, we run the predictor twice: first setting treatment to 1, then to 0. Their difference is our estimated treatment effect.

If predicted progression risks are 20% with treatment and 40% without it, we estimate a treatment-minus-control effect of -20 percentage points.

Why use it? One model can share information between the treatment groups. It is simple to implement with familiar classifiers or regressors.

Where can it fail? The model may pay much more attention to strong prognostic features than to treatment. A well-calibrated outcome predictor can still estimate treatment-effect heterogeneity poorly, particularly if it suppresses treatment interactions.

T-learner: one model per treatment

The T-learner trains a separate outcome model for each treatment group. One learns from treated patients, the other from untreated patients.

To estimate an effect for a new patient, we obtain a prediction from each model and subtract.

This gives the two groups more flexibility. Biomarkers might have very different relationships with outcomes under the two therapies.

But each model sees only part of the data. If 90% of patients receive one treatment, the other outcome model has far fewer examples. Subtracting two noisy predictions can amplify estimation error.

The tradeoff is straightforward: S-learners share structure; T-learners allow treatment-specific structure. Neither consistently dominates the other.

X-learner: learn from estimated counterfactual differences

The X-learner starts like the T-learner, fitting outcome models for both treatment groups.

Next, for each treated patient, it uses the control outcome model to estimate what might have happened without treatment. It compares that estimated counterfactual with the actual observed outcome. For a control patient, it does the reverse.

These differences are called pseudo-treatment effects. They are not observed individual causal effects: one side of each comparison is a model estimate.

The X-learner fits new models to predict those pseudo-effects from patient characteristics, then combines estimates from the two arms, often using propensity-related weights.

One attraction is that it can sometimes exploit a large treatment group to estimate counterfactuals for a smaller group. But the advantage depends on the quality of the outcome models and the structure of the treatment effects. Unequal group sizes do not guarantee that the X-learner will win.

R-learner: remove what we can already explain

Rather than estimate two outcome surfaces and subtract them, the R-learner starts by separating baseline prognosis and treatment selection from the remaining variation.

First it estimates:

  • The expected outcome using patient characteristics.
  • The probability that a patient receives treatment using those same baseline characteristics.

Then it subtracts the expected outcome from the observed outcome, and the expected treatment probability from the actual treatment indicator.

These are residuals. The final learner relates residualized outcomes to residualized treatment, allowing that relationship to vary across patient characteristics.

This is called residualization or orthogonalization. Under suitable conditions, it can reduce first-order sensitivity to errors in the preliminary models, often called nuisance models.

It does not eliminate confounding or overlap requirements. Out-of-fold predictions and cross-fitting also help prevent the final stage from relying on overly optimistic in-sample nuisance estimates.

DR-learner: combine prediction with propensity correction

A doubly robust (DR) learner combines the outcome-model contrast with corrections based on how likely each patient was to receive their observed treatment.

We start with predicted outcomes under treatment and control, as in a T-learner. We then adjust that difference using the discrepancy between each observed outcome and its prediction, weighted by the probability of receiving that treatment.

The result is an augmented pseudo-outcome. A second model predicts this pseudo-outcome from patient characteristics.

The appealing property is double robustness. Under the necessary identification assumptions and appropriate regularity conditions, the conditional target of the augmented pseudo-outcome can remain correct if either the outcome regressions or the propensity model is correctly specified.

This does not mean that the final flexible regression is automatically unbiased. Propensity scores close to zero or one can also create extreme weights and unstable results. Cross-fitting and overlap diagnostics remain essential.

Putting some mathematics behind the learners

Now we can give names to the components.

Let X represent pretreatment patient characteristics, W denote treatment (0 or 1) and Y the observed outcome. Let Y(1) and Y(0) denote potential outcomes under the two strategies.

The CATE is:

tau(x) = E[Y(1) - Y(0) | X = x]

Define the outcome regressions and the propensity score:

mu_w(x) = E[Y | X = x, W = w]
e(x)    = P(W = 1 | X = x)

Under consistency, conditional exchangeability and positivity, the CATE is identified by the difference between the two outcome regressions:

tau(x) = mu_1(x) - mu_0(x)

The S-learner fits one function taking X and W as inputs; the T-learner fits one for each arm:

S:  tau_hat(x) = mu_hat(x, 1) - mu_hat(x, 0)
T:  tau_hat(x) = mu_hat_1(x) - mu_hat_0(x)

The X-learner builds treatment-effect pseudo-labels:

For treated patients:   D1 = Y - mu_hat_0(X)
For control patients:   D0 = mu_hat_1(X) - Y

For the R-learner, define m(x) = E[Y | X = x]. Its final-stage objective is a regularized regression using the residual terms:

min over tau:
  sum_i [ (Y_i - m_hat(X_i))
          - (W_i - e_hat(X_i)) * tau(X_i) ]^2
  + regularization

The DR-learner's augmented pseudo-outcome is:

phi_i = mu_hat_1(X_i) - mu_hat_0(X_i)
      + W_i / e_hat(X_i) * (Y_i - mu_hat_1(X_i))
      - (1-W_i) / (1-e_hat(X_i)) * (Y_i - mu_hat_0(X_i))

A model of the conditional mean of this pseudo-outcome is then fitted to estimate treatment-effect heterogeneity.

How the approaches relate

Comparison of S-, T-, X-, R- and DR-learners and their different model structures.

The five approaches differ in what they model and where they are most vulnerable:

  • S-learner: One outcome model queried under both treatments. It may suppress weak treatment effects.
  • T-learner: Separate outcome models for treated and control groups. Each uses less data, and errors in the two predictions can accumulate.
  • X-learner: Learns from imputed treatment-effect pseudo-labels. Its estimates depend on the quality of the initial outcome models.
  • R-learner: Fits effects using outcome and treatment residuals. Nuisance estimation and treatment overlap remain important.
  • DR-learner: Uses an augmented, propensity-corrected pseudo-outcome. Extreme weights and noisy final-stage predictions can destabilize estimates.

These are meta-learners: they can use familiar supervised-learning algorithms as components. The best choice depends on sample size, treatment balance, overlap, outcome complexity, effect heterogeneity and evaluation design.

Where IPW and AIPW fit

Inverse propensity weighting (IPW) uses treatment-assignment probabilities to reweight observations. Augmented IPW (AIPW) combines this with outcome regression.

These tools are frequently used for population-level effects such as the ATE. DR-learning extends closely related augmented-outcome reasoning to estimating how effects vary with patient characteristics.

An estimate of the population ATE is not the same thing as a CATE model. Nor does doubly robust estimation repair unmeasured confounding.

Evaluating treatment-effect learners

Evaluation is harder than ordinary prediction because we do not observe both potential outcomes for an individual patient. Standard held-out classification accuracy does not directly measure CATE accuracy.

I would examine several layers:

Design and identification. Define eligibility, time zero, treatment strategies, covariates, endpoints and follow-up. Check for post-treatment leakage and plausible confounders.

Overlap and nuisance models. Examine propensity distributions, effective sample sizes and outcome-model diagnostics.

Simulated ground truth. Generate patient characteristics and treatment choices with a known treatment-effect function. This allows us to measure estimated CATE against the truth, including metrics such as PEHE.

Randomized validation. Compare actual treatment contrasts across predefined predicted-benefit strata in held-out experimental data. Even randomized trials do not reveal an individual's two potential outcomes.

Decision value. If the purpose is treatment choice, evaluate the resulting policy under a suitable experimental or justified off-policy design.

Real oncology endpoints add censoring, treatment switching, competing events and time-varying treatments. A binary one-year progression outcome is a starting point, not a substitute for a full survival analysis.

References

Diagrams generated using AI.