Proportions: One and Two Groups
Calculate the sample size required to test a specified difference between two independent proportions using the Farrington & Manning likelihood score method. Enter the null risk difference, expected alternative risk difference, reference-group event rate, significance level, desired power, and allocation ratio. Runs entirely in your browser.
The risk difference is defined as δ = p1 − p2, where p1 is the event probability in Group 1 and p2 is the event probability in Group 2. The calculator tests a specified null value δ0 rather than assuming that the null difference must be zero.
The implemented test is the Farrington & Manning likelihood score test. Under the null hypothesis, the score statistic uses maximum-likelihood estimates constrained to satisfy p1 − p2 = δ0. Under the alternative, the expected proportions are p1 = p2 + δ1 and p2. The required sample size is found by searching for the smallest integer group size that reaches the requested normal-approximation power.
Let p̃1 and p̃2 denote the constrained maximum-likelihood estimates satisfying p̃1 − p̃2 = δ0. The Farrington & Manning statistic is
The constrained estimates are obtained by solving the likelihood score equation subject to the null restriction. For sample-size planning, the observed proportions are replaced by their anticipated alternative values. The normal approximation is then used to determine the sample size producing the requested power.
For a specified allocation ratio k = n2/n1, the calculator searches over integer values of n1, sets n2 = round(k n1), and evaluates the resulting normal-approximation power. The reported design is the first integer allocation reaching the requested target power.
Validation example: the published Example 2 specifies an upper-tailed Farrington & Manning test with α = 0.05, 80% power, equal allocation, δ0 = −0.05, δ1 = 0.05, and p2 = 0.60. The published result is n1 = 290 and n2 = 290, for a total sample size of 580. This implementation reproduces that result; at 290 per group its calculated normal-approximation power is approximately 0.80067.
The risk difference is an absolute effect measure. For example, a risk difference of 0.10 means that the event probability in Group 1 is 10 percentage points higher than that in Group 2. The null difference δ0 allows the same framework to represent superiority, non-inferiority, or other tests in which the null hypothesis specifies a non-zero difference.
Farrington, C. P., & Manning, G. (1990). Test statistics and sample size formulae for comparative binomial trials with null hypothesis of non-zero risk difference or non-unity relative risk. Statistics in Medicine, 9(12), 1447–1454. doi:10.1002/sim.4780091208.
the software. this method Sample Size Software: Non-Zero Null Tests for the Difference Between Two Proportions, Chapter 205. the relevant methodological literature describes the Farrington & Manning likelihood score test, its constrained estimates, normal-approximation calculations, and worked sample-size examples.