Two-Proportions Z-Test

Verified

Categorical

Independently verified. Every statistic this test reports has been re-derived against an independent reference — never the library the pipeline itself calls — the rendered output was read back in a browser, and the result is locked with a committed regression suite.

Run this test straight away on a free built-in teaching dataset — no data of your own needed — or bring your own. Either opens the guided workspace: variable setup, assumption diagnostics, results with effect sizes and confidence intervals, figures, and APA-ready reporting.

Loading teaching datasets…

Or use your own dataset

Loading your datasets…

Compares the proportion of successes between two independent groups using the asymptotic z-test on the pooled-variance estimator z = (p̂₁ − p̂₂) / SE_pooled with normal-approximation p.

Reports the proportion difference + 95% CI (Wald or Newcombe score), risk ratio, odds ratio, and number-needed-to-treat. The engine auto-companions Fisher's exact when the normal approximation is questionable (any cell np or n(1−p) < 5). The default 2-group binary-outcome test for moderate-large samples; compare to the McNemar test for paired designs.

Worked example

Do two landing pages differ in sign-up rate?

Sign-ups from Page A (128 of 500) and Page B (164 of 500) were compared with a two-proportion z-test.

Result

Page B converted better (32.8% vs 25.6%), a 7.2-point lift, z = 2.50, p = .012.

How you'd report it (APA)

A two-proportion z-test showed Page B's sign-up rate (32.8%) significantly exceeded Page A's (25.6%), z = 2.50, p = .012.

Try it yourself: Load this ready-made sample and follow the run above.

When to use it

  • Two independent groups with a binary outcome
    60 patients randomised to a new drug vs placebo; outcome is whether 30-day re-admission occurred.
  • A/B test of conversion / click-through rates
    An e-commerce site randomly serves checkout-page variant A or B to 5,000 users each.

When NOT to — use instead

Hypotheses

H₀: the population proportions of successes are equal, p₁ = p₂.
Hₐ: the population proportions differ, p₁ ≠ p₂ (two-tailed) — or a directional variant.

Parameter tested: population proportion difference p₁ − p₂

Assumptions (and what to do if they fail)

Sample sizes are adequate for the normal approximation: n₁·p̂₁, n₁·(1−p̂₁), n₂·p̂₂, n₂·(1−p̂₂) each ≥ 5 (some sources: ≥ 10)high

Check: All four counts ≥ 5 → normal approximation valid.

If violated: Small per-cell counts make the z-test's Type I error rate unreliable; sampling distribution is not well-approximated by the Normal.

The definition of 'success' is unambiguous and applied consistently across both groupsmedium

Check: Verify 'success' has a single operational definition.

If violated: Inconsistent classification biases proportion estimates and invalidates the test.

Each observation is a random sample from the population, or groups are randomly assignedhigh

Check: Document the sampling frame and any selection filters.

If violated: Non-random sampling undermines inference to a defined population.

Ready to run a Two-Proportions Z-Test on your own data?

Guided setup, automatic assumption checks, effect sizes, figures and an APA write-up.

Run this test →