Tutorials › Propensity Score Matching and Instrumental Variables › Tuning Lasso Propensity Scores for Causal Balance

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

Tuning Lasso Propensity Scores for Causal Balance

Learn to select a lasso propensity-score penalty by assessing covariate balance and overlap, not treatment-prediction loss alone.

Advanced 11 min read

What You'll Learn

  • Distinguish cross-validated treatment-prediction loss from causal balance.
  • Calculate signed standardized mean differences using a fixed pooled standard deviation.
  • Compare candidate lasso penalties against balance and overlap diagnostics.
  • Identify assumptions required for propensity-score weighting to identify a causal effect.
  • Recognize when no penalty gives an acceptable balance–overlap trade-off.

Why the Prediction-Optimal Penalty May Not Be Causally Useful

A lasso propensity model uses a penalty to trade fit against complexity. Cross-validation can choose the penalty that predicts treatment assignment well in held-out observations. But the causal aim of a propensity score is different: to support a comparison of treated and untreated units with similar measured pre-treatment covariates. A penalty with the smallest prediction loss is therefore not automatically the penalty that produces the most useful adjusted comparison.

This tutorial concerns choosing among lasso penalties using both prediction and causal diagnostics. The covariate set is assumed to have been defined in advance; deciding which variables belong in it is a separate task. The treatment is \(A\), where \(A=1\) denotes treatment and \(A=0\) denotes control, and \(X\) is the vector of measured pre-treatment covariates. The propensity score is \(e(X)=P(A=1\mid X)\). A fitted lasso model gives an estimated score \(\hat e_i\) for each unit.

Definition: A balance-guided penalty choice compares candidate values of the lasso penalty parameter \(\lambda\) by assessing how well the resulting scores or score-based adjustment balance measured pre-treatment covariates, while also checking whether the scores support adequate overlap. It does not select a penalty using outcome results.

The usual assumptions that give propensity-score adjustment a causal interpretation remain necessary: consistency of the observed outcome with the potential outcome under the received treatment; conditional exchangeability, \(Y^a\perp A\mid X\) for each treatment level \(a\); and positivity, \(0<P(A=1\mid X)<1\) in the target population. Covariates used for adjustment must precede treatment. Good measured balance is a diagnostic, not proof of exchangeability, correct measurement, or absence of unmeasured confounding.

What Cross-Validation Optimizes

For a logistic lasso, the fitted propensity model estimates treatment probabilities from \(X\), with a penalty that shrinks coefficients and can set some to zero. Larger \(\lambda\) means stronger shrinkage. In \(K\)-fold cross-validation, the model is fit on \(K-1\) folds and its treatment predictions are evaluated on the held-out fold; the process is repeated so every fold is held out. A common criterion is average held-out log loss:

$$ \mathrm{CV}(\lambda) = -\frac{1}{n}\sum_{i=1}^{n} \left\{A_i\log(\hat e_i^{(-k(i))})+ (1-A_i)\log(1-\hat e_i^{(-k(i))})\right\}, $$

Here \(\hat e_i^{(-k(i))}\) is the prediction for unit \(i\) from a model not trained on that unit's fold. Smaller loss indicates better out-of-fold prediction according to this scoring rule. It does not directly measure whether treated and control covariate distributions will be comparable after weighting or matching.

The distinction can be seen from the weighting identity. If \(e(X)\) is the true propensity score and positivity holds, weighting treated units by \(1/e(X)\) and controls by \(1/\{1-e(X)\}\) gives the same covariate distribution in expectation, up to a common normalizing constant. For any integrable function \(g(X)\),

$$ E\left[\frac{A\,g(X)}{e(X)}\right] = E\left[\frac{E(A\mid X)g(X)}{e(X)}\right] = E[g(X)], \qquad E\left[\frac{(1-A)g(X)}{1-e(X)}\right] = E[g(X)]. $$

The identity uses \(E(A\mid X)=e(X)\). It explains why a correct score can balance covariates in the population under inverse-probability weighting. In a finite sample, a penalized estimate need not equal the true score, and predictive accuracy does not guarantee small empirical imbalance. Conversely, a modest sacrifice in prediction loss can sometimes improve the covariate balance and overlap relevant to the planned causal comparison.

Measuring Balance and Checking Overlap

For a continuous covariate \(X_j\), a signed standardized mean difference (SMD) compares its adjusted treated and control means, scaled by a fixed reference standard deviation. One common reference is the unweighted pooled within-group standard deviation before adjustment:

$$ s_{j,\mathrm{pool}} = \sqrt{\frac{s_{1j}^{\,2}+s_{0j}^{\,2}}{2}}, \qquad \mathrm{SMD}_j = \frac{\bar X_{1j,\mathrm{adj}}-\bar X_{0j,\mathrm{adj}}} {s_{j,\mathrm{pool}}}. $$

