GitHub install with remotes
remotes::install_github(
"Larsvanderlaan/ppi-aipw",
subdir = "r/ppiAIPW"
)
R Package
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
The R package lives in the repository subdirectory
r/ppiAIPW, so GitHub installs should target that
subdirectory explicitly.
remotesremotes::install_github(
"Larsvanderlaan/ppi-aipw",
subdir = "r/ppiAIPW"
)
pakpak::pak("Larsvanderlaan/ppi-aipw/r/ppiAIPW")
R CMD INSTALL r/ppiAIPW
Quickstart
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
These documents live in the package source and install with the package, so they can be opened locally after installation.
ppiAIPW-quickstart.Rmd
shows mean estimation and how to use the results.
ppiAIPW-causal.Rmd
shows how to estimate arm means and treatment effects.
ppiAIPW-diagnostics.Rmd
covers out-of-fold calibration summaries and plots.
Notes
The R and Python packages use the same function names and calibration methods.
mean_inference(), mean_pointestimate(), mean_se(), mean_ci(), diagnostics, weights, and causal inference are available in R.
Functions return S3 objects with print(), summary(), and plot() methods.
The package lives in r/ppiAIPW, so GitHub installs should use the repository subdirectory.