SteppedPower
- Power Calculation for Stepped Wedge DesignsTools 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.
install.packages("SteppedPower")devtools::install_github("PMildenb/SteppedPower", build_vignettes = TRUE) ## stable development version
devtools::install_github("PMildenb/SteppedPower", ref = "devel", build_vignettes = TRUE) ## latest 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)For more details, see the package vignettes:
vignette("Getting_Started", package = "SteppedPower")pmildenb@uni-mainz.deMIT