Two-Proportion z-Test
The count-based member the hypothesis-test family was missing.
Example
You enter
- Group 1 successes x1 45
- Group 1 total n1 100
- Group 2 successes x2 30
- Group 2 total n2 100
- Tail two
- Alpha 0.05
You get
- Z stat 2.19089
- P value 0.02846
Details, formula, and sources
it compares two sample proportions, each a number of successes out of a total - conversion rate A vs B, defect rate line 1 vs line 2, pass rate this year vs last. Enter the successes and total for each group; under the null that the true rates are equal it pools them into p_pool = (x1+x2)/(n1+n2) and computes z = (p1-p2)/sqrt(p_pool(1-p_pool)(1/n1+1/n2)), with the p-value from the standard-normal CDF. 45/100 vs 30/100 gives z = 2.19, two-sided p = 0.028 - the rates differ. Also reports the difference and its confidence interval (unpooled SE) and warns when a cell has fewer than 5 successes or failures. Verified against statsmodels proportions_ztest. Two- and one-sided tails. A statistics aid; the study design governs.
p_pool = (x1 + x2)/(n1 + n2); z = (p1 - p2) / sqrt(p_pool (1 - p_pool)(1/n1 + 1/n2)); two-sided p = 2(1 - normCdf(|z|)). Difference CI uses the unpooled SE sqrt(p1(1-p1)/n1 + p2(1-p2)/n2).
OpenIntro Statistics 4th ed. Chapter 6 (inference for two proportions) by name; the standard-normal CDF via the error function. Verified against statsmodels.stats.proportion.proportions_ztest (pooled).
OpenIntro Statistics free at openintro.org; the pooled two-proportion z-test is public-domain textbook statistics.
Estimate only. Readability formulas and similar metrics are derived from a representative population and have known edge-case noise. The classroom teacher governs final text selection, grade placement, and assessment decisions.
Field names used by the API: x1, n1, x2, n2, tail, alpha, z_stat, p_value
- Pooled test statistic p_pool = (x1+x2)/(n1+n2); z = (p1-p2)/sqrt(p_pool(1-p_pool)(1/n1+1/n2))OpenIntro Statistics Ch. 6
- Difference CI unpooled SE sqrt(p1(1-p1)/n1 + p2(1-p2)/n2) (interval convention differs from the test)OpenIntro Statistics Ch. 6
- Approximation floor about 5 successes and 5 failures per group; else Fisher's exact testnormal-approximation validity