cps.sw.normal: Power simulations for cluster-randomized trials: Stepped...

Description Usage Arguments Details Value Author(s) Examples

View source: R/cps.sw.normal.R

Description

This set of functions utilize iterative simulations to determine approximate power for stepped wedge cluster-randomized controlled trials. Users can modify a variety of parameters to suit the simulations to their desired experimental situation.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
cps.sw.normal(
  nsim = NULL,
  nsubjects = NULL,
  nclusters = NULL,
  mu0 = 0,
  mu1 = NULL,
  steps = NULL,
  sigma_sq = NULL,
  sigma_b_sq = NULL,
  alpha = 0.05,
  method = "glmm",
  quiet = FALSE,
  allSimData = FALSE,
  poorFitOverride = FALSE,
  lowPowerOverride = FALSE,
  timelimitOverride = TRUE,
  seed = NULL
)

Arguments

nsim

Number of datasets to simulate; accepts integer (required).

nsubjects

Number of subjects per cluster; accepts either a scalar (equal cluster sizes) or a vector of length nclusters (user-defined size for each cluster) (required).

nclusters

Number of clusters; accepts non-negative integer scalar (required).

mu0

Expected baseline mean; accepts numeric, default 0. Required..

mu1

Expected post-treatment mean; accepts numeric. Required.

steps

Number of crossover steps; a baseline step (all clusters in non-treatment group) is assumed. Accepts positive scalar (indicating the total number of steps; clusters per step is obtained by nclusters / steps) or a vector of non-negative integers corresponding either to the number of clusters to be crossed over at each time point (e.g c(2,4,4,2); nclusters = 10) or the cumulative number of clusters crossed over by a given time point (e.g. c(2,4,8,10); nclusters = 10) (required).

sigma_sq

Within-cluster variance; accepts non-negative numeric scalar (indicating equal within-cluster variances for both treatment groups) or a vector of length 2 specifying within-cluster variances for the non-treatment and treatment groups, respectively (required).

sigma_b_sq

Between-cluster variance; accepts non-negative numeric scalar (indicating equal between-cluster variances for both treatment groups) or a vector of length 2 specifying treatment-specific between-cluster variances (required).

alpha

Significance level. Default = 0.05.

method

Analytical method, either Generalized Linear Mixed Effects Model (GLMM) or Generalized Estimating Equation (GEE). Accepts c('glmm', 'gee') (required); default = 'glmm'.

quiet

When set to FALSE, displays simulation progress and estimated completion time; default is FALSE.

allSimData

Option to output list of all simulated datasets; default = FALSE.

poorFitOverride

Option to override stop() if more than 25% of fits fail to converge; default = FALSE.

lowPowerOverride

Option to override stop() if the power is less than 0.5 after the first 50 simulations and every ten simulations thereafter. On function execution stop, the actual power is printed in the stop message. Default = FALSE. When TRUE, this check is ignored and the calculated power is returned regardless of value.

timelimitOverride

Logical. When FALSE, stops execution if the estimated completion time is more than 2 minutes. Defaults to TRUE.

seed

Option to set.seed. Default is NULL.

Details

Runs power simulations for stepped wedge cluster-randomized controlled trials with continuous outcome. The stepped wedge trial design is a type of cross-over design in which clusters change treatments in waves. Initially all the clusters recieve the same standard treatment, and at the end of the trial all of the clusters will be recieving the treatment of interest. More than one cluster can change treatments in a wave, but the order in which clusters change treatments is randomly determined. The outcome of interest is assessed in each cluster during each wave.

Users must specify the desired number of simulations, number of subjects per cluster, number of clusters per arm, expected means for each arm, within-cluster variance, between-cluster variance, significance level, analytic method, progress updates, and simulated data set output may also be specified.

Value

A list with the following components

If nofit = T, a data frame of the simulated data sets, containing:

Author(s)

Alexander R. Bogdan

Alexandria C. Sakrejda (acbro0@umass.edu)

Ken Kleinman (ken.kleinman@gmail.com)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Estimate power for a trial with 3 steps and 9 clusters in arm 1 (often the 
# standard-of-care or 'control' arm) at the initiation of the study. Those 
# clusters have 14 subjects each, with sigma_b = 1 and sigma_b_sq = 1. We 
# have estimated arm outcome means of 1 and 2.1 in the first and second arms, 
# respectively, and 100 simulated data sets analyzed by the GLMM method. Using seed = 123, 
# the resulting power should be 0.82.

## Not run: 
normal.sw.rct = cps.sw.normal(nsim = 100, nsubjects = 14, nclusters = 9, 
                              mu0 = 1, mu1 = 2.1, steps = 3, sigma_sq = 1, 
                              sigma_b_sq = 1, alpha = 0.05, method = 'glmm', 
                              seed = 123)

## End(Not run)

clusterPower documentation built on Jan. 29, 2021, 1:06 a.m.