Losses and methods
The loss determines the population for which predictions are calibrated. The method determines the form of the calibration map.
Choose the population
Doubly robust loss: loss="dr"
Use the doubly robust loss to calibrate predictions for the original study population. Supply the propensity score and the conditional outcome means under each treatment as propensity, mu0, and mu1.
The loss uses inverse-propensity weighting, which can lead to unstable estimates when treatment probabilities are close to 0 or 1. This is the construction used in van der Laan et al. (2023) and the DR-learner literature; see Kennedy (2020).
Residualized loss: loss="r"
Use the R-loss to calibrate predictions for an overlap-weighted population. Supply the propensity score and the conditional outcome mean given covariates as propensity and outcome_mean.
The squared treatment residual, (A - e(W))², weights the calibration loss. At the true propensity score, its conditional expectation is e(W)(1 - e(W)), so calibration gives more weight to people whose treatment probabilities are closer to one half. This follows the R-learner construction of Nie and Wager (2021).
This weighting can improve stability under weak overlap, but the calibrated scores describe a different population. Choose this target only if it answers your scientific question.
Check overlap
Start with dr when you want calibration for the original population and overlap is adequate. Use assess_overlap() to inspect propensity-score tails, clipping, and effective sample sizes. Its severity labels and loss recommendation use practical screening cutoffs.
When reporting diagnostics for an R-loss fit, use target_population="overlap" or "both" to include calibration error for the population used in fitting. See Diagnostics.
Choose a calibration method
| Method | Fitted map | When to use it |
|---|---|---|
isotonic |
Nondecreasing step function | Default for flexible monotone calibration |
monotone_spline |
Smooth nondecreasing spline | When you want a smooth calibration curve |
linear |
Intercept and nonnegative slope | When a simple shift and rescaling are adequate |
histogram |
Constant within each score bin | For binwise calibration or a diagnostic comparison |
The package implements isotonic with a single monotone LightGBM regression tree. It supports observation weights, minimum leaf size through min_child_samples, and constant predictions beyond the observed score range. The R implementation uses lightgbm through reticulate.
monotone_spline uses nonnegative derivative coefficients and a smoothness penalty. Pass tuning options through method_options.
Choose standard calibration or cross-calibration
Use standard calibration with predictions on a separate calibration sample. Use cross-calibration when you have pooled out-of-fold predictions and a matrix of predictions from each fold-specific model.