Two independent means
Determines the sample size required to detect a specified difference between the means of 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 two-sample test attains the specified power against the stated difference.
- Quantities you must supply: Mean group 1; Mean group 2; Standard deviation group 1; 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 means
- Normal approximation, equal variances (pooled t-test) Classical two-sample calculation assuming a common variance in both groups. Chosen for its efficiency and familiarity: when the equal-variance assumption holds, it gives the smallest defensible sample size and reproduces the standard published tables.
- Normal approximation, unequal variances (Welch t-test) Planning approximation for the Welch t-test, with each group retaining its own variance. Chosen because it keeps the planning assumption and the analysis consistent. Planning for unequal variances and then analysing with a pooled test, or the reverse, invalidates the calculation.
- Noncentral t (exact, equal variances) Iterative exact calculation for a planned pooled two-sample t-test. Chosen because it is the correct power calculation for a t-based analysis, and it is the figure G*Power and the R pwr package report.
When to use
Use when the primary objective is to determine whether the mean outcome differs between two independent groups by a clinically or scientifically meaningful amount.
Sample size
Awaiting inputs
—
Set the parameters and calculate.
Methodology — Two independent means — pooled variance (Student)
Formula used Two independent means — pooled variance (Student)
- Two-sided alternative selected: α is split between both tails, so the larger quantile is used and the requirement rises
where —
- μ₁
- Anticipated mean in group 1. Any value
- μ₂
- Anticipated mean in group 2. Must differ from μ₁
- σ₁
- Standard deviation in group 1. σ₁ > 0
- α
- 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 |
|---|---|
| Normal approximation, equal variances (pooled t-test) | |
| Normal approximation, unequal variances (Welch t-test) | |
| Noncentral t (exact, equal variances) |
How this method works
The variance of the difference between two independent means is σ²(1/n₁ + 1/n₂) under a common variance. Setting the standardised difference equal to the sum of critical values gives a closed-form n.
Two-sided test: H₀: μ₁ = μ₂ against H₁: μ₁ ≠ μ₂, so the α-quantile is z₁₋α/₂.
Selected method — equal variances (pooled). A common variance σ² is assumed in both groups, giving the classical formula. Under equal allocation this reduces to n = 2(z₁₋α/₂ + z₁₋β)²σ²/Δ² per group.
The assumption should be checked against pilot data. Where the groups plausibly differ in spread, the unequal-variance method is the safer planning choice.
Null hypothesis. H₀: μ₁ = μ₂
Alternative hypothesis. Two-sided H₁: μ₁ ≠ μ₂. One-sided H₁: μ₁ > μ₂ or μ₁ < μ₂.
Calculation procedure
- State the two means, or the difference worth detecting, and the common standard deviation .
- Set the allocation ratio ; use unless one group is much cheaper to recruit.
- Take and for the error rate and the power.
- Evaluate for group 1; group 2 is times that.
- Round each group up, then inflate for dropout. With this reduces to per group.
Exact or approximate
Approximate — the large-sample limit of the noncentral t calculation.
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
- Closed form and widely tabulated.
- Most efficient when the equal-variance assumption is correct.
Limitations
- Misleading when variances genuinely differ, particularly under unequal allocation, where the pooled estimate is dominated by the larger group.
- Understates n when σ is estimated.
Assumptions
- The two samples are independent, both within and between groups.
- The outcome is approximately normal in both groups.
- The two groups share a common variance σ².
- Allocation is fixed in advance by the stated ratio.
Applicable adjustments
Supports allocation ratio, dropout inflation and, through the dedicated calculators, clustering.
Conclusion
The standard choice when both arms can be assumed equally variable. Report the variance assumption with the sample size, since the figure is not valid if the assumption fails.
References
- Chow S-C, Shao J, Wang H, Lokhnygina Y. Sample Size Calculations in Clinical Research. 3rd ed. Boca Raton: Chapman & Hall/CRC; 2017.
- Lachin JM. Introduction to sample size determination and power analysis for clinical trials. Control Clin Trials. 1981;2(2):93–113. Link
- Machin D, Campbell MJ, Tan SB, Tan SH. Sample Size Tables for Clinical Studies. 3rd ed. Chichester: Wiley-Blackwell; 2009.