The signed difference shows which group has the larger adjusted mean; \(|\mathrm{SMD}_j|\) summarizes the magnitude. For a binary covariate, use the adjusted proportions in the numerator and a fixed unweighted pooled standard deviation such as \(\sqrt{\{p_{1j}(1-p_{1j})+p_{0j}(1-p_{0j})\}/2}\) in the denominator. Use the same reference denominator across candidate penalties, so differences in SMDs reflect changes in adjusted group differences rather than changes in scale.

The adjusted means and proportions depend on the target estimand and adjustment method. For an average treatment effect (ATE) weighting comparison, for example, use weights \(A_i/\hat e_i\) for treated units and \((1-A_i)/(1-\hat e_i)\) for controls, then calculate each group’s weighted mean. Other estimands require weights matched to that estimand. Balance should be checked for all relevant measured covariates, not just variables retained with nonzero lasso coefficients.

Overlap is a separate requirement. Inspect the estimated score distributions by treatment group and the resulting weights. Scores near zero or one can create large inverse-probability weights and indicate that some covariate profiles have few plausible comparators. No single score-range rule is universal: judge the diagnostics in relation to the target population and the intended adjustment. A score-based procedure cannot create information where treatment groups do not overlap.

Worked Example: Calculating Signed SMDs After Weighting

Suppose a hypothetical analysis compares two penalties using ATE weights. Before adjustment, a continuous covariate has unweighted standard deviations \(s_{1}=4\) in the treated group and \(s_{0}=3\) in the control group. After weighting under candidate penalty \(\lambda=0.20\), the weighted treated mean is \(9.25\) and the weighted control mean is \(8.90\). Calculate the signed SMD.

First calculate the fixed reference standard deviation:

$$ s_{\mathrm{pool}} = \sqrt{\frac{4^2+3^2}{2}} = \sqrt{12.5} = 3.536. $$

Then substitute the adjusted means in treated-minus-control order:

$$ \mathrm{SMD} = \frac{9.25-8.90}{3.536} = \frac{0.35}{3.536} = 0.0990. $$

The positive sign indicates that the weighted treated mean remains higher. Its magnitude is about \(0.099\) reference standard deviations. The calculation describes this covariate only; it does not establish overall balance or validate the causal assumptions.

A Practical Penalty-Selection Workflow

A defensible choice uses a prespecified set of candidate penalties and evaluates prediction, balance, and overlap together. Balance thresholds such as an absolute SMD below \(0.10\) are conventions, not guarantees of no bias; choose and justify criteria in the context of the analysis. The penalty should not be selected by searching for the most favorable treatment-effect estimate.

1
Fit candidate models.
Use the same prespecified pre-treatment feature set, treatment definition, and fitting procedure across candidate values of \(\lambda\). Record the cross-validated prediction criterion.
2
Generate the planned adjustment.
For each penalty, calculate scores and apply the weighting or matching approach intended for the target estimand. Do not compare balance under one adjustment with overlap under an unrelated procedure.
3
Evaluate balance and overlap.
Calculate signed SMDs for covariates and inspect their absolute values, score distributions, and weight extremes. Look for patterns of residual imbalance, not only the single largest value.
4
Choose and report transparently.
Select a penalty that gives acceptable balance without unacceptable overlap problems, considering prediction loss as one input. Report the candidate criteria, the reason for the choice, and sensitivity to nearby penalties.

Worked Example: Cross-Validation and Balance Favor Different Penalties

In a hypothetical dataset, three candidate lasso penalties produce the following summaries. The worst absolute SMD is the largest \(|\mathrm{SMD}_j|\) across the prespecified covariates after the intended weighting. The score ranges are observed ranges, not universal acceptability cutoffs.

\(\lambda\)Cross-validated log lossWorst absolute SMDObserved score range
0.050.4820.0850.03 to 0.97
0.100.4760.1200.06 to 0.94
0.200.4890.0900.10 to 0.90

Cross-validation alone selects \(\lambda=0.10\), because \(0.476\) is the smallest loss. But its worst absolute SMD, \(0.120\), exceeds a prespecified working criterion of \(0.10\). The \(\lambda=0.20\) model has slightly higher loss, \(0.489\), while its worst absolute SMD is \(0.090\) and its observed scores are less extreme. For an ATE, a score of \(0.03\) can imply a treated-unit weight of \(1/0.03=33.3\); a score of \(0.10\) implies a corresponding weight of \(10\). Thus, if the analysis had also prespecified that scores below \(0.05\) or above \(0.95\) required review, \(\lambda=0.20\) would satisfy both working criteria, while \(\lambda=0.05\) would not.

