Ask Mallard
Analysis method

Sample size for comparing two proportions

4 min read

Use two expected risks to plan how many independent people each group needs for a binary comparison.

Fit

When to use it, and when not to

Use it when

  • You compare a yes-or-no outcome in two independent groups.
  • You have plausible risks for both groups and a meaningful difference to detect.

Not when

Before you start

What you need

Decide these first
  1. Group 1 risk, p1Enter a proportion from 0 to 1.
  2. Group 2 risk, p2Use the same outcome and follow-up time. The two risks must differ.
  3. Allocation ratio, ratioEnter group 2 per group 1. The default is 1; the engine enforces a minimum of 0.05.
  4. False-positive threshold, alphaThe default is 0.05. The engine uses a two-sided normal cutoff.
  5. Target power, powerPower is the chance of detecting the assumed difference. The engine restricts the target to 0.5 through 0.999; default 0.8.
It rests on these
  1. Each person contributes one independent outcome.How to check: Account for shared clinics or repeated measurements with another method.
  2. Expected risks and the normal approximation are plausible.How to check: Check less optimistic risks, sparse outcomes and the planned final test.

Plain language

How it works

The engine takes the absolute risk difference. It combines a ratio-weighted pooled risk for the null cutoff with separate risk variances for the assumed alternative. It uses normal quantiles for the two-sided alpha and target power. It rounds each group count up from its unrounded allocation. Power at a chosen total splits that total by the entered ratio. Power uses the assumed direction’s normal tail with the two-sided cutoff; it does not add the opposite tail.

Match the final test

The paired chi-square article describes a test of independence. Its calculator applies Yates’ correction; this sizing method does not. Confirm power for your chosen final test when sparse outcomes or corrections matter. Choosing a sample-size method helps you match the planning question to the right inputs.

Planning question
Three parallel sizing questions: detection of an important effect calls for power; interval width calls for precision; event and parameter counts screen model capacity. A capacity floor establishes neither power nor adequate prediction.Match the assessment to the questionDetect an important effectEstimate with a usefulintervalScreen events andparametersPower for the planneddesignAttainable precisionHistorical capacity floorA floor is not power or adequate prediction. A fixed dataset constrains all three assessments; it does notmake them interchangeable.
Conceptual diagram. It shows the structure of the idea, not data from any study.

Worked example

A worked example

Invented for illustration
Setting
A discharge trial compares two independent groups.
Question
How many people are needed if readmission risks are 20% and 30%, or 20 and 30 in 100?
Approach
Set p1=0.20, p2=0.30, ratio=1, alpha=0.05 and power=0.80.
Result
Mallard returns 294 in group 1 and 294 in group 2: 588 total. At that total, approximate power is 80.1%.
What it means
These are analysable counts under the approximation. Add a separate missing-data and recruitment plan.

In practice

Recent studies PubMed search · not vetted

Searching PubMed…

Watch out

Common mistakes

The one to remember

This normal approximation does not reproduce the power of a Yates-corrected chi-square test or an exact test. It assumes independent people and includes no losses.

  • Entering percentage points as whole numbers.Instead: Enter risks as proportions, and keep the same outcome horizon.
  • Calling the returned number exact chi-square power.Instead: The sizing engine uses a normal approximation without a continuity correction.

Inside Mallard

How Mallard uses this

For twoProportions, Mallard returns rounded counts for each group, their total and approximate power at a chosen total. It does not include losses.

No Mallard code example points to this page.
Atlas node analysis.sample_size_two_proportions, the id a plan cue records.

Related Learn pages

Related designs and methods

Evidence

Sources & further reading

  1. How to calculate sample size for different study designs in medical research? (opens in a new tab) · Indian J Psychol Med · doi 10.4103/0253-7176.116232
  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 titles, authors, years and DOIs checked on 2026-11-07. Record verified, confirm it supports this use. No independent professional approval is claimed. Charan and Biswas discuss design-specific sizing. Lydersen and colleagues compare table tests; their paper does not validate Mallard’s sizing equation.
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.