Tutorials › Propensity Score Matching and Instrumental Variables › Estimating Propensity Scores for Subclassification

Weighting and Stratification · Tutorial 218 of 699

Estimating Propensity Scores for Subclassification

Learn to estimate propensity scores from pretreatment covariates, assign observations to score strata, and calculate within-stratum treatment contrasts while checking whether the model supports credible comparisons.

Intermediate 10 min read

What You'll Learn

  • Define a propensity score and distinguish it from a treatment assignment or outcome model
  • Fit a logistic propensity-score model using maximum likelihood
  • Calculate predicted treatment probabilities from fitted coefficients
  • Assign observations to score-based strata and compute within-stratum contrasts
  • Diagnose poor overlap, covariate imbalance, and sparse treatment groups within strata
  • Recognize how model misspecification and post-treatment covariates can undermine subclassification

Why Estimate Propensity Scores for Subclassification?

Subclassification compares treated and untreated units within groups formed from their estimated probabilities of receiving treatment. Those probabilities summarize measured pretreatment covariates: units with similar scores have similar modeled chances of treatment. To use the method, analysts first need a treatment-assignment model that produces scores for every unit, then must check that the scores support comparisons within the chosen strata.

A fitted score is not itself an effect estimate, and a good-fitting treatment model does not guarantee that confounding has been removed. Its role is to guide the formation of groups in which treatment and control units can be compared. The validity of a causal interpretation still depends on the assumptions below and on adequate covariate balance within strata.

Definition: Let \(A_i\) indicate whether unit \(i\) receives treatment (\(A_i=1\)) or control (\(A_i=0\)), and let \(X_i\) denote its measured pretreatment covariates. The propensity score is \(e(X_i)=P(A_i=1\mid X_i)\). An estimated propensity score, \(\hat e_i\), is the predicted probability obtained by fitting a model for treatment assignment and evaluating it at \(X_i\).

Assumptions and Model Setup

The propensity-score model predicts treatment assignment, not the outcome. In a common specification, the conditional probability of treatment follows a logistic regression:

$$ \operatorname{logit}\{e(X_i)\} = \log\!\left(\frac{e(X_i)}{1-e(X_i)}\right) = \beta_0+\beta_1X_{i1}+\cdots+\beta_pX_{ip}. $$

Here, \(X_{i1},\ldots,X_{ip}\) are recorded before treatment, and the coefficients describe how those covariates relate to the log odds of treatment. Once the coefficients are estimated, the predicted score is

$$ \hat e_i = \frac{\exp(\hat\beta_0+\hat\beta_1X_{i1}+\cdots+\hat\beta_pX_{ip})} {1+\exp(\hat\beta_0+\hat\beta_1X_{i1}+\cdots+\hat\beta_pX_{ip})}. $$

For a causal comparison, the model is only one part of the design. The key assumptions include consistency (the observed outcome under the received treatment equals the corresponding potential outcome), conditional exchangeability (given measured \(X_i\), treatment assignment is independent of potential outcomes), and positivity (each covariate profile of interest has a nonzero probability of either treatment). These assumptions are not established by fitting a logistic regression. In particular, exchangeability requires that relevant confounders have been measured and included appropriately.

The model also needs a useful functional form. A linear predictor in the original covariates may be inadequate if treatment assignment depends on nonlinear terms or interactions. Researchers should choose covariates based on subject-matter knowledge and their relevance to treatment assignment and outcomes, rather than selecting them only to maximize prediction accuracy. Include pretreatment covariates; conditioning on variables affected by treatment can create bias rather than control confounding.

Fitting the Model and Obtaining Scores

For independent units with binary treatment indicators, logistic regression estimates the coefficients by maximum likelihood. For a proposed coefficient vector \(\beta\), the likelihood is the probability of the observed treatment assignments under the model:

$$ L(\beta) = \prod_{i=1}^{n} e(X_i)^{A_i}\{1-e(X_i)\}^{1-A_i}. $$

The fitted coefficients maximize this likelihood; equivalently, they maximize its logarithm. For the logistic model, differentiating the log-likelihood with respect to each coefficient gives the score equations. For example, the intercept equation is \(\sum_i\{A_i-\hat e_i\}=0\), and a coefficient for covariate \(X_{ij}\) has equation \(\sum_iX_{ij}\{A_i-\hat e_i\}=0\). These equations express model-based agreement between observed and predicted treatment totals, including covariate-weighted totals. They do not, by themselves, prove that covariates are balanced within subclassification strata.

