R Package

Calibrated PPI in R.

Use ppiAIPW to estimate a population mean from labeled outcomes and predictions on labeled and unlabeled observations. It provides calibration, confidence intervals, diagnostics, and treatment-effect estimation.

Install

Install the R package

The R package lives in the repository subdirectory r/ppiAIPW, so GitHub installs should target that subdirectory explicitly.

GitHub install with remotes

remotes::install_github(
  "Larsvanderlaan/ppi-aipw",
  subdir = "r/ppiAIPW"
)

GitHub install with pak

pak::pak("Larsvanderlaan/ppi-aipw/r/ppiAIPW")

Local source install

R CMD INSTALL r/ppiAIPW

Quickstart

Start with mean_inference(...)

Use mean_inference(...) when you want the estimate, standard error, confidence interval, fitted calibrator, and diagnostics in one call.

library(ppiAIPW)

result = mean_inference(
    Y,
    Yhat,
    Yhat_unlabeled,
    method = "monotone_spline",
    alpha = 0.1
)

estimate = result$pointestimate
standard_error = result$se
lower = result$ci[[1]]
upper = result$ci[[2]]

summary(result)

Calibration uses all labeled observations by default. Set cross_fit = TRUE, calibration_folds = 10 for honest calibration. Use inference = "jackknife", jackknife_folds = 10 for V-fold jackknife intervals with Student t critical values.

mean_pointestimate()

Return only the point estimate when you do not need the full result object.

mean_se() and mean_ci()

Return the standard error or confidence interval directly.

method="auto"

Candidate methods include "aipw", "linear", "monotone_spline", and "isotonic".

calibration_diagnostics()

Check calibration using out-of-fold predictions from a result or fitted model.

causal_inference()

Estimate arm means and control-vs-treatment ATEs from predicted potential outcomes.

compute_two_sample_balancing_weights()

Construct nonnegative labeled-sample balancing weights.

Vignettes

Three starting points for R users

These documents live in the package source and install with the package, so they can be opened locally after installation.

Causal inference

ppiAIPW-causal.Rmd shows how to estimate arm means and treatment effects.

Notes

Using the R interface

The R and Python packages use the same function names and calibration methods.

Core API

mean_inference(), mean_pointestimate(), mean_se(), mean_ci(), diagnostics, weights, and causal inference are available in R.

Result objects

Functions return S3 objects with print(), summary(), and plot() methods.

Install path

The package lives in r/ppiAIPW, so GitHub installs should use the repository subdirectory.