cps.irgtt.count: Power simulations for cluster-randomized trials: Individually...

Description Usage Arguments Details Value Author(s) Examples

View source: R/cps.irgtt.count.R

Description

This function utilizes iterative simulations to determine approximate power for 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.irgtt.count(
  nsim = NULL,
  nsubjects = NULL,
  nclusters = NULL,
  c1 = NULL,
  c2 = NULL,
  sigma_b_sq = 0,
  sigma_b_sq2 = 0,
  family = "poisson",
  analysis = "poisson",
  negBinomSize = 1,
  alpha = 0.05,
  quiet = FALSE,
  allSimData = FALSE,
  poorFitOverride = FALSE,
  lowPowerOverride = FALSE,
  timelimitOverride = TRUE,
  nofit = FALSE,
  seed = NA,
  optmethod = "Nelder_Mead"
)

Arguments

nsim

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

nsubjects

Number of subjects per cluster; accepts integer (required).

nclusters

Number of clusters in the arm; accepts integer (required). Arm 1 cluster size defaults to 1.

At least 2 of the following 3 arguments must be specified:

c1

Expected outcome count in arm 1

c2

Expected outcome count in arm 2

sigma_b_sq

Between-cluster variance; defaults to 0. Accepts numeric. If between cluster variances differ between arms, the following must also be specified:

sigma_b_sq2

Between-cluster variance for clusters in arm 2

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 'poisson' or '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.

alpha

Significance level. Default = 0.05.

quiet

When set to FALSE, displays simulation progress and estimated completion time. Default = 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.

nofit

Option to skip model fitting and analysis and return the simulated data. Defaults to FALSE.

seed

Option to set seed. Default is NA.

optmethod

Option to fit with a different optimizer. Defaults to Nelder_Mead.

Details

Runs the power simulation for count outcomes.

Users must specify the desired number of simulations, number of subjects per cluster, number of clusters per arm, between-cluster variance, two of the following: expected count in arm 1 (no clusters), expected count in arm 2 (clustered arm), expected difference in counts between arms; significance level, and whether or not progress updates should be displayed while the function is running.

Value

A list with the following components

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

Author(s)

Alexandria C. Sakrejda (acbro0@umass.edu

Alexander R. Bogdan

Ken Kleinman (ken.kleinman@gmail.com)

Examples

1
2
3
4
5
6
7
## Not run: 
irgtt.count.sim <- cps.irgtt.count(nsim = 100, nsubjects = c(200, 10), nclusters = 10, 
                             c1 = 5, c2 = 7, sigma_b_sq2 = 0.1, 
                             family = 'poisson', analysis = 'poisson',
                             alpha = 0.05, quiet = FALSE, allSimData = FALSE)

## End(Not run)

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