Tutorials › Causal Inference › X-Learners for Imbalanced Treatment Groups

Causal Learning and Policy Decisions · Tutorial 952 of 972

X-Learners for Imbalanced Treatment Groups

Derive the X-learner’s two imputed-effect models and propensity-weighted estimate, then examine what group imbalance does—and does not—imply for its performance.

Advanced 10 min read

What You'll Learn

  • Define the two X-learner imputed treatment-effect outcomes.
  • Derive why each pseudo-outcome targets the conditional treatment effect.
  • Distinguish the control-derived and treated-derived effect models.
  • Calculate the propensity-weighted combination of those models.
  • Explain how imbalance can affect the first-stage outcome models and the final combination.
  • Recognize why propensity weighting does not fix poor overlap or guarantee superior performance.

Why Use Two Imputed-Effect Models?

A conditional average treatment effect (CATE) describes how the average causal effect varies with observed covariates. Let \(W\) be a binary treatment indicator, with \(W=1\) for treatment and \(W=0\) for control. Let \(Y(1)\) and \(Y(0)\) denote the potential outcomes under treatment and control, and let \(X\) be the covariate vector. The target is

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

The X-learner is a meta-learner: it combines outcome models with models trained on imputed treatment effects. Its central idea is to use the observed outcome in one treatment group and an estimated counterfactual outcome from the other group to create an effect-like target. It does this in both directions, producing two estimates of the CATE before combining them.

This construction can be useful when treatment and control group sizes differ substantially. The larger group can support a more stable estimate of its outcome regression, which is used to impute counterfactual outcomes for members of the other group. The benefit is not automatic: the smaller group still matters, and adequate covariate overlap remains essential.

Definition and Identification Conditions

Definition: The X-learner estimates the CATE in three stages. First, it estimates the conditional outcome means \(\mu_1(x)=E[Y\mid X=x,W=1]\) and \(\mu_0(x)=E[Y\mid X=x,W=0]\). Second, it constructs an imputed treatment effect for each treated observation and each control observation, then fits a separate effect model in each group. Third, it combines those two fitted effect models using the treatment propensity.

For a causal interpretation of the target, the standard assumptions are consistency, conditional exchangeability, and positivity. Consistency means the observed outcome equals the potential outcome corresponding to the treatment actually received: \(Y=WY(1)+(1-W)Y(0)\). Conditional exchangeability means \((Y(1),Y(0))\) is independent of \(W\) given \(X\). Positivity means \(0<P(W=1\mid X=x)<1\) for covariate values in the target population. These conditions allow the observed conditional outcome means to identify the corresponding potential-outcome means.

Write \(e(x)=P(W=1\mid X=x)\) for the treatment propensity. Under consistency and conditional exchangeability, \(\mu_1(x)=E[Y(1)\mid X=x]\) and \(\mu_0(x)=E[Y(0)\mid X=x]\). Their difference is therefore the CATE. In practice, the outcome means and propensity are estimated from data; the assumptions do not guarantee that those estimated models are accurate.

Imputing Treatment Effects in Both Groups

Suppose fitted outcome models are \(\widehat{\mu}_1(x)\) and \(\widehat{\mu}_0(x)\). For a treated observation, the treated outcome is observed, but the control outcome is not. Estimate that missing control outcome with \(\widehat{\mu}_0(X_i)\), and form

$$ D_i^{(1)}=Y_i-\widehat{\mu}_0(X_i), \qquad W_i=1. $$

For a control observation, estimate the missing treated outcome with \(\widehat{\mu}_1(X_i)\), and form

$$ D_i^{(0)}=\widehat{\mu}_1(X_i)-Y_i, \qquad W_i=0. $$

Fit a model \(\widehat{\tau}_1(x)\) to \(D_i^{(1)}\) among treated observations, and a model \(\widehat{\tau}_0(x)\) to \(D_i^{(0)}\) among controls. The superscript labels the group supplying the imputed-effect observations: \(\widehat{\tau}_1\) is fitted in the treated group, while \(\widehat{\tau}_0\) is fitted in the control group.

Worked Example: Why Both Imputed Outcomes Target the CATE

Consider a hypothetical covariate value \(x\) at which the conditional mean outcome under treatment is 18 units and the conditional mean under control is 12 units. The CATE is \(18-12=6\) outcome units. If the outcome models equal these conditional means, then a treated observation with outcome 18 has imputed effect \(18-12=6\). A control observation with outcome 12 has imputed effect \(18-12=6\) as well.

