Two-Proportion z-Test

Statistics
Introduced by
Karl Pearson / classical large-sample z approximation
Year
1900
Type
Parametric proportion comparison

What does it do?

The two-proportion z-test is a parametric hypothesis test that compares the proportions of successes in two independent groups, or compares one sample proportion with a reference value.

It rests on the large-sample normal approximation to the binomial distribution, as set out by Fleiss, Levin, and Paik (2003), and it is appropriate when each group is large enough for that approximation to hold. The one-sample form is given in the FAQ.

The intuition behind the method

Suppose you want to know whether a new treatment cures patients at a higher rate than an old one. You count the number of successes in each group and divide by the group size to get two proportions. The test then asks: given how many people were in each group, could this gap in proportions have plausibly arisen by chance? It does this by converting the gap into a z-score — measuring how many standard errors separate the two rates — and comparing that score to the standard normal distribution.

History

The formulation on this page follows Fleiss, Levin, and Paik (2003), whose book covers comparisons of proportions from independent samples and the analysis of fourfold tables. The originating publication of the two-proportion z-test is not verified in this entry, so no author or year is attributed here. The test is closely related to the Pearson chi-square test for 2×2 tables.

When to use it

Choose this test when the outcome is binary (success/failure, yes/no) and you want to compare the proportion of successes between two independent groups, or to check one group's proportion against a known reference value. It assumes independent observations and, in the two-group case, that the two groups are independent of each other; each group must also be large enough that np ≥ 5 and n(1−p) ≥ 5. Do not use it when the two proportions come from paired or matched observations, when there are more than two groups, when the outcome is continuous, or when cell counts are too small. In those cases use the exact binomial test, Fisher's exact test, or a method designed for matched data, such as McNemar's test for paired binary outcomes.

Limitations and considerations

  • The normal approximation fails when np or n(1−p) falls below 5, so the test is unreliable for small samples or rare outcomes.
  • It assumes two independent samples; matched or paired binary data violate this assumption.
  • It is built for one or two groups. Comparing three or more proportions needs a different approach, and multiple pairwise comparisons require adjustment for multiplicity.
  • It compares unadjusted proportions. When covariates must be controlled, a model such as logistic regression is the related alternative.
  • The mechanics above cover two independent groups. The one-sample version replaces the pooled standard error with one based on the hypothesized value p₀, as shown in the FAQ.
  • Continuity-corrected versions of the test (such as Yates's correction) shift the statistic and p-value slightly, so results can differ from the uncorrected z-test described here.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • The output is a signed z-score and a p-value, so the direction of the difference is visible without further calculation.
  • Because z is signed, the test accommodates a one-tailed alternative when theory specifies a direction in advance; the direction must be fixed before the data are examined.
  • For a 2×2 table the test is algebraically equivalent to the uncorrected Pearson chi-square test (z² equals χ²), so the two results can be cross-checked, provided neither is continuity-corrected.
  • Cohen's h is variance-stabilized, which makes it usable for comparing effects across studies with different baseline proportions.

Applications

  • Comparing response or cure rates between a treatment group and a control group in clinical trials.
  • Testing whether two demographic groups (e.g., two regions, two age cohorts) differ in the prevalence of a binary outcome.
  • Evaluating conversion rates in A/B tests for digital products, where the outcome is click/no-click or purchase/no-purchase.
  • Comparing pass/fail rates across two conditions or instructional methods in educational research.
  • Epidemiological comparisons of disease incidence between exposed and unexposed populations.

How it works

How it works

1

The null hypothesis states that the two population proportions are equal (or that a single population proportion equals a specified value); the alternative states that they differ. A directional alternative is also supported when theory justifies a one-tailed test.

Formula
H_0:\ p_1 = p_2 \quad H_1:\ p_1 \neq p_2
2

The z statistic divides the difference between the two observed proportions, p̂₁ − p̂₂, by its estimated standard error. That standard error is built from the pooled proportion p̂, which is the total number of successes across both groups divided by the total sample size, and from the reciprocal of each group's size. A larger absolute z value indicates stronger evidence against the null hypothesis. Under the null, and when np and n(1−p) are at least 5 in each group, the statistic is approximately standard normal.

Formula
z = \dfrac{\hat{p}_1 - \hat{p}_2}{\sqrt{\hat{p}(1-\hat{p})\left(\dfrac{1}{n_1}+\dfrac{1}{n_2}\right)}}
3

Reject H₀ when |z| exceeds the critical value z_{α/2}, which corresponds to the chosen significance level (commonly 0.05); equivalently, reject when the p-value falls below α. Cohen's h, given with the rule, is an effect size and does not enter the rejection decision. It is the difference of arcsine-transformed proportions, which stabilizes variance across the 0–1 range. Report h together with the raw difference in proportions and its confidence interval, rather than in place of the test result.

Formula
\text{reject } H_0 \text{ if } |z| > z_{\alpha/2};\quad h = 2\arcsin\!\sqrt{\hat{p}_1} - 2\arcsin\!\sqrt{\hat{p}_2}

Common pitfalls

  • Applying the test when cell counts are too small — use Fisher's exact test or the binomial test instead.
  • Forgetting to report an effect size (Cohen's h) alongside the p-value.
  • Confusing a proportion (0–1 fraction) with a mean and applying a t-test to binary outcomes.
  • Using a one-tailed test post hoc after observing the direction of the data.

Frequently asked questions

When should I use Fisher's exact test instead?

Use Fisher's exact test when any expected cell count falls below 5, which typically happens with small total samples or very rare outcomes. Fisher's test makes no normal approximation and is exact regardless of sample size. The proportion z-test and its chi-square equivalent are appropriate when all expected counts are at least 5.

Is this the same as the chi-square test?

For a 2×2 contingency table the two-proportion z-test and the uncorrected Pearson chi-square test are algebraically equivalent: z² equals the chi-square statistic. This holds only for the uncorrected forms; a continuity-corrected z-test or chi-square test gives slightly different values. The z-test is preferred when you want to specify a directional (one-tailed) hypothesis or when you need a signed test statistic for power calculations, while chi-square is more natural for multi-cell tables.

What effect size should I report?

The recommended effect size is Cohen's h, computed as the difference of the arcsine-transformed proportions: h = 2 arcsin(√p₁) − 2 arcsin(√p₂). The arcsine transformation stabilizes the variance of proportions across the 0–1 range. Conventionally, |h| ≈ 0.2 is small, 0.5 is medium, and 0.8 is large. Always report the raw proportion difference and its confidence interval alongside h.

Can I test a single proportion against a known value?

Yes. The one-proportion z-test compares a single observed proportion p̂ against a hypothesized value p₀. The z statistic becomes (p̂ − p₀) / √(p₀(1 − p₀) / n). The same sample-size condition applies: np₀ ≥ 5 and n(1 − p₀) ≥ 5.

Related methods

Sources

  1. Fleiss, J. L., Levin, B., & Paik, M. C. (2003). Statistical Methods for Rates and Proportions (3rd ed.). Wiley.

    Open DOI reference
  2. Shipunov-visual_statistics, p. 212