Two independent proportions
Determines the sample size required to detect a specified difference between proportions in two independent groups with a chosen significance level and statistical power.
Key takeaways
- What is calculated: Determine the smallest per-group n at which the test of equal proportions attains the specified power.
- Quantities you must supply: Proportion group 1; Proportion group 2; Significance level; Power; Allocation ratio.
- Type of calculation: Power-based: it answers how much data is needed to detect a stated effect. Power 0.80 at α = 0.05 is the usual target; confirmatory studies use 0.90.
- Calculation routes: 3 are available for this design; the one selected determines the formula, the quantities requested and the result.
Methods available for Two independent proportions
- Separate null and alternative variances (Fleiss) Standard comparison of two proportions, using the null variance for the critical value and the alternative variance for power. It is the more precise of the normal-approximation forms because it does not assume a common variance under both hypotheses.
- Separate variances with continuity correction The separate-variance form widened to allow for the discreteness of the binomial. It is the most conservative of the three normal-approximation forms and matches a corrected analysis.
- Pooled variance (simplified RCT / cohort form) The simplified textbook form using one common variance based on the pooled proportion. Chosen for transparency and for consistency with published worked examples that use the simplified form.
When to use
Use when the primary objective is to determine whether the proportion of individuals experiencing an outcome differs between two independent groups by a meaningful amount.
Sample size
Awaiting inputs
—
Set the parameters and calculate.
Methodology — Two independent proportions — separate null and alternative variances
Formula used Two independent proportions — separate null and alternative variances
- Two-sided alternative selected: α is split between both tails, so the larger quantile is used and the requirement rises
where —
- p₁
- Expected proportion in group 1, usually the control. 0 – 1 exclusive
- p₂
- Expected proportion in group 2. Must differ from p₁
- α
- Probability of rejecting a true null hypothesis (Type I error). 0.0001 – 0.5; conventionally 0.05, or 0.025 one-sided for regulatory non-inferiority
- 1 − β
- Probability of rejecting the null hypothesis when the specified alternative is true. 0.50 – 0.9999; conventionally 0.80 or 0.90
- k
- Allocation ratio n₂/n₁. 0.05 – 20; 1 gives equal groups
- ℓ
- Expected proportion of enrolled units lost before analysis. 0 – 0.95
Formulas for the 3 methods
| Calculation method | Formula |
|---|---|
| Separate null and alternative variances (Fleiss) | |
| Separate variances with continuity correction | |
| Pooled variance (simplified RCT / cohort form) |
How this method works
Binomial variance depends on the proportion itself, so the variance under H0 (based on the pooled proportion) differs from the variance under H1 (based on p1 and p2 separately). This form uses each where it belongs.
As in the one-sample case the null and alternative variances differ; p̄ is the variance-weighted pooled proportion under the null.
Sample size depends on the absolute difference, not the ratio. A fall from 0.50 to 0.40 and one from 0.11 to 0.01 are both ten points, but the second requires far fewer subjects because the variance near the boundary is smaller.
Null hypothesis. H0: p1 = p2
Alternative hypothesis. Two-sided H1: p1 != p2. One-sided H1: p1 > p2 or p1 < p2.
Calculation procedure
- State the proportion expected in each group, and , and set the allocation ratio .
- Compute the pooled proportion under the null, , and .
- Take and .
- Evaluate for group 1.
- Round each group up, then inflate for dropout. The absolute difference , not the ratio, drives the answer.
Exact or approximate
Approximate — a normal approximation to the binomial.
The formula shown always matches what was computed: when a one-sided test is selected the rendered quantile changes from z1−α/2 to z1−α, and where several methods exist, the formula follows the method selected in the calculator.
Advantages & limitations
Advantages
- More accurate than the simplified pooled form.
- Handles unequal allocation correctly.
Limitations
- Unreliable for very small expected cell counts.
- Gives a slightly smaller n than the simplified form, so it is the less conservative choice.
Assumptions
- The two samples are independent.
- Observations are independent Bernoulli trials within each group.
- Expected cell counts are large enough for the normal approximation.
- Allocation is fixed in advance by the stated ratio.
Applicable adjustments
Supports allocation ratio and dropout inflation.
Conclusion
The default for comparing two independent proportions. Report both group sizes and the total, together with the proportions assumed in each arm.
References
- Fleiss JL, Levin B, Paik MC. Statistical Methods for Rates and Proportions. 3rd ed. Hoboken: Wiley; 2003.
- Casagrande JT, Pike MC, Smith PG. An improved approximate formula for calculating sample sizes for comparing two binomial distributions. Biometrics. 1978;34(3):483–486. Link
- Lachin JM. Introduction to sample size determination and power analysis for clinical trials. Control Clin Trials. 1981;2(2):93–113. Link