The same target follows in conditional expectation more generally. Under consistency and conditional exchangeability, the treated-group imputed outcome has conditional expectation

$$ E[Y-\mu_0(X)\mid X=x,W=1] =\mu_1(x)-\mu_0(x) =\tau(x). $$

For controls, the corresponding calculation is

$$ E[\mu_1(X)-Y\mid X=x,W=0] =\mu_1(x)-\mu_0(x) =\tau(x). $$

Thus both types of pseudo-outcome target the same conditional effect when the conditional outcome means are correct. In real samples, the pseudo-outcomes also reflect estimation error in the fitted outcome models and ordinary outcome variation.

Combining the Two Effect Models

The standard propensity-weighted X-learner estimate is

$$ \widehat{\tau}_{X}(x) =\widehat{e}(x)\widehat{\tau}_0(x) +\{1-\widehat{e}(x)\}\widehat{\tau}_1(x), $$

where \(\widehat{e}(x)\) estimates the probability of treatment at covariate value \(x\). The weight on the control-derived model is the estimated treatment propensity; the weight on the treated-derived model is one minus that propensity. These are local weights: they can differ across covariate values.

The weighting has a useful imbalance rationale. When treatment is rare at \(x\), \(\widehat{e}(x)\) is small, so the combination puts more weight on \(\widehat{\tau}_1(x)\), the effect model fitted among treated observations. Its pseudo-outcomes use the control outcome model to impute the missing control outcomes. If controls are numerous, that control outcome model may be estimated relatively precisely. When treatment is common, the combination instead puts more weight on the control-derived effect model, whose pseudo-outcomes use the treated outcome model.

This rationale is not a guarantee that the more heavily weighted effect model is accurate. For example, if treatment is rare, \(\widehat{\tau}_1\) is still fitted using a relatively small treated sample. Propensity weighting is a combination rule that can exploit complementary information; it does not create observations in sparsely represented regions or repair poor outcome models.

Worked Example: Combining Models With Unequal Group Sizes

Suppose a hypothetical subgroup contains 2 treated and 6 control observations, so the estimated treatment propensity in that subgroup is \(\widehat{e}=2/8=0.25\). Cross-fitted outcome predictions produce the following pseudo-outcomes. Cross-fitting here means that each prediction used to construct a pseudo-outcome is obtained without fitting that prediction using the same observation’s outcome.

GroupObserved outcomesImputed counterfactual predictionsPseudo-outcomes
Treated, \(W=1\)13, 15Control predictions: 9, 10\(13-9=4,\;15-10=5\)
Control, \(W=0\)8, 10, 11, 9, 10, 12Treated predictions: 10, 12, 13, 11, 12, 142, 2, 2, 2, 2, 2

For a simple intercept-only effect model in this subgroup, the treated-derived estimate is the mean of the treated pseudo-outcomes:

$$ \widehat{\tau}_1=\frac{4+5}{2}=4.5. $$

The control-derived estimate is the mean of the control pseudo-outcomes:

$$ \widehat{\tau}_0=\frac{2+2+2+2+2+2}{6}=2. $$

The propensity-weighted combination is therefore

$$ \widehat{\tau}_{X} =0.25(2)+0.75(4.5) =0.5+3.375 =3.875. $$

The estimate is 3.875 outcome units. It lies between the two fitted effect estimates because the weights are nonnegative and sum to one. This small illustration shows the arithmetic, not that the combination is necessarily more accurate than either component.

Why Imbalance Can Matter

The two directions of imputation depend on different outcome models. For treated observations, constructing \(D^{(1)}\) requires a control outcome prediction. For control observations, constructing \(D^{(0)}\) requires a treated outcome prediction. If one group is much larger, its outcome model may have more information, and the pseudo-outcomes relying on that model can benefit. The propensity-weighted combination gives greater weight to the effect model built using pseudo-outcomes that rely on the larger complementary group’s outcome model.

There are important limits to this intuition. A large control group does not compensate for having almost no treated observations at a particular covariate value: the treated-derived effect model still needs information from treated observations. Likewise, a propensity near zero or one indicates weak overlap, making comparisons in that region difficult. Model misspecification, noisy outcomes, and poor covariate support can all undermine the estimate. Group counts overall are not enough; the relevant imbalance and overlap can vary with \(X\).

