Skip to main content

    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.

    Engine version 1.0.0 · Reviewed 1 October 2026

    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

    II
    Number of clusters
    SS
    Number of steps; there are S + 1 periods
    mm
    Measurements per cluster in each period
    ρ\rho
    Intracluster correlation coefficient (ICC)
    σ2\sigma^{2}
    Total variance of the outcome
    θ\theta
    Treatment effect: a difference in means or proportions
    XijX_{ij}
    1 if cluster i is on the intervention in period j, else 0
    α\alpha
    Significance level: the chance of a false positive
    1−β1-\beta
    Power: the chance of detecting the effect if it is real
    qq
    Expected dropout

    Formulas

    Variance of the treatment effect

    Var⁡(θ^)=[(X⊤V−1X)−1]θθ,V=ρσ2J+(1−ρ)σ2mI\operatorname{Var}(\hat{\theta}) = \left[(X^{\top} V^{-1} X)^{-1}\right]_{\theta\theta}, \qquad V = \rho\sigma^{2} J + \frac{(1-\rho)\sigma^{2}}{m} I

    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

    Φ ⁣(∣θ∣Var⁡(θ^)−z1−α/2)≥1−β\Phi\!\left(\frac{|\theta|}{\sqrt{\operatorname{Var}(\hat{\theta})}} - z_{1-\alpha/2}\right) \ge 1-\beta

    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

    nrecruit=⌈n1−q⌉n_{\text{recruit}} = \left\lceil \frac{n}{1 - q} \right\rceil

    Applied last, to the participants actually recruited.

    Parameters

    Difference in meansθ\theta

    Values: Not zero

    The smallest effect of the intervention worth detecting.

    Standard deviationσ\sigma

    Values: Above 0

    Total SD of individual measurements.

    Number of stepsSS

    Values: A whole number of at least 1

    Times at which a group of clusters crosses to the intervention.

    Measurements per cluster-periodmm

    Values: Above 0

    New participants measured in each cluster in each period.

    Intracluster correlation (ICC)ρ\rho

    Values: From 0 to 1

    From comparable cluster trials or surveys [3].

    What to solve for⋅\cdot

    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 clustersIIOptional

    Values: A multiple of the number of steps

    When solving for cluster size; it must divide evenly between the steps.

    Significance levelα\alpha

    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.

    Power1−β1-\beta

    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 dropoutqqOptional

    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

    Protocol 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.

    Open this example in the calculator

    A smaller effect

    A difference of 3: 12 clusters and 1200 measurements.

    Sample size: 1200

    Open this example in the calculator

    Twelve clusters available

    With 12 clusters fixed, 6 measurements per cluster-period suffice: 360 in total.

    Sample size: 360

    Open this example in the calculator

    Validation

    • 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. 1.Hussey MA, Hughes JP. Design and analysis of stepped wedge cluster randomized trials. Contemporary Clinical Trials. 2007;28(2):182–191.
    2. 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. 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