Tutorials › Causal Inference › T-Learners for Conditional Treatment Effects

Causal Learning and Policy Decisions · Tutorial 950 of 972

T-Learners for Conditional Treatment Effects

Build a T-learner from two treatment-specific outcome models, and understand how their predictions combine into a conditional treatment-effect estimate.

Advanced 11 min read

What You'll Learn

  • Define the T-learner estimate from separate treated-group and control-group outcome models
  • Connect the estimated conditional effect to potential outcomes and identification assumptions
  • Work through prediction differences for covariate-specific treatment effects
  • Assess how treatment-specific sample sizes affect estimation uncertainty
  • Track how errors in the two outcome models combine in the estimated effect
  • Recognize why fitting two models does not by itself eliminate confounding or support problems

Why Fit Two Outcome Models?

A conditional treatment effect is a prediction target: for units with covariates \(X=x\), what is the average difference between their outcome under treatment and their outcome under control? One direct strategy is to predict each potential outcome separately, then subtract the predictions. Because it uses two models, one for each treatment condition, this strategy is called a T-learner.

The approach is conceptually simple, but its simplicity does not guarantee a reliable effect estimate. The two fitted models may have different accuracy, and the data may contain many more treated units than control units, or vice versa. Since the final estimate is a difference, both models—and the data available to fit each—matter.

Definition: Let \(A\in\{0,1\}\) denote treatment, \(X\) the covariates, and \(Y\) the observed outcome. Let \(Y(1)\) and \(Y(0)\) be the potential outcomes under treatment and control. The conditional average treatment effect is $$ \tau(x)=E[Y(1)-Y(0)\mid X=x]. $$ A T-learner fits one outcome prediction function using treated observations and another using control observations. If these fitted functions are \(\hat{\mu}_1(x)\) and \(\hat{\mu}_0(x)\), respectively, its estimated conditional treatment effect is $$ \hat{\tau}_{T}(x)=\hat{\mu}_1(x)-\hat{\mu}_0(x). $$

Identification and Construction

A T-learner is an estimation strategy, not a set of assumptions that makes causal effects identifiable. To interpret its target as a causal effect, the usual identification conditions must support comparisons within covariate values. In particular, assume consistency, conditional exchangeability, and positivity:

  • Consistency: the observed outcome satisfies \(Y=Y(A)\).
  • Conditional exchangeability: \((Y(1),Y(0))\) is independent of \(A\) given \(X\). In words, after conditioning on the recorded covariates, treatment assignment carries no additional information about the potential outcomes.
  • Positivity: for covariate values of interest, \(0<P(A=1\mid X=x)<1\). Both treatment conditions must be represented there.

Under these conditions, the conditional mean outcome observed in each treatment group identifies the corresponding conditional potential-outcome mean. The following argument states why. First, consistency lets us replace the observed outcome by the potential outcome matching the observed treatment. Conditional exchangeability then lets us remove the conditioning on treatment:

$$ \begin{aligned} E[Y\mid A=a,X=x] &=E[Y(a)\mid A=a,X=x]\\ &=E[Y(a)\mid X=x]. \end{aligned} $$

Subtracting the result for \(a=0\) from the result for \(a=1\) gives

$$ E[Y\mid A=1,X=x]-E[Y\mid A=0,X=x]=\tau(x). $$

Thus, if the two outcome models consistently estimate their respective conditional means, their difference estimates the conditional treatment effect. The identification assumptions concern the causal interpretation of those conditional means; model quality concerns how well the fitted functions approximate them. Neither set of conditions substitutes for the other.

In practice, the analyst chooses a prediction method and fits it separately on each treatment subset. For example, a linear regression, a regression tree, or another regression algorithm can be used in each subset. The fitted functions need not use the same method, although using comparable methods can make the contrast easier to interpret. Once fitted, both functions are evaluated at the same covariate value \(x\); subtracting predictions for different covariate profiles would not estimate the conditional effect at \(x\).

