Tutorials › Propensity Score Matching and Instrumental Variables › Cross-Fitting High-Dimensional Propensity Models

Time-Varying and High-Dimensional Confounding · Tutorial 638 of 699

Cross-Fitting High-Dimensional Propensity Models

Build fold-specific propensity predictions correctly, use them in weighting, and diagnose what cross-fitting can—and cannot—protect against.

Advanced 10 min read

What You'll Learn

  • Define training and held-out folds for cross-fitted propensity estimation.
  • Distinguish out-of-fold predictions from full-sample fitted scores.
  • State the split-independence condition needed for a conditional treatment-mean argument.
  • Compute normalized inverse-probability weighted means using cross-fitted scores.
  • Identify leakage, tuning, overlap, and model-misspecification failures.
  • Explain why cross-fitting alone does not guarantee valid causal estimates.

Why Cross-Fit Propensity Scores?

A propensity model may use many candidate covariates and regularization to estimate the probability of treatment. When the same observations both determine the model and receive its fitted scores, a fitted score can partly reflect that observation’s own treatment assignment. Cross-fitting separates those roles: each person’s score is predicted by a model fitted without that person. The construction is especially useful when the propensity model is estimated with a high-dimensional procedure, but it is not a substitute for choosing an appropriate causal design or model.

The key object is the true propensity score \(e_0(X_i)=P(A_i=1\mid X_i)\), where \(A_i\) is the binary treatment indicator and \(X_i\) is the vector of pre-treatment covariates. The fitted score is an estimate of this conditional probability. In a regularized logistic model, a training sample is used to estimate coefficients, often with an \(L_1\) penalty; the resulting model predicts treatment probabilities for observations it did not use in fitting.

Definition: In \(K\)-fold cross-fitting, the observations are partitioned into disjoint folds \(I_1,\ldots,I_K\). For each fold \(k\), fit the propensity model using observations outside \(I_k\), then predict \(e_0(X_i)\) for every \(i\in I_k\). The resulting out-of-fold prediction is denoted \(\hat e_i^{(-k)}\), where the superscript indicates that fold \(k\) was excluded from fitting. Each observation receives exactly one such prediction.

For a regularized logistic propensity model, one possible training-fold fit is

$$ \hat\beta^{(-k)} = \arg\min_{\beta} \left\{ -\frac{1}{n_{-k}}\sum_{j\notin I_k} \left[A_j\log \operatorname{expit}(X_j^\mathsf{T}\beta) +(1-A_j)\log\{1-\operatorname{expit}(X_j^\mathsf{T}\beta)\}\right] +\lambda_k\|\beta\|_1 \right\}, \qquad \hat e_i^{(-k)}=\operatorname{expit}(X_i^\mathsf{T}\hat\beta^{(-k)}), \quad i\in I_k. $$

Here \(n_{-k}\) is the training-set size, \(\lambda_k\) is the penalty level, and \(\operatorname{expit}(u)=1/(1+\exp(-u))\). Other regularization schemes can be used; the defining feature of cross-fitting is the fold-specific exclusion, not a particular penalty. If a penalty is selected from the data, its selection must also avoid using held-out treatment labels in a way that leaks information into their predictions. A safe general approach is to select or tune within the training data for each fold, or to fix the tuning procedure in advance and apply it separately within each training set.

Constructing and Interpreting the Folds

The partition should be specified so that, for the conditional argument below, fold assignment is independent of the held-out treatment assignments. A simple sufficient design is to generate the fold labels randomly, independently of all observed records, before fitting the models. With independent observations, fitting fold \(k\)'s model only on other observations then ensures that the held-out person’s treatment is not used to construct their score.

This condition matters. Independence of the observations and exclusion of person \(i\) from the training set do not alone establish that the treatment probability remains \(e_0(X_i)\) after conditioning on fold membership. If fold membership was assigned using treatment labels, conditioning on that membership may change the treatment distribution. For example, putting every treated person in one fold and every untreated person in another makes treatment status fixed within each fold. A conditional-mean argument that ignores this treatment-dependent assignment is not valid. Treatment-stratified folds can be useful computationally, particularly when treatment is rare, but their conditional justification is not the same as that for treatment-independent random folds.

