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

View source: R/swGlmSiz.R

swGlmSizR Documentation

Sample Size of Stepped Wedge Cluster Randomized Trial (SW CRT) using GLMM

Description

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

Usage

swGlmSiz(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 swGlmPwr. See documentation for swGlmPwr.

Details

swGlmSiz calls swGlmPwr iteratively to find the number of participants per cluster-period needed to achieve power power. Note that all warnings and messages normally generated by swGlmPwr are turned off. Also, the argument retDATA is set to FALSE. It is recommended that after using swGlmSiz, the user call swGlmPwr 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 swGlmPwr causes swGlmSiz to terminate and the error message from swGlmPwr is printed.

Value

numeric (list): swGlmSiz 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 swGlmPwr, obtained with the sample size n.

Author(s)

Avi Kenny, James P Hughes

Examples

swGlmSiz(power = 0.8, design = swDsn(clusters=c(4,4,4,4)),distn = "binomial",
         fixed.intercept = log(0.1/0.9), fixed.treatment.effect = log(0.9), 
         fixed.time.effect=0, tau = 0.2)


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