causalis.scenarios.classic_rct.inference.bootstrap_diff_in_means.bootstrap_diff_meansbootstrap_diff_means
Bootstrap inference for difference in means between treated and control groups.
This function computes the ATE-style difference in means (treated - control) and provides a two-sided p-value using a normal approximation with bootstrap standard error, a percentile confidence interval for the absolute difference, and relative difference with its corresponding confidence interval.
Parameters
- dataCausalData
The CausalData object containing treatment and outcome variables.
- alphafloat, default 0.05
The significance level for calculating confidence intervals (between 0 and 1).
- n_simulint, default 10000
Number of bootstrap resamples.
- batch_sizeint, default 512
Number of bootstrap samples to process per batch.
- seedint, optional
Random seed for reproducibility.
- index_dtypenumpy dtype, default np.int32
Integer dtype for bootstrap indices to reduce memory usage.
Returns
A dictionary containing: - p_value: Two-sided p-value using normal approximation. - absolute_difference: The absolute difference (treated - control). - absolute_ci: Tuple of (lower, upper) bounds for the absolute difference CI. - relative_difference: The relative difference (%) relative to control mean. - relative_ci: Tuple of (lower, upper) bounds for the relative difference CI (delta method).
Raises
If inputs are invalid, treatment is not binary, or groups are empty.
Canonical target
causalis.scenarios.classic_rct.inference.bootstrap_diff_in_means.bootstrap_diff_means
Sections