This comparison supports considering \(\lambda=0.20\), not declaring it universally correct. The analyst should inspect balance covariate by covariate, confirm that the relevant population remains represented, and report the trade-off. If a criterion fails for every candidate, selecting the least-bad row does not make the failure disappear.

Limitations, Diagnostics, and Common Mistakes

Penalty tuning cannot repair a poorly chosen feature set, unmeasured confounding, or lack of positivity. A model may show good average balance while leaving important subgroup differences, nonlinear relationships, or tail behavior inadequately represented. This tutorial’s SMD comparison is useful but does not replace substantive review of the covariates and score distributions. Later diagnostics can examine high-dimensional balance patterns in more depth.

Cross-validation folds should preserve the treatment structure sufficiently for stable fitting and evaluation; very small or highly unbalanced samples can make fold-level estimates noisy. Because a balance-guided choice is itself data-adaptive, it should be prespecified where possible and described as a selection procedure. Repeatedly changing the candidate set until a favorable balance table appears can make the reported diagnostic misleading.

  • Choosing only the smallest prediction loss. Prediction loss measures how well treatment is predicted, not whether the planned adjusted groups are balanced. Compare balance and overlap before choosing.
  • Using an absolute difference to report direction. An absolute SMD has no sign. Use the signed treated-minus-control difference divided by the reference standard deviation, then use its absolute value to describe magnitude.
  • Treating an SMD threshold as proof. A small measured SMD does not prove exchangeability or remove bias from unmeasured variables. It is a diagnostic for measured covariates.
  • Ignoring poor overlap because balance looks good. Weighting can make a summary balance statistic appear favorable while relying on a few extreme weights. Inspect score and weight distributions as well.
  • Choosing by the causal estimate. Selecting \(\lambda\) because it produces a preferred effect estimate uses outcome results to tune the design and can distort inference. Base the choice on prespecified prediction and design diagnostics.
Key takeaway: Cross-validation identifies a penalty for treatment prediction under its chosen loss; balance-guided assessment asks whether the resulting causal adjustment compares similar measured covariate profiles with adequate overlap. Neither diagnostic substitutes for the causal assumptions.

Worked Example: Making a Balance-Guided Decision

Consider a hypothetical analysis with a prespecified requirement that every measured covariate have \(|\mathrm{SMD}|<0.10\), alongside a review of extreme scores. Candidate penalties \(\lambda=0.08\) and \(\lambda=0.16\) have worst absolute SMDs \(0.07\) and \(0.09\), respectively. Their score ranges are \(0.02\) to \(0.98\) and \(0.08\) to \(0.92\). Cross-validation favors \(0.08\) by a small amount.

Both candidates meet the stated SMD criterion. However, the \(0.08\) model includes scores as low as \(0.02\), corresponding to an ATE treated weight of \(1/0.02=50\); the \(0.16\) model’s minimum score \(0.08\) corresponds to a maximum treated weight of \(1/0.08=12.5\) at that endpoint. If the prespecified overlap review flags such extreme weights for investigation, the small predictive advantage of \(0.08\) is not decisive. The analyst should inspect which observations generate the extremes and assess whether the intended target population remains credible under either choice.

Suppose further that the extreme weights under \(0.08\) come from a small set of units with no plausible controls. Then choosing \(0.16\) may be more defensible if it retains acceptable balance and overlap, but the score range alone is not enough to establish that conclusion. If neither candidate supports the target comparison, the honest conclusion is that this tuning exercise has not produced an adequate adjustment for that target.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. A lasso penalty has the lowest cross-validated log loss but leaves a worst absolute SMD of \(0.14\). What does the loss establish, and what does it not establish?
  2. A covariate has adjusted treated and control means \(12\) and \(10\), with reference pooled standard deviation \(4\). Calculate and interpret the signed SMD.
  3. For an ATE weighting analysis, what treated-unit weight corresponds to an estimated propensity score of \(0.04\)? What diagnostic concern does this raise?
  4. Why should the reference standard deviation be held fixed when comparing SMDs across candidate penalties?

Solutions. (1) The loss establishes that this candidate had the best held-out treatment prediction among those compared under the chosen loss. It does not establish adequate covariate balance; a worst absolute SMD of \(0.14\) exceeds the stated \(0.10\) working criterion. (2) \(\mathrm{SMD}=(12-10)/4=0.50\). It is positive, so the adjusted treated mean is higher by half a reference standard deviation. (3) The treated weight is \(1/0.04=25\). This is a potentially influential weight, so inspect overlap and the observations contributing to the weight; it is not by itself proof that the analysis is invalid. (4) A common denominator keeps the scale consistent, so changes in SMDs across penalties reflect changes in adjusted mean differences rather than changing reference variability.

Clinical Biostats