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

Description Usage Arguments Details Value Author(s) Examples

View source: R/cps.sw.count.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
19
20
21
cps.sw.count(
  nsim = NULL,
  nsubjects = NULL,
  nclusters = NULL,
  c0 = NULL,
  c1 = NULL,
  steps = NULL,
  sigma_b_sq = NULL,
  alpha = 0.05,
  family = "poisson",
  analysis = "poisson",
  negBinomSize = 1,
  method = "glmm",
  quiet = FALSE,
  allSimData = FALSE,
  poorFitOverride = FALSE,
  lowPowerOverride = FALSE,
  timelimitOverride = TRUE,
  opt = "L-BFGS-B",
  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).

c0

Expected outcome count in arm 1. Accepts scalar (required).

c1

Expected outcome count in arm 2. Accepts scalar (required).

steps

Number of crossover steps; a baseline step (all clusters in arm 1) 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_b_sq

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

alpha

Significance level. Default = 0.05.

family

Distribution from which responses are simulated. Accepts Poisson ('poisson') or negative binomial ('neg.binom') (required); default = 'poisson'

analysis

Family used for regression; currently only applicable for GLMM. Accepts c('poisson', 'neg.binom') (required); default = 'poisson'

negBinomSize

Only used when generating simulated data from the negative binomial (family = 'neg.binom'), this is the target for number of successful trials, or the dispersion parameter (the shape parameter of the gamma mixing distribution). Must be strictly positive but need not be integer. Defaults to 1.

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.

opt

Option to fit with a different optimizer (using the package optimx). Default is 'L-BFGS-B'.

seed

Option to set.seed. Default is NULL.

Details

Runs power simulations for stepped wedge cluster-randomized controlled trials with a count 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 absolute difference between arms, between-cluster variance; significance level, distributional family for data generation, 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 12 clusters in arm 1
# (often the standard-of-care or 'control' arm) at the initiation
#of the study. Those clusters have 15 subjects each, with sigma_b_sq = 1.
# We have estimated arm outcome counts of 4 and 5 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.85.

## Not run: 
count.sw.rct = cps.sw.count(nsim = 100, nsubjects = 15, nclusters = 12,
                              c0 = 4, c1 = 5, steps = 3, sigma_b_sq = 1,
                              alpha = 0.05, family = 'poisson', analysis = 'poisson',
                              method = 'glmm', seed = 123)

## End(Not run)

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