calibratedDML GitHub

Functions and options

Use CalibratedDML in Python or calibrated_dml() in R for binary and multi-arm treatment effects.

TaskPythonR
Fit from dataCalibratedDML(...).fit(X, A, y)calibrated_dml(data, outcome, treatment, covariates, ...)
Supply predictionsfit.fit_from_nuisances(A, y, mu_mat, pi_mat, ...)calibrated_dml_from_nuisances(A, Y, mu_mat, pi_mat, ...)
Summarizefit.summary()summary(fit)
Get intervalsfit.confint()confint(fit)

Common options

OptionDefaultPurpose
control_levelPython: 0; R: requiredControl arm for treatment contrasts.
outcome_model"lasso"Learner for the conditional outcome mean.
treatment_model"lasso"Learner for treatment probabilities.
n_folds5Number of cross-fitting folds.
calibration_method"auto"Calibration method.
inference"jackknife"Confidence interval method.
conf_level0.95Confidence level.
jackknife_folds10Number V of jackknife deletion groups; independent of nuisance cross-fitting.
bootstrap_reps200Number of bootstrap replicates.

Calibration

calibration_method accepts "auto", "isotonic", "smooth_isotonic", or "none". Use "none" to fit the estimator without calibration.

Inference

inference accepts "jackknife", "bootstrap", or "wald". See confidence intervals for the role of each method.

Language guides

Python · R · Adaptive binary-treatment estimators

General linear functionals

calibrated_linear_functional() in R and Python estimates targets of the form

\[\psi=\mathbb{E}\left[\sum_{j=1}^k c_j(O)\mu(T_j(O))\right].\]

Specify the coefficients directly or provide a row-wise linear function of prediction columns. For example, subtracting two columns defines a treatment contrast; a weighted sum defines a treatment-policy value.

InputContents
regression, rieszCross-fitted predictions at the observed inputs; vectors of length n.
regression_evaluationsRegression predictions at each input used by the functional; an n-by-k matrix.
riesz_evaluationsRiesz predictions at those same inputs, in the same column order.
functionalA function mapping an n-by-k prediction matrix to n contributions, a length-k coefficient vector, or an n-by-k coefficient matrix.

The evaluation matrices default to the observed predictions as one column. Isotonic calibration uses PAVA for both squared-error and quadratic Riesz losses, including signed representers. Set calibration_method="none" for the uncalibrated one-step estimator. Inference defaults to the V-fold jackknife with V = 10.

ATE example · Method and theory