Worked Example: Calculating One Predicted Score

Suppose a hypothetical fitted logistic model is \(\operatorname{logit}\{\hat e_i\}=-2+0.8X_{i1}+0.7X_{i2}\), where \(X_{i1}\) is age in decades above a reference age and \(X_{i2}\) indicates comorbidity. For a 70-year-old with a comorbidity, the coded values are \(X_{i1}=2\) and \(X_{i2}=1\). Calculate the linear predictor:

$$ \hat\eta_i=-2+0.8(2)+0.7(1)=0.3. $$

Transform this log odds to a probability:

$$ \hat e_i = \frac{\exp(0.3)}{1+\exp(0.3)} = \frac{1.3498588}{2.3498588} \approx 0.5744. $$

The fitted model assigns this hypothetical person an estimated 57.44% probability of treatment. This is a model-based prediction, not a statement that the person actually received treatment with that probability after the assignment occurred.

The balancing-score property helps explain why the true propensity score is useful. Conditional on the true score, treatment is independent of the measured covariates in distribution. For any fixed score value \(e\), the probability of treatment given covariates is \(e\) for every covariate profile with that score. Thus, among units at that score, treated and control units have the same covariate distribution. In practice, the score is estimated and observations are grouped into ranges, so this exact property does not automatically hold within empirical strata.

$$ P(A=1\mid e(X)) = E\{P(A=1\mid X)\mid e(X)\} = E\{e(X)\mid e(X)\} = e(X). $$

From Predicted Scores to Within-Stratum Contrasts

After calculating \(\hat e_i\), assign units to strata according to their scores, often using score quantiles as described in the earlier material on forming propensity-score strata by quantiles. The estimated score should be calculated for both treated and control units using the same fitted model. Within a stratum, compare the observed outcomes of its treated and control units. For a continuous outcome, the unadjusted stratum contrast is the treated mean minus the control mean:

$$ \hat\tau_s = \bar Y_{1s}-\bar Y_{0s}. $$

This contrast is descriptive unless the causal assumptions are credible and the stratum contains comparable treated and control units. A stratum with no observations in one treatment group has no within-stratum contrast. Even when both groups are present, substantial remaining covariate differences can leave residual confounding.

Worked Example: Scores, Stratum Assignment, and Covariate Support

Consider a hypothetical dataset with eight units. A logistic model fitted to a larger hypothetical sample has coefficients \(\hat\beta_0=-1.5\), \(\hat\beta_1=0.5\), and \(\hat\beta_2=0.8\), with \(\hat\eta_i=-1.5+0.5X_{i1}+0.8X_{i2}\). The following table gives each unit’s covariates and predicted score. For illustration, assign the four lowest scores to a lower-score stratum and the four highest to a higher-score stratum.

Unit\(X_{i1}\)\(X_{i2}\)\(\hat\eta_i\)\(\hat e_i\)Stratum
A00-1.50.1824Lower
B10-1.00.2689Lower
C01-0.70.3318Lower
E20-0.50.3775Lower
D11-0.20.4502Higher
F020.10.5250Higher
G210.30.5744Higher
H120.60.6457Higher

For unit G, for example, \(\hat\eta_G=-1.5+0.5(2)+0.8(1)=0.3\), so \(\hat e_G=\exp(0.3)/\{1+\exp(0.3)\}\approx0.5744\). The ordering in the table follows the predicted probabilities. This particular split is only an illustration of score-based assignment; an actual analysis must choose its strata using a prespecified rule appropriate to the sample and then assess within-stratum balance.

The scores range from 0.1824 to 0.3775 in the lower group and from 0.4502 to 0.6457 in the higher group. Within each of these broad ranges, scores are not identical. Therefore, assignment to the same stratum does not guarantee that treated and control units have equal covariate distributions. The split is meaningful only if both treatment groups occur in each stratum and diagnostics support adequate comparability.

Worked Example: Computing Contrasts Within Two Strata