The following short derivation states exactly what the usual argument provides. Assume independent observations, a split generated independently of the observed records, and a fit for fold \(k\) that uses only observations outside \(I_k\). Conditional on the training data, the split, and \(X_i\), the fitted prediction \(\hat e_i^{(-k)}\) is fixed. Under these assumptions, the held-out \(A_i\) has its original conditional treatment probability:

$$ E[A_i\mid X_i,\text{training data},\text{split}] = E[A_i\mid X_i] = e_0(X_i), \qquad i\in I_k. $$

It follows by subtracting the fixed prediction that

$$ E[A_i-\hat e_i^{(-k)} \mid X_i,\text{training data},\text{split}] = e_0(X_i)-\hat e_i^{(-k)}. $$

This is not generally zero: it becomes zero only if the fitted prediction equals the true propensity at that covariate value (or under an appropriate averaging condition). Thus cross-fitting prevents the held-out treatment assignment from directly influencing its own fitted score; it does not make propensity predictions unbiased or guarantee correct specification.

Worked Example: Assigning Out-of-Fold Predictions

Suppose six hypothetical patients are assigned to three folds, two patients per fold. An \(L_1\)-penalized logistic model is fitted separately on the four patients outside each fold. The fitted probabilities shown below are predictions from the model that excluded the patient’s fold.

PatientFoldTreatment \(A_i\)Out-of-fold score \(\hat e_i^{(-k)}\)
1110.62
2100.28
3210.71
4200.43
5310.77
6300.34

For patient 3, the score is obtained by fitting on patients 1, 2, 5, and 6, then evaluating that fitted model at \(X_3\). It is not the score from a model fitted on all six patients. The same exclusion rule applies to each row. The vector of scores to use in subsequent calculations is therefore \((0.62,0.28,0.71,0.43,0.77,0.34)\), with one held-out prediction per patient.

The split is appropriate for the conditional argument if the fold assignments were generated independently of the treatment assignments. The table itself does not reveal how the folds were assigned, so that design condition must be checked from the analysis procedure rather than inferred from the predictions.

Using Cross-Fitted Scores for Weighting

For an average treatment effect, an inverse-probability weighted estimator can use each person’s out-of-fold score. A normalized (Hájek) form compares the weighted outcome mean among treated people with the weighted mean among untreated people:

$$ \hat\tau = \frac{\sum_{i=1}^{n} A_iY_i/\hat e_i^{(-k(i))}} {\sum_{i=1}^{n} A_i/\hat e_i^{(-k(i))}} - \frac{\sum_{i=1}^{n} (1-A_i)Y_i/\{1-\hat e_i^{(-k(i))}\}} {\sum_{i=1}^{n} (1-A_i)/\{1-\hat e_i^{(-k(i))}\}}, $$

where \(k(i)\) is the fold containing person \(i\), and \(Y_i\) is the observed outcome. The formula normalizes each treatment group’s weights to sum to one. It does not by itself establish a causal interpretation: that also depends on the target estimand, consistency, conditional exchangeability given the adjusted covariates, positivity, and adequate estimation of the propensity scores.

Worked Example: A Normalized Weighted Contrast

Consider six hypothetical patients with outcomes \(Y_i\), treatment indicators, and cross-fitted scores as follows. The scores are assumed to have been generated by independent folds as described above.

Patient\(A_i\)\(Y_i\) (outcome units)\(\hat e_i^{(-k)}\)
11100.60
2060.30
31120.70
4080.40
51110.80
6050.20

For treated patients, the inverse-probability weights are \(1/0.60=1.667\), \(1/0.70=1.429\), and \(1/0.80=1.250\). The normalized treated mean is

$$ \frac{10(1.667)+12(1.429)+11(1.250)} {1.667+1.429+1.250} = \frac{47.568}{4.346} \approx 10.95\text{ outcome units}. $$

For untreated patients, the weights are \(1/(1-0.30)=1.429\), \(1/(1-0.40)=1.667\), and \(1/(1-0.20)=1.250\). Their normalized mean is

$$ \frac{6(1.429)+8(1.667)+5(1.250)} {1.429+1.667+1.250} = \frac{28.160}{4.346} \approx 6.48\text{ outcome units}. $$

The estimated weighted contrast is \(10.95-6.48=4.47\) outcome units. This arithmetic illustrates how the cross-fitted scores enter the estimator; the small hypothetical data set cannot establish exchangeability, positivity, or reliable causal estimation.

