Skip to content

Repository files navigation

SteppedPower - Power Calculation for Stepped Wedge Designs

R-CMD-check CRAN version License: MIT CRAN Downloads

Tools for power and sample size calculation, as well as design diagnostics.
For longitudinal mixed model settings, with a focus on stepped wedge designs.

SteppedPower provides power and sample size calculation for parallel, crossover, and stepped wedge designs. It allows for a flexible definition of the covariance structure. It further offers visualisations and diagnostics tools, to assess cluster importance across time points.

Installation

Stable release (CRAN)

install.packages("SteppedPower")

Development versions

devtools::install_github("PMildenb/SteppedPower", build_vignettes = TRUE)   ## stable development version
devtools::install_github("PMildenb/SteppedPower", ref = "devel", build_vignettes = TRUE)  ## latest 

Quick Start

library(SteppedPower)

# SWD with 4 clusters, ICC = 0.1 (via tau), 10 subjects per cluster, and a treatment effect of 0.5
result <- glsPower(
  Cl = rep(1, 4),       # 4 clusters in 4 sequences
  mu0 = 0,              # Mean under control
  mu1 = 0.5,            # Mean under treatment
  sigma = 1,            # Residual standard deviation
  tau = sqrt(0.111),    # Random intercept SD (ICC = tau^2 / (tau^2 + sigma^2) ≈ 0.1)
  N = 10,               # Subjects per cluster
  verbose = 2           # Save additional info, e.g., complete covariance matrix
)

# View power calculation
print(result)

# check the design matrix
plot(result$DesignMatrix)

# check the covariance matrix
plot(result$CovarianceMatrix)

# check influence diagnostics 
plot(result)

Documentation

For more details, see the package vignettes:

vignette("Getting_Started", package = "SteppedPower")

References

  • Hussey S, Hughes JP (2007). "Design and analysis of stepped wedge cluster randomised trials." Contemporary Clinical Trials, 28(2), 182-191. doi:10.1016/j.cct.2006.05.007
  • Li F, et al. (2020). "Mixed model sample size calculations for stepped wedge cluster randomised trials." Statistical Methods in Medical Research. doi:10.1177/0962280220932962

Authors

License

MIT

About

power and sample size calculation in mixed model settings

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages