Method document
Sample size for a stepped-wedge trial: continuous outcome
How many clusters, or how many measurements per cluster, a stepped-wedge cluster-randomised trial needs, in which every cluster starts on control and crosses to the intervention at a random time. Covers fixed numbers of clusters and dropout.
https://statwisely.com/methods/stepped-wedge-means/
When to use it
- An intervention that will be rolled out to every cluster anyway, where only the order can be randomised.
Not for
- Settings where a parallel cluster trial is feasible: it avoids confounding the effect with time.
Notation
- Number of clusters
- Number of steps; there are S + 1 periods
- Measurements per cluster in each period
- Intracluster correlation coefficient (ICC)
- Total variance of the outcome
- Treatment effect: a difference in means or proportions
- 1 if cluster i is on the intervention in period j, else 0
- Significance level: the chance of a false positive
- Power: the chance of detecting the effect if it is real
- Expected dropout
Formulas
Variance of the treatment effect
The Hussey and Hughes model: cluster-period means share a cluster effect, and every period has its own term so the secular trend is estimated rather than assumed away [1]. The calculator solves this generalised least squares problem directly.
Clusters, or cluster size, with enough power
Clusters are added a sequence at a time, one cluster per step, until the power is reached; or, with the clusters fixed, the measurements per cluster-period are increased instead. The answer is reported as measurements, I × (S + 1) × m.
Dropout
Applied last, to the participants actually recruited.
Parameters
Difference in means
Values: Not zero
The smallest effect of the intervention worth detecting.
Standard deviation
Values: Above 0
Total SD of individual measurements.
Number of steps
Values: A whole number of at least 1
Times at which a group of clusters crosses to the intervention.
Measurements per cluster-period
Values: Above 0
New participants measured in each cluster in each period.
What to solve for
Values: Clusters, or cluster size for a fixed number of clusters
Solve for the cluster size when the clusters are fixed, such as every hospital in a region.
Number of clustersOptional
Values: A multiple of the number of steps
When solving for cluster size; it must divide evenly between the steps.
Significance level
Values: Between 0 and 1; usually 0.05
The false-positive rate you accept. A smaller α, for example to allow for several primary outcomes, needs a larger sample.
Power
Values: Between 0 and 1; usually 0.80 or 0.90
The chance of a significant result if the assumed effect is real. Funders and ethics committees commonly expect at least 0.80.
Expected dropoutOptional
Values: 0% up to, but not including, 100%
The share of participants expected to provide no outcome, from comparable studies. Recruiting more restores the numbers, not the comparability of the groups: if dropout is related to the outcome, the estimate can still be biased.
Assumptions
- A cross-sectional design: different people are measured in each period. A cohort followed throughout needs a model of repeated measurements on each participant.
- The intervention effect is immediate and constant once a cluster crosses over, and the secular trend is the same in all clusters [2].
- The calculation uses the normal approximation, which can overstate power when there are few clusters; with fewer than about 10–15, plan the analysis with a small-sample correction and allow for it here.
- Dropout is unrelated to the outcome; recruiting more participants restores the numbers but cannot remove bias.
Worked examples
Four steps
4 steps, 20 measurements per cluster-period, ICC 0.05, difference 5 with SD 10: one cluster per step already gives 4 clusters, 5 periods and 400 measurements, with power 0.84. With so few clusters, treat that power with caution.
Sample size: 400
Open this example in the calculatorProtocol statement
To detect a difference in means of 5 with 80% power at a two-sided significance level of 0.05, using a stepped-wedge cluster-randomised trial with 4 steps, and assuming a standard deviation of 10 and an intracluster correlation of 0.05, the required sample size is 4 clusters over 5 periods, with 20 measurements per cluster in each period, 400 measurements in total. Calculated with StatWisely (statwisely.com) using: clusters: solve GLS Var(θ̂) from (X'V⁻¹X)⁻¹ with one term per period; V=σ_c²J+(σ_e²/m)I. These are planning estimates; confirm the final design with a qualified statistician.
A smaller effect
A difference of 3: 12 clusters and 1200 measurements.
Sample size: 1200
Open this example in the calculatorTwelve clusters available
With 12 clusters fixed, 6 measurements per cluster-period suffice: 360 in total.
Sample size: 360
Open this example in the calculatorValidation
- Every worked example on this page is recomputed by the StatWisely engine whenever the software is built. If a number or formula here stopped matching the calculator, the release would be stopped until this document was corrected.
- An independent implementation in R recomputes this test every night and before each production release, and the results are compared with the engine’s.
How to cite
StatWisely. Sample size for a stepped-wedge trial: continuous outcome. Method document, engine version 1.0.0, reviewed 2026-10-01. https://statwisely.com/methods/stepped-wedge-means/
Cite the original references for the formulas your design uses as well.
References
- 1.Hussey MA, Hughes JP. Design and analysis of stepped wedge cluster randomized trials. Contemporary Clinical Trials. 2007;28(2):182–191.
- 2.Hemming K, Haines TP, Chilton PJ, Girling AJ, Lilford RJ. The stepped wedge cluster randomised trial: rationale, design, analysis, and reporting. BMJ. 2015;350:h391.
- 3.Adams G, Gulliford MC, Ukoumunne OC, Eldridge S, Chinn S, Campbell MJ. Patterns of intra-cluster correlation from primary care research to inform study design and analysis. Journal of Clinical Epidemiology. 2004;57(8):785–794. doi:10.1016/j.jclinepi.2003.12.013