Diagnostics, Alternatives, and Limits

Cross-fitting changes how predictions are generated, not the criteria for judging them. Inspect the score distribution and the resulting weights, and assess covariate balance using the weighting procedure intended for the analysis. Check whether any scores are near zero or one, whether a small number of observations dominate the weights, and whether balance remains poor for important covariates or feature blocks. A held-out prediction can still be extreme or inaccurate. Cross-fitting does not repair a lack of overlap, omitted confounding, or a misspecified functional form.

The main practical alternatives have different tradeoffs:

ApproachHow predictions are formedMain consideration
Full-sample fitted scoresFit once using every observation and predict on those same observationsUses all data for fitting, but each treatment label can affect its own fitted value.
Single holdout splitFit on one subset and predict only for a separate held-out subsetSeparates fitting and prediction, but discards the training subset from that held-out prediction task and can be sensitive to the split.
\(K\)-fold cross-fittingRotate the held-out fold so every observation receives a prediction from a model excluding itUses observations for training in some folds and prediction in another, but requires multiple fits and careful fold-specific preprocessing.

In every approach, data-dependent preprocessing must be considered part of model fitting. For example, if feature screening, imputation rules, or tuning use treatment information, doing that step once on the full data can leak held-out information even if the final regression is refitted within folds. When a step is learned from the data, learn it using the training portion of each fold and then apply it to that fold’s held-out observations. Also verify that each training fold contains enough treated and untreated observations for the chosen fitting procedure to operate reliably.

Cross-fitting is particularly relevant when an analysis uses an estimator whose theoretical behavior benefits from separating nuisance-model fitting from evaluation of the same observations. Its guarantees depend on the estimator and its assumptions; cross-fitting alone does not supply a general guarantee of low bias, valid uncertainty intervals, or causal identification. In particular, a propensity-only weighted contrast does not become robust to misspecification merely because the scores are out of fold. Whether additional nuisance models or orthogonal estimators are appropriate is a separate methodological choice.

Common Mistakes

  • Calling a score cross-fitted when the observation helped fit it. A full-sample fitted value is not out of fold. Record which training observations produced each prediction.
  • Assuming a held-out treatment has its original conditional probability under any split. That equality needs a split independent of held-out treatment assignments, or a separate argument for the particular assignment design. Treatment-dependent folds require special care.
  • Treating cross-fitting as a cure for misspecification. The conditional residual mean is \(e_0(X_i)-\hat e_i^{(-k)}\), not necessarily zero. Examine model adequacy and balance.
  • Ignoring unstable weights. A fold-specific score can still be close to zero or one. Diagnose overlap and weight concentration rather than assuming the fold procedure has controlled them.
  • Tuning or screening on held-out labels. This lets the held-out treatment assignment influence its prediction indirectly. Keep data-adaptive steps inside the training fold when their use could cause leakage.
Key takeaway: Cross-fitting means predicting each observation with a propensity model trained without that observation. For the usual conditional treatment-mean argument, fold assignment must preserve the held-out treatment probability; even then, cross-fitting prevents one form of reuse, not misspecification, poor overlap, or confounding.

Check Your Understanding

Answer each question, then compare with the concise solutions below.

  1. In four-fold cross-fitting, which observations are used to predict the score for a person in fold 2?
  2. Why does the conditional equality \(E[A_i\mid X_i,\text{training data},\text{split}]=e_0(X_i)\) require care when fold assignment uses treatment labels?
  3. A cross-fitted score is \(0.10\) for a treated person. What is that person’s treated inverse-probability weight, and what diagnostic concern does it raise?
  4. Does exclusion of an observation from its propensity-model fit imply that its score is unbiased for \(e_0(X_i)\)? Explain.

Solutions. (1) Use the other three folds as the training set; fold 2 is held out. (2) Conditioning on treatment-dependent fold membership can change the conditional distribution of \(A_i\), so the original propensity need not remain the conditional mean. (3) The weight is \(1/0.10=10\); it may be influential and signals a need to inspect overlap and weight concentration. (4) No. Exclusion prevents direct reuse of that person’s treatment in fitting, but model misspecification, regularization bias, and sampling variability can still make the prediction differ from the true propensity.

Clinical Biostats