Independent binomial groups, pooled null test
Two Proportion z Test Calculator
Compare two independent success proportions from counts. The calculator uses the pooled proportion for the equality-null z statistic, an unpooled standard error for the confidence interval, and a visible expected-count audit for the large-sample approximation.
Enter two independent groups
Group 1
Group 2
Difference and null test
At α = 0.05, the two-sided pooled z test rejects equal population proportions. Group 1’s observed proportion is higher by 12.73 percentage points.
Expected-count audit under equality null
Group 1 expected: 76.70 successes, 43.30 failures Group 2 expected: 70.30 successes, 39.70 failures All four expected counts are at least 10.
z = (0.7000−0.5727) ÷ √[0.6391(1−0.6391)(1/120+1/110)] = 2.0076
Question answered by the two-proportion z test
The test evaluates whether two independent population proportions are equal. Each unit belongs to one group and contributes one binary outcome. Examples include conversion versus no conversion in two independently assigned website variants, defect versus no defect from two production lines, or response versus no response in two separately sampled populations.
The null hypothesis is p1−p2 = 0. The two-sided alternative says the difference is nonzero. Directional alternatives say group 1’s proportion is greater or less and should be selected before outcomes are examined. The statistic is large-sample normal, so both design independence and expected-count adequacy matter.
This is not a paired-proportion test. Before/after binary responses on the same people, matched case-control pairs, and two tests applied to the same specimens produce dependent outcomes. Those designs require discordant-pair methods such as McNemar’s test, not the independent denominator used here.
Why the test pools but the interval does not
Observed proportions
p̂1 = x1/n1 and p̂2 = x2/n2. Their difference is the original-scale effect estimate.
Pooled null estimate
Under H₀, both groups share one p. Estimate it as (x1+x2)/(n1+n2) for the hypothesis-test standard error.
Unpooled interval
The usual Wald interval for p1−p2 uses √[p̂1(1−p̂1)/n1 + p̂2(1−p̂2)/n2].
Tail probability
The selected alternative determines whether one or both standard-normal tails count toward the p-value. The CI displayed remains two-sided at its selected level.
Pooling is not an arbitrary preference. The test standard error is calculated under the equality null it is testing, so the common event probability is estimated from all successes and totals. The interval estimates an unrestricted difference, so it does not impose equality and uses separate observed variances.
Worked example: compare response rates
Group 1 has 84 successes among 120 units, giving p̂1 = 0.7000. Group 2 has 63 among 110, giving p̂2 = 0.5727. The observed difference is 0.1273, or 12.73 percentage points in the group-1-minus-group-2 direction.
Under equal population proportions, pool the counts: 147 successes among 230 units gives p̂ = 0.6391. The pooled standard error is approximately 0.0634. Dividing the difference by that standard error gives z ≈ 2.01 and a two-sided p-value near 0.0447.
The unpooled standard error for estimation is approximately 0.0630. A 95% normal interval is 0.1273 ± 1.96×0.0630, or about 0.0038 to 0.2507. The interval barely excludes zero, consistent with the two-sided test near the 0.05 boundary. Report the estimate and interval rather than reducing the result to “significant.”
The observed risk ratio is 0.7000/0.5727 ≈ 1.22. Group 1’s observed success proportion is about 22% larger on a relative scale. That is not the same as a 22-percentage-point difference; absolute and relative effects answer different questions.
Expected-count diagnostic
Under the pooled null, each group’s expected successes are nip̂ and expected failures are ni(1−p̂). Rules such as all expected counts at least five or at least ten are conventions used to judge whether the normal approximation is plausible. This calculator uses ten as a visible conservative flag, not as a theorem that guarantees coverage.
If an expected cell is small, use an exact conditional test, unconditional exact method, or other analysis chosen for the design. Fisher’s exact test is common for a 2×2 table, although its null and conditioning may differ from the large-sample score test. Do not add artificial observations just to pass a diagnostic.
Very large samples can make tiny differences statistically detectable. The expected-count check says nothing about practical importance, randomization quality, measurement, missingness, or multiplicity. Interpret the confidence interval in context.
Assumptions and design checks
Independent groups
No unit should contribute to both groups unless a dependence-aware method is used. Clustered units need cluster-adjusted variance or a multilevel model.
Binary outcome fixed in advance
Define success and the analysis denominator before examining results. Excluding ambiguous outcomes after seeing groups can bias the difference.
Representative or randomized assignment
Random sampling supports population generalization; random assignment supports a causal treatment comparison. Neither follows from the z formula alone.
Missing data and attrition
Differential loss can change group proportions. Report assigned totals, analyzed totals, exclusions, and the missing-data approach.
Confidence intervals and alternative methods
The displayed difference interval is the familiar unpooled Wald interval. It can behave poorly near zero or one or with small samples. Score-based Newcombe intervals, adjusted methods, or exact approaches often provide better coverage. A final analysis should use a prespecified interval suited to the sample and field.
For a relative effect, log-scale intervals for a risk ratio are usually preferable to a raw ratio without uncertainty. Odds ratios may be appropriate in case-control designs or logistic models but are not interchangeable with risk ratios. The best effect scale connects to the decision and study design.
When covariates, strata, repeated sites, or time-to-event information matter, a regression or design-based model can estimate adjusted effects. The simple two-count z test is an unadjusted comparison.
Reporting checklist and related tools
Report group definitions, success rule, x and n for each group, p̂ values, difference direction, confidence interval method and level, z statistic, alternative, p-value, expected-count diagnostic, sampling or assignment design, and missingness. If reporting a risk ratio, include its interval from appropriate software.
The verified binomial probability calculator handles one fixed-n success-count distribution. The conditional probability calculator addresses P(A|B), a different probability question. Neither replaces the independent two-group inferential design here.
Frequently asked questions
Can totals be unequal?
Yes. Independent groups may have different n. The standard errors use 1/n₁ and 1/n₂ separately.
Why enter counts instead of percentages?
Inference depends on denominators. A 60% rate from 10 units has much more uncertainty than 60% from 1,000. Counts also permit exact expected-cell diagnostics.
Can I test a nonzero null difference?
This calculator tests equality, difference zero. Noninferiority, superiority-margin, or specified nonzero-difference tests require formulas and direction tailored to that margin.
Is the p-value the probability the proportions are equal?
No. It is a tail probability for the z statistic under the equal-proportions model. It does not assign a probability to the null hypothesis.
What if one group has zero successes?
The calculator can form the pooled test if conditions permit, but normal intervals and risk ratios become problematic. Exact or score-based methods are usually preferable.
Can this prove causation?
Only a defensible causal design and analysis can support causal interpretation. A z statistic cannot repair confounding, nonrandom assignment, interference, or biased measurement.
Reconstruct the four cells before trusting the test
A two-proportion comparison starts with four integer counts, not merely two percentages. Group 1 contributes its successes and failures; Group 2 contributes its successes and failures. The calculator reconstructs each failure count as total minus successes and displays the two observed rates. This audit matters because the same percentage can carry very different information at different sample sizes. A 60% rate based on 6 of 10 observations is much less precise than a 60% rate based on 600 of 1,000. If any displayed cell disagrees with the source table, stop and correct the inputs before interpreting z or the confidence interval.
Also check that the groups are genuinely independent. One person, household, device, account, or experimental unit should not contribute to both groups in an ordinary independent two-proportion z test. Matched before-and-after outcomes require a paired binary method instead. Likewise, repeated observations from the same cluster can make the usual standard error too small. Randomization, sampling design, missing data, and outcome definitions are study-design questions that a numerical result cannot repair.
Plan the analysis before seeing the answer
Write down the outcome, Group 1, Group 2, null difference, alternative direction, and confidence level before opening the data. A two-sided alternative asks whether the population rates differ in either direction. A one-sided alternative should be reserved for a direction justified in advance; choosing the favorable tail after viewing results understates the p-value. The p-value addresses compatibility with the selected null model. It is not the probability that the null is true, the probability that the study will replicate, or a measure of business importance.
Report the observed rates, the percentage-point difference, its confidence interval, the test method, z statistic, and p-value together. The interval supplies the range and direction that a bare significance label hides. A very small, precisely estimated difference may have little practical value, while a useful effect can remain uncertain in a small study. When cell counts are sparse, the normal approximation may be unreliable; consider an exact procedure or advice from a statistician. For prospective research, choose a meaningful minimum difference and perform a sample-size or power calculation rather than using whatever sample happens to be convenient.
References
The equality-null statistic follows the U.S. National Institute of Standards and Technology Dataplot reference for the difference of proportions hypothesis test. NIST gives z = (p̂1−p̂2)/√[p̂(1−p̂)(1/n1+1/n2)] with the pooled p̂ formed from combined successes and totals.