The X-learner also does not replace careful selection and evaluation of the outcome and propensity models. Flexible models may capture effect variation, but can overfit or extrapolate poorly. Predictions used to construct pseudo-outcomes should be obtained in a way that limits reuse of the same observation’s outcome in fitting its prediction; cross-fitting is one practical approach. It reduces a source of overfitting, but by itself does not establish that the causal assumptions hold or that the final estimates are unbiased.

Short Derivation of the Combination’s Behavior

For fixed \(x\), the estimate is a weighted average with weights \(\widehat{e}(x)\) and \(1-\widehat{e}(x)\). If \(0\leq\widehat{e}(x)\leq1\), then

$$ \widehat{\tau}_{X}(x)-\widehat{\tau}_1(x) =\widehat{e}(x)\{\widehat{\tau}_0(x)-\widehat{\tau}_1(x)\}. $$

Thus, when \(\widehat{e}(x)\) is near zero, the combined estimate is close to the treated-derived estimate. Similarly,

$$ \widehat{\tau}_{X}(x)-\widehat{\tau}_0(x) =\{1-\widehat{e}(x)\}\{\widehat{\tau}_1(x)-\widehat{\tau}_0(x)\}, $$

so when \(\widehat{e}(x)\) is near one, the combination is close to the control-derived estimate. These identities justify the local weighting interpretation directly. They do not show that either component, or the combination, is close to the true CATE; that depends on data support and model performance.

Worked Example: The Propensity Changes the Combination

At a hypothetical covariate value, suppose the fitted control-derived and treated-derived effect estimates are \(\widehat{\tau}_0(x)=2.8\) and \(\widehat{\tau}_1(x)=4.0\) outcome units. If the estimated treatment propensity is 0.20, then

$$ \widehat{\tau}_{X}(x) =0.20(2.8)+0.80(4.0) =0.56+3.20 =3.76. $$

If the propensity at another covariate value were 0.80 while the two component predictions remained 2.8 and 4.0, the combination would instead be

$$ \widehat{\tau}_{X}(x) =0.80(2.8)+0.20(4.0) =2.24+0.80 =3.04. $$

The different results follow from the different local weights, not from a change in the two component estimates. In an actual analysis, the component predictions would generally also vary with covariates. These calculations illustrate the combination rule; they do not imply that a higher or lower propensity itself causes the effect to change.

Common Mistake and Practical Interpretation

A common mistake is to reverse the weights: “Treatment is rare, so give more weight to the control-derived effect model because there are many controls.” That reasoning overlooks how each pseudo-outcome is constructed. The control-derived model \(\widehat{\tau}_0\) is fitted to control pseudo-outcomes that use the treated outcome model for imputation. The treated-derived model \(\widehat{\tau}_1\) is fitted to treated pseudo-outcomes that use the control outcome model. With rare treatment, the standard combination gives more weight to \(\widehat{\tau}_1\), whose imputation uses the more abundant control group—not to \(\widehat{\tau}_0\).

The correction is to track both parts of the procedure: which group supplies the pseudo-outcome observations, and which outcome model supplies the imputed counterfactual. Then apply the standard weighting formula with \(\widehat{\tau}_0\) denoting the control-derived model and \(\widehat{\tau}_1\) the treated-derived model. Finally, interpret the estimate as a model-based estimate of the CATE under the stated identification conditions, not as a guarantee that imbalance has been solved.

Key takeaway: The X-learner forms two pseudo-outcome models, one from treated observations and one from controls, and combines them as \(\widehat{e}(x)\widehat{\tau}_0(x)+\{1-\widehat{e}(x)\}\widehat{\tau}_1(x)\). Its imputation structure can make it useful under imbalance, but it still requires credible causal identification, adequate overlap, and suitable fitted models.

Check Your Understanding

Answer each question by identifying the group, formula, or assumption involved.

  1. Write the treated and control pseudo-outcomes, and state which outcome model supplies the imputed counterfactual in each.
  2. Under consistency and conditional exchangeability, why does the conditional expectation of either pseudo-outcome equal \(\tau(x)\) when the outcome models are correct?
  3. If \(\widehat{e}(x)=0.10\), which effect model receives the larger combination weight, and what is that model’s training group?
  4. Suppose \(\widehat{\tau}_0(x)=1.5\), \(\widehat{\tau}_1(x)=3.5\), and \(\widehat{e}(x)=0.40\). Calculate \(\widehat{\tau}_X(x)\).
  5. Why does a large overall control sample not by itself solve weak overlap at covariate values with very few treated observations?
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