Ask Mallard
Analysis method

Test of two proportions

4 min read

A test of two proportions checks equal risks in independent groups; the risk difference and its interval show the size and uncertainty.

Fit

When to use it, and when not to

Use it when

  • You compare a binary outcome at a fixed time in two independent groups.
  • You want the absolute difference in risk, alongside a test of equality.

Not when

Before you start

What you need

Decide these first
  1. Event counts and denominators in both groupsoutcomeTypeKeep the group order fixed; the difference is the first risk minus the second.
  2. Outcome window and missing outcomesCompare the same endpoint and follow-up duration. State the missing-data assumption and analysis plan.
  3. Interval and test variantssummaryMeasureName the confidence level, sidedness and any continuity correction.
It rests on these
  1. People contribute to only one group and are independent.How to check: Check pairing, shared sites and repeated outcomes. Ordinary independent-group formulas do not handle clustering.
  2. The pooled normal test has enough expected events and non-events.How to check: Inspect expected counts under equal risks. Small cells need a justified small-sample method.
  3. The analysis matches the stated missing-data assumption.How to check: Missing at random means gaps depend on recorded factors. Account for those factors and assess plausible departures.

Plain language

How it works

Each risk is its event count divided by its group size. Subtract the second risk from the first to estimate the risk difference. Newcombe’s hybrid score interval combines the two groups’ Wilson score limits into limits for that difference. It is not a Wilson interval for a single proportion.

The method at a glance
Test of two proportions: Independent binary group counts. Then Risk difference and Newcombe interval. Then Pooled test of equal risks.Test of two proportionsIndependent binary groupcountsRisk difference andNewcombe intervalPooled test of equal risksThe interval targets the risk difference. The pooled test is a separate construction, without continuitycorrection.
Conceptual diagram. It shows the structure of the idea, not data from any study.
Inference and checks

The pooled z test checks whether the risks are equal. Under that null, both groups share a pooled event risk. Divide the observed difference by its pooled standard error. Compare the statistic with a standard normal distribution. No continuity correction is used here. The squared statistic equals uncorrected Pearson chi-square on one degree of freedom.

Worked example

A worked example

Invented for illustration
Setting
Two independent groups have complete outcomes at 30 days.
Question
How much does the event risk differ?
Approach
Group A: 30/200 events. Group B: 50/200 events. Use a 95% Newcombe hybrid score interval and a two-sided pooled z test, without continuity correction.
Result
Group A has 15 in 100 events; group B has 25 in 100. The risk difference is -10.00 percentage points, with 95% Newcombe interval -17.73 to -2.15.
What it means
The pooled z statistic is -2.50, with p = 0.012419. The estimated risk is lower in A; the test alone does not measure clinical importance.

In practice

Recent studies PubMed search · not vetted

Searching PubMed…

Watch out

Common mistakes

The one to remember

The groups must be independent. Use a confidence interval for the risk difference itself, such as Newcombe’s hybrid score interval. A Wilson interval for one proportion is not an interval for their difference. Sparse data can undermine the pooled normal test.

  • Putting a single-proportion Wilson interval around a difference.Instead: Combine both groups’ score limits with Newcombe’s method; do not treat the difference as one binomial proportion.
  • Assuming the interval is the inversion of the reported test.Instead: The Newcombe interval and pooled z test use different constructions. Near the cutoff, their decisions can differ.
  • Calling a nonsignificant result equivalence.Instead: Report the difference and uncertainty. Equivalence needs prespecified limits and its own analysis.

Inside Mallard

How Mallard uses this

Mallard offers this lesson in Learn search and the Atlas. The method registry links its independent-group risk-difference entry here.

Code example in Mallard: Risk difference, risk ratio and NNT from a two-arm trial (risk-difference-ratio-nnt).
Sample size: Mallard sizes the main comparison with two proportions. It does not size adjustment or any secondary analysis.
Atlas node analysis.two_proportions, the id a plan cue records.
Code for this method
Loading…

Related Learn pages

Related designs and methods

Evidence

Sources & further reading

  1. Interval estimation for the difference between independent proportions: comparison of eleven methods (opens in a new tab) · Stat Med · doi 10.1002/(sici)1097-0258(19980430)17:8<873::aid-sim779>3.0.co;2-i
  2. Recommended tests for association in 2 x 2 tables (opens in a new tab) · Stat Med · doi 10.1002/sim.3531
Prepared with AI assistance. PubMed records checked by title, authors, year and available DOI on 2026-11-07. Record verified; confirm it supports this use. No independent professional approval is claimed. Newcombe supports the hybrid score interval for an independent risk difference. Lydersen and colleagues compare table tests and their small-sample limitations; they do not endorse one test for every setting.
Last source review: 2026-11-07
AI-generated educational content
Mallard uses reputable methodological and reporting sources, but this material may contain errors or omit important context. Verify important methodological decisions with the cited sources and, when appropriate, a qualified research methodologist or statistician.