Skip to main content

    Method document

    Sample size for a stepped-wedge trial: binary outcome

    How many clusters, or how many measurements per cluster, a stepped-wedge cluster-randomised trial with a yes/no outcome needs. Covers fixed numbers of clusters and dropout.

    Engine version 1.0.0 · Reviewed 1 October 2026

    https://statwisely.com/methods/stepped-wedge-proportions/

    When to use it

    • A rollout evaluated on a binary outcome, such as the share of patients receiving recommended care.

    Not for

    • Settings where a parallel cluster trial is feasible.

    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
    p1, p2p_1,\ p_2
    Proportions under control and intervention; σ² = p̄(1 − p̄)
    α\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

    Proportion under controlp1p_1

    Values: Between 0 and 1

    Before the intervention is rolled out.

    Proportion under the interventionp2p_2

    Values: Between 0 and 1, different from p₁

    The variance used is that of the average proportion.

    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.
    • The binary outcome is handled with the variance of the average proportion, a linear approximation.
    • Dropout is unrelated to the outcome; recruiting more participants restores the numbers but cannot remove bias.

    Worked examples

    30% to 45%

    0.3 rising to 0.45, 4 steps, 20 per cluster-period, ICC 0.05: 12 clusters, 1200 measurements.

    Sample size: 1200

    Protocol statement

    To detect a change from 30% to 45% with 80% power at a two-sided significance level of 0.05, using a stepped-wedge cluster-randomised trial with 4 steps, and assuming an intracluster correlation of 0.05, the required sample size is 12 clusters over 5 periods, with 20 measurements per cluster in each period, 1200 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

    Allowing for missing outcomes

    Expecting 10% of measurements to be missing: 1334 to collect.

    Needed for analysis: 1200 · To recruit: 1334

    Protocol statement

    To detect a change from 30% to 45% with 80% power at a two-sided significance level of 0.05, using a stepped-wedge cluster-randomised trial with 4 steps, and assuming an intracluster correlation of 0.05, the required sample size is 12 clusters over 5 periods, with 20 measurements per cluster in each period, 1200 measurements in total. Allowing for 10% missing measurements, 1334 measurements should be collected. 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

    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: binary outcome. Method document, engine version 1.0.0, reviewed 2026-10-01. https://statwisely.com/methods/stepped-wedge-proportions/

    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