1
Split by treatment.
Form a treated data set from observations with \(A=1\) and a control data set from observations with \(A=0\).
2
Fit the outcome models.
Use treated observations to estimate \(\hat{\mu}_1(x)\), and control observations to estimate \(\hat{\mu}_0(x)\). Each model predicts the outcome conditional on covariates within its treatment group.
3
Predict at the target covariates.
For a covariate profile \(x\), obtain one predicted outcome from each fitted model.
4
Take the difference.
Calculate \(\hat{\mu}_1(x)-\hat{\mu}_0(x)\). The result is an estimated average treatment effect for units with covariates \(x\), not an individual’s observed treatment effect.

Worked Example: Subtracting Predictions at a Covariate Profile

Suppose, in a hypothetical study, the analyst fits separate linear outcome models. The treated-group model predicts \(12+2x\) outcome units, and the control-group model predicts \(8+0.5x\) outcome units. What is the T-learner estimate when \(x=4\)?

The treated-model prediction is $$ \hat{\mu}_1(4)=12+2(4)=20 $$ outcome units. The control-model prediction is $$ \hat{\mu}_0(4)=8+0.5(4)=10 $$ outcome units. Therefore, $$ \hat{\tau}_{T}(4)=20-10=10 $$ outcome units.

This calculation says that the fitted models estimate a conditional mean outcome difference of 10 units at \(x=4\). It is a causal estimate only if the identification conditions are credible and the models estimate the relevant conditional means adequately. The calculation alone does not establish either point.

Worked Examples with Group-Specific Data

Worked Example: Estimating Effects in Two Covariate Strata

Consider hypothetical binary outcomes recorded for units in two covariate strata. Within each stratum, estimate each treatment-specific outcome mean by its sample average. The table gives the number of observations and the number with outcome \(Y=1\).

StratumTreatment groupNumber of unitsNumber with \(Y=1\)
Lower-risk (\(x=0\))Treated2012
Lower-risk (\(x=0\))Control309
Higher-risk (\(x=1\))Treated107
Higher-risk (\(x=1\))Control4020

For the lower-risk stratum, the fitted treated mean is \(12/20=0.60\), and the fitted control mean is \(9/30=0.30\). Their difference is $$ \hat{\tau}_{T}(0)=0.60-0.30=0.30. $$ For the higher-risk stratum, the corresponding fitted means are \(7/10=0.70\) and \(20/40=0.50\), so $$ \hat{\tau}_{T}(1)=0.70-0.50=0.20. $$

The estimated conditional differences are 0.30 and 0.20, respectively, on the outcome-probability scale. Their difference across strata is compatible with effect heterogeneity in these estimates, but it does not prove that the true effects differ. The treated and control groups both have observations in each stratum, satisfying empirical representation there; causal interpretation still requires exchangeability and positivity in the target population.

Worked Example: Unequal Sample Sizes and Precision

Suppose a hypothetical subgroup has 4 treated units and 100 control units. The estimated mean outcome is 8 units among treated units and 6 units among controls, giving a T-learner subgroup estimate of \(8-6=2\) outcome units. Suppose the within-group sample standard deviations are 4 units for treated outcomes and 3 units for control outcomes.

For independent group means, the estimated standard error of the difference is $$ SE(\hat{\tau}_{T})= \sqrt{\frac{s_1^2}{n_1}+\frac{s_0^2}{n_0}}, $$ where \(n_1,n_0\) and \(s_1,s_0\) are the treatment-specific sample sizes and standard deviations in this subgroup. Substituting the given values, $$ SE(\hat{\tau}_{T})= \sqrt{\frac{4^2}{4}+\frac{3^2}{100}} =\sqrt{4+0.09} =\sqrt{4.09} \approx 2.022 $$ outcome units.

The treated-group contribution, \(4\), dominates the estimated variance \(4.09\); the large control sample cannot compensate for the small treated sample. This illustrates why each T-learner model depends on the data available in its own treatment group. The calculation is an estimated standard error under the stated independent-mean setup; it does not account for model selection, covariate extrapolation, or uncertainty from choosing a more complex prediction method.

How Model Errors Combine

