Multiple causal estimators and bootstrap inference
MultiEstimator runs several estimators on the same dataset in one pass — optionally with bootstrap standard errors and common-support filtering.
from CausalEstimate import MultiEstimator
from CausalEstimate.estimators import IPW, AIPW, TMLE
ipw = IPW(effect_type="ATE", treatment_col="treatment", outcome_col="outcome", ps_col="ps")
aipw = AIPW(
effect_type="ATE",
treatment_col="treatment",
outcome_col="outcome",
ps_col="ps",
probas_t1_col="predicted_outcome_treated",
probas_t0_col="predicted_outcome_control",
)
tmle = TMLE(
effect_type="ATE",
treatment_col="treatment",
outcome_col="outcome",
ps_col="ps",
probas_t1_col="predicted_outcome_treated",
probas_t0_col="predicted_outcome_control",
)
multi_estimator = MultiEstimator([ipw, aipw, tmle])
results = multi_estimator.compute_effects(
df,
n_bootstraps=50, # > 1 triggers bootstrapping
apply_common_support=True,
common_support_threshold=0.05,
return_bootstrap_samples=True, # optionally return raw bootstrap estimates
)
print(results)
Output format
results is a dictionary keyed by estimator class name ("IPW", "AIPW", "TMLE"). With bootstrapping (n_bootstraps > 1), each entry contains:
"effect"— the mean effect across bootstrap samples"std_err"— the standard deviation of the bootstrap estimates"CI95_lower"/"CI95_upper"— the 95% confidence interval (percentile method)"n_bootstraps"— the number of bootstrap samples"bootstrap_samples"— the raw bootstrap estimates, ifreturn_bootstrap_samples=True
Without bootstrapping (n_bootstraps=1), each entry is the estimator's own output with "n_bootstraps" set to 0. For IPW, AIPW and TMLE that includes analytic "std_err", "CI95_lower" and "CI95_upper" from the influence curve (Wald intervals, effect ± 1.96·SE; for risk ratios, the SE is on the log scale and the interval is exponentiated).
Common-support filtering
apply_common_support=True restricts estimation to the region where treated and control propensity distributions overlap, trimming observations outside the shared support (controlled by common_support_threshold). This guards against extrapolation into regions where one group has no comparable units. The underlying function is also available directly as CausalEstimate.filter_common_support — see the API Reference.