Tutorials › Propensity Score Matching and Instrumental Variables › Calibration of Estimated Propensity Scores

The Balancing Property and Estimation · Tutorial 134 of 699

Calibration of Estimated Propensity Scores

You will learn to calculate and interpret grouped calibration diagnostics, understand the limited aggregate guarantee from an unpenalized logistic fit, and recognize what calibration can and cannot establish.

Intermediate 10 min read

What You'll Learn

  • Define calibration for estimated probabilities of binary treatment.
  • Compare each group’s mean predicted probability with its observed treatment rate.
  • Calculate an absolute grouped calibration error and an overall calibration-in-the-large difference.
  • Derive the intercept-score identity for a finite, unpenalized logistic maximum-likelihood fit.
  • Recognize why good overall agreement can conceal poor agreement within score ranges.
  • Distinguish calibration from covariate balance and treatment discrimination.

What Calibration Says About Estimated Propensity Scores

An estimated propensity score is a predicted probability of receiving treatment given measured covariates. Calibration asks whether those probabilities agree with observed treatment frequencies. If a collection of individuals is assigned scores near 0.30, for example, a calibrated model should predict that about 30% of such individuals receive treatment, on average. This is a statement about groups of predictions, not a claim that each person's probability can be verified from one observed treatment assignment.

Calibration is useful for assessing whether estimated scores behave like probabilities. It is not, by itself, evidence that the covariates needed for a causal analysis were included, that treatment groups are comparable, or that a causal effect estimate is unbiased. In particular, calibration and covariate balance answer different questions.

Definition: Let \(A_i\) be a binary treatment indicator, equal to 1 for treated and 0 for untreated, and let \(\hat e_i\) be the estimated propensity score for individual \(i\). Scores are calibrated in the population if, among individuals with the same estimated score \(s\), the treatment frequency equals that score: \(P(A_i=1\mid \hat e_i=s)=s\). In finite samples, calibration is assessed approximately, commonly by comparing observed and mean predicted treatment rates within groups of similar scores.

The exact population definition is an ideal: there may be few or no individuals with precisely the same score. A grouped diagnostic approximates it by dividing scores into ranges. For group \(g\), let \(n_g\) be its number of individuals. Its mean predicted probability and observed treatment rate are

$$ \bar{\hat e}_g=\frac{1}{n_g}\sum_{i\in g}\hat e_i, \qquad \hat p_g=\frac{1}{n_g}\sum_{i\in g}A_i. $$

A group is well calibrated when \(\bar{\hat e}_g\) and \(\hat p_g\) are close. A positive difference \(\hat p_g-\bar{\hat e}_g\) means the group had a higher treatment rate than the model predicted; a negative difference means the predicted rate was higher than the observed rate. Because each group contains a finite number of individuals, the two quantities need not match exactly even when predictions are well calibrated.

Grouped Calibration in Practice

A calibration table reports, for each score group, its size, mean estimated score, observed treatment rate, and their difference. Groups may be defined using prespecified score intervals or by dividing the sample into quantile groups. Quantile groups aim for similar group sizes, while fixed intervals retain the same score ranges across samples. Either choice is a summary: changing group boundaries can change the appearance of the diagnostic.

One summary of grouped discrepancies is the weighted absolute calibration error:

$$ \mathrm{ECE}=\sum_{g=1}^{G}\frac{n_g}{n} \left|\hat p_g-\bar{\hat e}_g\right|, \qquad n=\sum_{g=1}^{G}n_g. $$

This quantity is the sample-size-weighted average absolute gap between observed and predicted rates across the chosen groups. It is expressed in probability units, so an ECE of 0.04 is an average gap of four percentage points under that grouping. It does not have a universal pass-or-fail threshold; its value depends on the grouping and the sample.

An overall comparison is the difference between the average predicted probability and the observed treatment proportion:

$$ \frac{1}{n}\sum_{i=1}^{n}\hat e_i-\frac{1}{n}\sum_{i=1}^{n}A_i. $$

This is often called a calibration-in-the-large discrepancy. A value near zero means the model's total predicted number of treated individuals is close to the observed number. It does not show whether predictions agree with treatment frequencies across the range of scores. Positive and negative group discrepancies can cancel in the overall difference.

Worked Example: Reading a Grouped Calibration Table

In a hypothetical sample of 200 individuals, estimated scores are divided into four equal-sized groups. The table gives each group's mean score and its observed number treated.

