Test of two proportions
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
- The same people are measured twice. Use McNemar’s test for paired binary outcomes. Read: McNemar’s test
- Expected counts are sparse. Consider Fisher’s exact test for association and justify the interval method separately. Read: Fisher’s exact test
- You need covariate adjustment. Use a regression model for your chosen effect measure. Read: Logistic regression
Before you start
What you need
- Event counts and denominators in both groupsoutcomeTypeKeep the group order fixed; the difference is the first risk minus the second.
- Outcome window and missing outcomesCompare the same endpoint and follow-up duration. State the missing-data assumption and analysis plan.
- Interval and test variantssummaryMeasureName the confidence level, sidedness and any continuity correction.
- 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.
- 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.
- 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 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
- 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
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.
risk-difference-ratio-nnt).analysis.two_proportions, the id a plan cue records.Related Learn pages
Related designs and methods
Evidence
Sources & further reading
- 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
- Recommended tests for association in 2 x 2 tables (opens in a new tab) · Stat Med · doi 10.1002/sim.3531