Now suppose the same eight hypothetical units have the following treatment indicators and continuous outcomes. Outcomes are in points on a hypothetical scale. The lower-score stratum contains two treated units (B and E) and two controls (A and C); the higher-score stratum contains two treated units (F and G) and two controls (D and H).

StratumUnitTreatment \(A_i\)Outcome \(Y_i\)
LowerA04
LowerB17
LowerC05
LowerE18
HigherD06
HigherF19
HigherG110
HigherH07

In the lower-score stratum, the treated mean is \((7+8)/2=7.5\) points and the control mean is \((4+5)/2=4.5\) points. Thus,

$$ \hat\tau_{\text{lower}}=7.5-4.5=3.0\text{ points}. $$

In the higher-score stratum, the treated mean is \((9+10)/2=9.5\) points and the control mean is \((6+7)/2=6.5\) points. Thus,

$$ \hat\tau_{\text{higher}}=9.5-6.5=3.0\text{ points}. $$

Both contrasts are computable because each stratum contains treated and control observations. They are within-stratum observed differences; a causal interpretation additionally requires the assumptions to hold and measured covariates to be adequately balanced. In particular, these small illustrative groups cannot establish that there is no residual confounding.

Diagnostics, Alternatives, and Limitations

Diagnostics should evaluate whether the fitted scores and the resulting strata support the intended comparisons, not merely whether the regression converged. Inspect the score distributions separately for treated and control units, and check whether both groups are represented across the score range relevant to the target population. Within each stratum, compare the distributions of important covariates between treatment groups. A model can predict treatment well yet produce poor covariate balance for causal analysis; conversely, a modest prediction model may be adequate if the resulting strata balance relevant covariates.

  • Limited overlap: if a stratum contains only treated units or only controls, a within-stratum contrast cannot be calculated. Very sparse groups can also make contrasts unstable.
  • Residual imbalance: differences in covariate means or distributions within strata indicate that grouping has not sufficiently controlled those measured covariates. Consider revising the model or stratification design and reassessing balance.
  • Separation or extreme fitted scores: when covariate patterns nearly determine treatment, logistic estimates may be unstable or scores may approach zero or one. This often signals weak empirical support for comparisons, not a problem that can be fixed by interpreting predictions as certainty.
  • Model misspecification: omitted nonlinear terms, interactions, or important confounders can yield scores that do not balance relevant covariates. Check balance directly rather than relying only on coefficient significance or a global fit statistic.

Subclassification is one of several ways to use propensity scores. Matching pairs units with similar scores; weighting assigns contributions according to score-based weights; regression adjustment models the outcome conditional on covariates. Each approach has different implementation and sensitivity properties. Subclassification offers transparent within-group comparisons, but grouping discards some score detail, and too few broad strata can leave residual imbalance while excessive subdivision can create sparse groups. No approach removes bias from unmeasured confounding simply by using a fitted propensity score.

Common mistake: “The treatment model predicts assignment accurately, so its strata must be balanced and the within-stratum differences are causal.” Prediction accuracy is not a balance diagnostic, and neither is proof of exchangeability. Check overlap and covariate balance within strata, verify that the model uses appropriate pretreatment covariates, and state the causal assumptions required for interpretation.

Check Your Understanding

Answer the questions, then compare with the worked solutions below.

  1. A fitted model gives \(\hat\eta=-0.4\) for a unit. Calculate its predicted propensity score to four decimal places.
  2. In one stratum, treated outcomes are 8 and 10 points, while control outcomes are 5 and 7 points. Calculate the within-stratum treated-minus-control contrast.
  3. Why is a covariate measured after treatment generally not a suitable predictor in the propensity-score model?
  4. A stratum contains five treated units and no control units. Can its within-stratum treatment-control contrast be estimated? What does this indicate?

Solutions. (1) \(\hat e=\exp(-0.4)/\{1+\exp(-0.4)\}=0.6703/1.6703\approx0.4013\). (2) The treated mean is \((8+10)/2=9\) points and the control mean is \((5+7)/2=6\) points, so the contrast is \(9-6=3\) points. (3) A post-treatment covariate may be affected by treatment; conditioning on it can introduce bias or block part of the treatment effect, rather than control pretreatment confounding. (4) No. The control mean, and therefore the contrast, is unavailable in that stratum. This lack of treatment overlap means the data do not support a within-stratum comparison there.

Clinical Biostats