GroupSize \(n_g\)Mean score \(\bar{\hat e}_g\)TreatedObserved rate \(\hat p_g\)Observed minus predicted
1500.1070.140.04
2500.30160.320.02
3500.55290.580.03
4500.80430.860.06

For group 1, the observed rate is \(7/50=0.14\), compared with a mean predicted probability of 0.10. Its observed-minus-predicted difference is \(0.14-0.10=0.04\), or four percentage points. The same calculation for all groups gives the differences shown. In every group the observed treatment rate is higher than the mean predicted probability.

The weighted absolute calibration error is \( (50/200)(0.04+0.02+0.03+0.06)=0.0375 \). Thus the average absolute grouped gap is 3.75 percentage points for this grouping.

The observed treatment proportion is \( (7+16+29+43)/200=95/200=0.475 \). The average predicted probability, calculated from the group means, is \( [50(0.10+0.30+0.55+0.80)]/200=87.5/200=0.4375 \). The calibration-in-the-large discrepancy is \(0.4375-0.475=-0.0375\), so the average predicted probability is 3.75 percentage points below the observed treatment proportion. These results describe this hypothetical sample; they do not establish why the discrepancies arose or whether a causal analysis is valid.

Why Logistic Maximum Likelihood Can Look Calibrated Overall

For ordinary, unpenalized logistic regression with an intercept, there is a useful algebraic identity. It concerns the fitted sample as a whole and should not be mistaken for a guarantee of calibration within score groups. To derive it correctly, first express the likelihood in terms of parameter-dependent probabilities. Write \(x_i\) for the covariate vector, including an intercept, and define \(e_i(\beta)=\operatorname{logit}^{-1}(x_i^T\beta)\). For observed treatment indicators \(A_i\), the log-likelihood is

$$ \ell(\beta)=\sum_{i=1}^{n}\left\{ A_i\log e_i(\beta)+(1-A_i)\log[1-e_i(\beta)] \right\}. $$

The derivative with respect to the intercept coefficient \(\beta_0\) is obtained while \(e_i(\beta)\) still depends on \(\beta_0\). Since \(\partial e_i(\beta)/\partial\beta_0=e_i(\beta)[1-e_i(\beta)]\), differentiating each likelihood contribution gives

$$ \frac{\partial\ell(\beta)}{\partial\beta_0} =\sum_{i=1}^{n}\{A_i-e_i(\beta)\}. $$

If a finite, unpenalized maximum-likelihood estimate \(\hat\beta\) exists, the likelihood score is zero at that estimate. Substituting \(\hat e_i=e_i(\hat\beta)\) only after taking the derivative gives

$$ \left.\frac{\partial\ell(\beta)}{\partial\beta_0}\right|_{\hat\beta} =\sum_{i=1}^{n}(A_i-\hat e_i)=0, \qquad\text{so}\qquad \sum_{i=1}^{n}A_i=\sum_{i=1}^{n}\hat e_i. $$

The fitted probabilities therefore sum to the observed number treated, and their overall mean equals the observed treatment proportion. This identity relies on the specified likelihood, an intercept, and a finite maximum-likelihood estimate. It is not a general property of every estimation method; for example, a penalty can change the likelihood score equation.

Most importantly, the identity constrains only the total. For instance, suppose two equally sized score groups have mean predictions 0.20 and 0.60, while their observed treatment rates are 0.30 and 0.50. The average prediction is \((0.20+0.60)/2=0.40\), and the overall observed rate is also \((0.30+0.50)/2=0.40\). Yet the group discrepancies are \(0.30-0.20=0.10\) and \(0.50-0.60=-0.10\). The aggregate agreement conceals ten-percentage-point errors in opposite directions. This arithmetic illustrates why grouped checks remain useful even when the overall totals agree.

Worked Example: A Grouped Discrepancy and Its Sampling Scale

Suppose a hypothetical score group contains 40 individuals with mean estimated propensity score 0.25, and 16 receive treatment. The observed rate is \(16/40=0.40\), so the observed-minus-predicted discrepancy is \(0.40-0.25=0.15\), or 15 percentage points. The predicted rate corresponds to an expected count of \(40(0.25)=10\) treated individuals if the scores are calibrated and treated assignments behave like independent Bernoulli outcomes with probability 0.25 within this group.

Under that simplified reference, the standard deviation of the treatment count is \(\sqrt{40(0.25)(1-0.25)}=\sqrt{7.5}=2.739\) individuals. The observed count is 6 above the expected count, or \(6/2.739=2.19\) such standard deviations. This calculation indicates that the difference merits attention; it is not, by itself, a formal test of model calibration. Estimated probabilities, the way the group was formed, and dependence or other sampling features can affect the appropriate uncertainty assessment.

