% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/power.R
\name{mb_stepped_wedge}
\alias{mb_stepped_wedge}
\title{Stepped-wedge design effect}
\usage{
mb_stepped_wedge(steps, clusters_per_step, individuals_per_cluster, icc)
}
\arguments{
\item{steps}{Integer. Number of measurement periods (also called
\code{T}). Includes the baseline.}

\item{clusters_per_step}{Numeric. Number of clusters that
crossover at each step.}

\item{individuals_per_cluster}{Numeric. Individuals measured per
cluster per period.}

\item{icc}{Numeric in \verb{[0, 1]}. Intra-class correlation
coefficient.}
}
\value{
A list with elements \code{deff_cluster} (the within-period
cluster design effect), \code{correction_factor} (the stepped-wedge
correction relative to a parallel cluster RCT), \code{deff_sw} (the
product), and \code{n_total} (total observations across the trial).
}
\description{
Computes the design effect for a stepped-wedge cluster
randomised trial relative to an individually-randomised parallel
design with the same total observations.
}
\details{
Implements the closed-form approximation from Hemming et al.
(2015) BMJ Box 2:

Within-cluster design effect (cluster RCT vs individual RCT
with same total observations):
\deqn{\text{DEFF}_c = 1 + (mT - 1)\rho}

Stepped-wedge correction relative to a parallel cluster RCT:
\deqn{\text{CF} = \frac{3(1-\rho)}{2T(1 - 1/T^2)}}

Combined: \code{DEFF_sw = DEFF_c * CF}. This is a multiplier on the
variance of the treatment effect compared with an
individually-randomised design with the same total observations.

Approximation note: this is the closed-form approximation. The
exact Hussey-Hughes (2007) variance, which \code{swCRTdesign::swPwr}
computes from the design matrix, can differ by 20-40 percent for
typical UK evaluation designs. magentabook ships a
cross-validation test (\code{tests/testthat/test-swcrt-equivalence.R})
that documents the magnitude of this approximation gap on a
grid of designs. For production sample-size work, especially
where rho is high or the number of steps is small, prefer
\code{swCRTdesign::swPwr} or \code{clusterPower::cps.sw.binary} over this
function. Use \code{mb_stepped_wedge} for quick comparative
exploration; use the specialist packages for the number you
commit to in a published evaluation plan.

Both forms assume a balanced design: equal cluster size,
equal-period intervals, complete data, no time-by-treatment
interaction, and one outcome measurement per cluster-period.
For non-standard designs use the specialist packages above.
}
\examples{
mb_stepped_wedge(
  steps = 5,
  clusters_per_step = 4,
  individuals_per_cluster = 20,
  icc = 0.05
)
}
\references{
Hussey, M. A., Hughes, J. P. (2007). Design and analysis of
stepped wedge cluster randomized trials. Contemporary Clinical
Trials 28(2). \url{doi:10.1016/j.cct.2006.05.007}.

Woertman, W., de Hoop, E., Moerbeek, M., Zuidema, S. U.,
Gerritsen, D. L., Teerenstra, S. (2013). Stepped wedge designs
could reduce the required sample size in cluster randomized
trials. Journal of Clinical Epidemiology 66(7).
\url{doi:10.1016/j.jclinepi.2012.12.003}.

Hemming, K., Haines, T. P., Chilton, P. J., Girling, A. J.,
Lilford, R. J. (2015). The stepped wedge cluster randomised
trial: rationale, design, analysis, and reporting. BMJ 350.
\url{doi:10.1136/bmj.h391}.
}
\seealso{
\code{\link[=mb_cluster_design]{mb_cluster_design()}}, \code{\link[=mb_icc_reference]{mb_icc_reference()}}.

Other power: 
\code{\link{mb_cluster_design}()},
\code{\link{mb_icc_reference}()},
\code{\link{mb_mde}()},
\code{\link{mb_power}()},
\code{\link{mb_sample_size}()}
}
\concept{power}
