causalis.scenarios.classic_rct.inference.conversion_ztest.conversion_ztestconversion_ztest
Perform a two-proportion z-test on a CausalData object with a binary outcome (conversion).
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).
- ci_method{“newcombe”, “wald_unpooled”, “wald_pooled”}, default “newcombe”
Method for calculating the confidence interval for the absolute difference. “newcombe” is the most robust default for conversion rates.
- se_for_test{“pooled”, “unpooled”}, default “pooled”
Method for calculating the standard error for the z-test p-value. “pooled” (score test) is generally preferred for testing equality of proportions.
Returns
A dictionary containing: - p_value: Two-sided p-value from the z-test - absolute_difference: Difference in conversion rates (treated - control) - absolute_ci: Tuple (lower, upper) for the absolute difference CI - relative_difference: Percentage change relative to control rate - relative_ci: Tuple (lower, upper) for the relative difference CI (delta method)
Raises
If treatment/outcome are missing, treatment is not binary, outcome is not binary, groups are empty, or alpha is outside (0, 1).
Canonical target
causalis.scenarios.classic_rct.inference.conversion_ztest.conversion_ztest
Sections