swSiz: Sample Size of Stepped Wedge Cluster Randomized Trial (SW...

View source: R/swSiz.R

swSizR Documentation

Sample Size of Stepped Wedge Cluster Randomized Trial (SW CRT) for LMM

Description

swSiz is a wrapper function for swPwr. For a given design, number of clusters, power and fixed and random effect parameters, swSiz computes the number of individuals per cluster needed to achieve the desired power.

Usage

swSiz(power, alpha=0.05, ...)

Arguments

power

numeric (scalar) Desired power. Must be between \alpha (default = 0.05) and 1.

alpha

numeric (scalar): Two-sided statistical significance level.

...

Arguments to be passed to swPwr. See documentation for swPwr.

Details

swSiz calls swPwr iteratively to find the number of participants per cluster-period needed to achieve power power. Note that all warnings and messages normally generated by swPwr are turned off. Also, the argument retDATA is set to FALSE. It is recommended that after using swSiz, the user call swPwr with the recommended sample size to view any warning messages and/or to get the data normally returned when retDATA is TRUE.

An error in swPwr causes swSiz to terminate and the error message from swPwr is printed.

Value

numeric (list): swSiz returns a list of the following:

n

scalar: number of individuals per cluster-period required to achieve the desired power.

power

scalar: exact power, as computed by swPwr, obtained with the sample size n.

Author(s)

Avi Kenny, James P Hughes

Examples

swSiz(power = 0.9, design = swDsn(clusters=c(4,4,4,4)),
  distn = "gaussian", mu0 = 0, mu1 = 0.1, sigma = 0.5, icc = 0.1)

swCRTdesign documentation built on Sept. 9, 2025, 5:55 p.m.