The effect estimate is a difference of two predictions, so its error depends on the errors of both outcome models. Define the prediction errors at \(x\) as \(e_1(x)=\hat{\mu}_1(x)-\mu_1(x)\) and \(e_0(x)=\hat{\mu}_0(x)-\mu_0(x)\), where \(\mu_a(x)=E[Y\mid A=a,X=x]\). Under the identification conditions, \(\mu_1(x)-\mu_0(x)=\tau(x)\). Consequently,

$$ \hat{\tau}_{T}(x)-\tau(x)=e_1(x)-e_0(x). $$

This identity has an important consequence: the errors may reinforce one another or partially cancel. A T-learner effect estimate can be inaccurate even when each outcome prediction looks reasonable, and prediction errors of similar size can sometimes cancel in the difference. Accurate prediction of outcomes and accurate estimation of treatment effects are related but distinct goals.

Worked Example: Unequal Outcome-Model Errors

Suppose the true conditional means in a hypothetical setting are \(\mu_1(x)=10+2x\) and \(\mu_0(x)=6+x\). At \(x=3\), they are \(16\) and \(9\), respectively, so the true conditional effect is $$ \tau(3)=16-9=7 $$ outcome units.

Now suppose the fitted models are \(\hat{\mu}_1(x)=15+1.5x\) and \(\hat{\mu}_0(x)=5+1.2x\). At \(x=3\), their predictions are \(19.5\) and \(8.6\), giving $$ \hat{\tau}_{T}(3)=19.5-8.6=10.9 $$ outcome units. The treated-model error is \(19.5-16=3.5\) units, and the control-model error is \(8.6-9=-0.4\) units. Thus the effect error is $$ 10.9-7=3.9=3.5-(-0.4) $$ outcome units. The errors reinforce rather than cancel. In a different case, errors with the same sign and similar magnitude could partly cancel, so a small effect-prediction error alone would not show that both outcome models are accurate.

Limitations and a Common Mistake

Separate fitting gives each treatment group freedom to have its own outcome relationship with the covariates. That flexibility can be useful when those relationships genuinely differ, but it also means that a complex model may be unstable when one group is small. If the models are evaluated at a covariate value poorly represented in one treatment group, the prediction may rely heavily on extrapolation. Positivity is therefore not merely a technical condition: sparse treatment-specific support can make the difference unreliable even when the software returns a number.

A common mistake is to argue, “I fitted one model to treated units and one to controls, so their difference is automatically causal.” That conclusion is wrong. Separate outcome models do not remove unmeasured confounding, repair a lack of treatment overlap, or guarantee that the fitted functions are accurate. The correction is to distinguish three questions: whether the causal contrast is identified by the assumptions, whether each conditional mean is estimated well, and whether their difference is sufficiently precise for the intended use.

Another mistake is to treat the estimate at \(x\) as the effect for every person with exactly those recorded covariates. It is a conditional average, not an individual causal effect. For a binary outcome, the difference is on the probability scale; for a continuous outcome, it has the outcome’s measurement units. The scale should always be stated when interpreting the estimate.

Key takeaway: A T-learner estimates a conditional treatment effect by fitting treatment-specific conditional outcome means and subtracting them at the same covariate profile. Its causal meaning requires identification assumptions, and its reliability depends on support, sample size, and errors in both fitted models.

Check Your Understanding

Use the definitions and calculations above to answer these questions.

  1. A T-learner predicts 14 outcome units under treatment and 11 under control at the same covariate profile. What is its estimated conditional treatment effect, and what units does it have?
  2. State the conditional exchangeability and positivity conditions needed for the treatment-specific conditional means to identify the conditional treatment effect.
  3. Why can a large control-group sample fail to make an estimate precise when the treated-group sample in the target covariate subgroup is very small?
  4. If the treated outcome model has error \(+2\) units and the control outcome model has error \(+1\) unit at \(x\), what is the resulting effect-estimation error?
  5. Why does fitting separate models not, by itself, establish a causal interpretation for their difference?
Need help applying this method to your own data?

Our team supports biostatistics, statistical programming and pharmacometric analyses. Send us a request and we will reply by email.

Request an analysis
Clinical Biostats