Package overview

Calibrated Prediction-Powered Inference

Circular ppi_aipw package badge with a calibration plot

Estimate a population mean using a small labeled sample and predictions on a larger unlabeled sample. ppi_aipw calibrates the predictions on the labeled outcomes, then computes an AIPW estimate with a standard error and confidence interval.

Use predictions from an existing model; no retraining is needed.

Install

Install the package

Use PyPI for the release, GitHub for the current source, or an editable install for local development. The native R package has a separate R page.

PyPI install

python -m pip install ppi-aipw

GitHub install

python -m pip install "git+https://github.com/Larsvanderlaan/ppi-aipw.git"

Local editable install

python -m pip install -e .

Quickstart

Core inputs and defaults

Pass the outcomes and predictions to mean_inference(...). The result includes the estimate, standard error, confidence interval, fitted calibrator, and diagnostics.

For a runnable example, the quickstart notebook opens directly in Colab and covers both the mean and causal APIs.

For data-adaptive selection, set method="auto" and pass candidate_methods=("aipw", "linear", "monotone_spline", "isotonic"). Selection uses num_folds=100 by default, capped at the labeled sample size.

Use result.summary() for estimates, intervals, and p-values. Use calibration_diagnostics(result, Y, Yhat) for an optional out-of-fold calibration check.

Y

Observed outcomes for the labeled sample.

Yhat

Predictions on the same labeled rows.

Yhat_unlabeled

Predictions on the unlabeled sample.

method

Choose "aipw", "linear", "prognostic_linear", "sigmoid", "monotone_spline", "isotonic", or "auto".

cross_fit

Defaults to False. Set True to fit calibration, method selection, and efficiency scaling on training folds and evaluate on held-out observations from both samples.

calibration_folds

Number of honest calibration folds, default 10. Use len(Y) for leave-one-out labeled calibration when the unlabeled sample is larger.

candidate_methods

Candidate methods considered when method="auto" minimizes a cross-validated variance estimate. If "aipw" is included, the selector also compares a rescaled AIPW candidate.

num_folds

Number of folds used by method="auto". The default is 100 and it is capped at the labeled sample size.

inference

Choose "wald" for a fast analytic interval, "jackknife" for a V-fold jackknife interval with Student t critical values, or "bootstrap" for percentile bootstrap intervals.

efficiency_maximization

Optional rescaling to lambda m(X). For method="aipw", m(X) is the raw score; otherwise it is the calibrated score.

w, w_unlabeled

Optional observation weights for labeled and unlabeled samples. Uniform weights reproduce the unweighted estimator.

X, X_unlabeled

Optional extra covariates for method="prognostic_linear". The score and intercept are unpenalized; extra covariates use ridge tuning on the labeled sample.

Calibration

What calibration changes

A score can rank outcomes well while predicting values that are too high or too low.

Prediction

A calibrated score of 0.8 corresponds to an average outcome of 0.8. Calibration estimates this relationship from the labeled sample and adjusts the original predictions.

Inference

AIPW averages predictions over both samples and adds the average residual from the labeled sample. Calibrating the predictions can reduce the variability of those residuals and improve precision.

Methods

Choose a calibration method

Compare the fitted curves, assumptions, and options below.

Default

Monotone spline calibration

Fits a smooth nondecreasing curve to the labeled outcomes, then uses the calibrated predictions in AIPW. This is the default method.

Calibration Map

A smooth nondecreasing curve adjusts the score while preserving its ordering. The plot is schematic.

Calibrated score mn*(X)
Original score m(X)

When to use it

    Tradeoffs

      Intervals

      Wald, jackknife, and bootstrap intervals

      Wald intervals use an analytic standard error. Jackknife and bootstrap intervals refit calibration. Jackknife uses jackknife_folds=10 and Student t critical values.

      Wald intervals

      Uses an analytic standard error and a normal approximation.

      Calculation Analytic standard error
      Cost Low
      Refitting No resampling

      References

      Selected references

      The calibration methods here can be viewed as special cases of calibrated debiased machine learning and targeted minimum loss estimation.

      The AIPW baseline cited above goes back to Robins, Rotnitzky, and Zhao (1994), "Estimation of regression coefficients when some regressors are not always observed", Journal of the American Statistical Association 89(427): 846-866.

      Calibration references:

      • Zadrozny and Elkan (2001), "Obtaining calibrated probability estimates from decision trees and naive Bayesian classifiers", ICML 2001: 609-616.
      • Zadrozny and Elkan (2002), "Transforming classifier scores into accurate multiclass probability estimates", KDD 2002: 694-699.
      • Jiang, Osl, Kim, and Ohno-Machado (2011), "Smooth isotonic regression: a new method to calibrate predictive models", AMIA Joint Summits on Translational Science Proceedings 2011: 16-20.

      Semiparametric, debiased/targeted machine learning foundations:

      • Robins, Rotnitzky, and Zhao (1994), "Estimation of regression coefficients when some regressors are not always observed", Journal of the American Statistical Association 89(427): 846-866.
      • Robins and Rotnitzky (1995), "Semiparametric efficiency in multivariate regression models with missing data", Journal of the American Statistical Association 90(429): 122-129.
      • van der Laan and Robins (2003), Unified Methods for Censored Longitudinal Data and Causality.
      • van der Laan and Rubin (2006), "Targeted maximum likelihood learning".
      • van der Laan and Rose (2011), Targeted Learning: Causal Inference for Observational and Experimental Data.
      • Li, Ertefaie, and van der Laan (2026), The V-fold jackknife for semiparametric inference.
      • van der Laan, Luedtke, and Carone (2024), "Doubly robust inference via calibration".

      Prognostic-score adjustment and efficiency maximization:

      • Rubin and van der Laan (2008), "Empirical efficiency maximization: improved locally efficient covariate adjustment in randomized experiments and survival analysis", The International Journal of Biostatistics 4(1).
      • Hansen (2008), "The prognostic analogue of the propensity score", Biometrika 95(2): 481-488.
      • Moore and van der Laan (2009), "Covariate adjustment in randomized trials with binary outcomes: targeted maximum likelihood estimation", Statistics in Medicine 28(1): 39-64.
      • Schuler, Walsh, Hall, Walsh, Fisher, Critical Path for Alzheimer’s Disease, Alzheimer’s Disease Neuroimaging Initiative, and Alzheimer’s Disease Cooperative Study (2022), "Increasing the efficiency of randomized trial estimates via linear adjustment for a prognostic score", The International Journal of Biostatistics 18(2): 329-356.
      • Højbjerre-Frandsen, van der Laan, and Schuler (2025), "Powering RCTs for marginal effects with GLMs using prognostic score adjustment", arXiv preprint arXiv:2503.22284.
      • Højbjerre-Frandsen and Schuler (2026), "Within-Trial prognostic score adjustment is targeted maximum likelihood estimation", Pharmaceutical Statistics 25(2): e70080.

      Semisupervised mean estimation:

      • van der Laan and van der Laan, "Calibeating Prediction-Powered Inference".
      • Mozer (2026), "PPI is the difference estimator: recognizing the survey sampling roots of prediction-powered inference", arXiv preprint arXiv:2603.19160.
      • Angelopoulos, Bates, Fannjiang, Jordan, and Zrnic (2023), "Prediction-powered inference", Science 382(6671): 669-674.
      • Angelopoulos, Duchi, and Zrnic (2023), "PPI++: Efficient prediction-powered inference".