Diagnostics, Comparisons, and Limitations

A grouped table or calibration plot makes patterns easier to see than one aggregate number. Plot mean predicted probability on the horizontal axis and observed treatment rate on the vertical axis, with the 45-degree line representing agreement. Points consistently above that line indicate underprediction of treatment frequency in those groups; points below indicate overprediction. Also inspect group sizes and treatment counts: a rate from a small group is inherently more variable than one from a large group.

Bins simplify interpretation but discard within-group detail. A wide bin can average together regions where the model overpredicts and underpredicts, making the bin appear well calibrated. Very narrow bins can produce unstable rates or empty groups. Fixed score intervals and quantile groups offer different trade-offs, so report how groups were defined and avoid treating one grouping as definitive. A smoother calibration curve can reveal patterns between bins, but it too is an estimate and can vary with the smoothing choices.

Calibration is different from treatment discrimination. Discrimination concerns whether individuals who receive treatment tend to have higher predicted scores than those who do not; calibration concerns whether predicted probabilities match observed frequencies. A model may rank individuals well but systematically predict probabilities that are too high or too low. Conversely, a model predicting the overall treatment proportion for everyone can be calibrated on average while providing little ranking information.

Calibration is also not the same as covariate balance after using propensity scores. Calibration compares predicted treatment probabilities with treatment outcomes. Balance diagnostics assess whether measured covariates are comparable across treatment groups after a specified adjustment. A calibrated treatment-prediction model does not by itself show that the covariates needed for the causal question were measured and modeled adequately. The introductory material on the balancing property gives the separate role of that property; calibration should not be used as its substitute.

Finally, grouped calibration is a sample diagnostic, not proof that estimated probabilities equal the true propensity scores for every individual. A good grouped fit can coexist with poor calibration inside groups, and a poor fit can reflect finite-sample variation as well as model misspecification. Interpret discrepancies alongside group sizes, the prediction range, and the purpose for which the scores will be used.

Common Pitfall

  • Wrong reasoning: “The average fitted score equals the observed treatment proportion, so the propensity model is calibrated.”
  • Correction: Overall equality checks only one aggregate constraint. Group-specific errors can cancel, as in the two-group calculation above. Compare observed rates with mean predictions over multiple score ranges, and remember that even good calibration does not establish covariate balance or causal validity.
  • Wrong reasoning: “A group’s observed rate must equal its predicted rate exactly if the model is correct.”
  • Correction: Treatment is a binary outcome, so observed rates vary from sample to sample. A difference is a diagnostic signal to interpret in light of group size and sampling variability, not automatic proof of failure.
Key takeaway: Calibration asks whether observed treatment frequencies agree with estimated probabilities. Grouped comparisons reveal patterns hidden by overall agreement, but they are approximate diagnostics whose conclusions depend on grouping and sample size.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. A group of 80 individuals has mean estimated score 0.35, and 32 individuals receive treatment. What is its observed rate and observed-minus-predicted discrepancy?
  2. Two equally sized groups have mean predictions 0.20 and 0.60 and observed rates 0.30 and 0.50. Calculate the overall means and explain what the group differences show.
  3. For an unpenalized logistic maximum-likelihood fit with an intercept and a finite estimate, what does the intercept score equation imply about total fitted probabilities?
  4. Why can a model with good treatment discrimination still have poor calibration?
  5. Does good grouped calibration establish that covariates are balanced after propensity-score adjustment? Explain briefly.

Solutions. (1) The observed rate is \(32/80=0.40\); the discrepancy is \(0.40-0.35=0.05\), or five percentage points above prediction. (2) The average prediction is \((0.20+0.60)/2=0.40\), and the average observed rate is \((0.30+0.50)/2=0.40\). Overall agreement is exact, but the group discrepancies are \(+0.10\) and \(-0.10\), so it conceals substantial group-specific disagreement. (3) The intercept score gives \(\sum_i(A_i-\hat e_i)=0\), hence \(\sum_i\hat e_i=\sum_i A_i\): fitted probabilities sum to the observed treatment count. (4) Discrimination concerns ranking treated individuals above untreated individuals, whereas calibration concerns the numerical accuracy of probabilities; good ranking does not prevent systematic overprediction or underprediction. (5) No. Calibration compares predictions with treatment frequencies. Covariate balance is a separate diagnostic and must be assessed directly.

Clinical Biostats