cps.binary: Power simulations for cluster-randomized trials: Parallel...

Description Usage Arguments Details Value Testing details Author(s) References See Also Examples

View source: R/cps.binary.R

Description

\loadmathjax

This function uses Monte Carlo methods (simulations) to estimate power for cluster-randomized trials. Users can modify a variety of parameters to suit the simulations to their desired experimental situation.

Users must specify the desired number of simulations, number of subjects per cluster, number of clusters per arm, and two of the following three parameters: expected probability of the outcome in one group, expected probability of the outcome in the second group, and expected difference in probabilities between groups. Default values are provided for significance level, analytic method, progress updates, and whether the simulated data sets are retained.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
cps.binary(
  nsim = NULL,
  nsubjects = NULL,
  nclusters = NULL,
  p1 = NULL,
  p2 = NULL,
  sigma_b_sq = NULL,
  sigma_b_sq2 = NULL,
  alpha = 0.05,
  method = "glmm",
  quiet = FALSE,
  allSimData = FALSE,
  seed = NA,
  nofit = FALSE,
  poorFitOverride = FALSE,
  lowPowerOverride = FALSE,
  timelimitOverride = TRUE,
  irgtt = FALSE
)

Arguments

nsim

Number of datasets to simulate; accepts integer. Required.

nsubjects

Number of subjects per cluster; accepts either a scalar (implying equal cluster sizes for the two groups), a vector of length two (equal cluster sizes within arm), or a vector of length sum(nclusters) (unequal cluster sizes within arm). Required.

nclusters

Number of clusters per treatment group; accepts a single integer (if there are the same number of clusters in each arm) or a vector of 2 integers (if nsubjects differs between arms). If a vector of cluster sizes >2 is provided in nsubjects, sum(nclusters) must match the nsubjects vector length. Required.

p1

Expected probability of outcome in first group.

p2

Expected probability of outcome in second group.

sigma_b_sq

Between-cluster variance; if sigma_b_sq2 is not specified, between-cluster variances are assumed to be equal in the two arms. Accepts numeric. Required.

sigma_b_sq2

Between-cluster variance for clusters in second group. Only required if between-cluster variances differ between treatment arms.

alpha

Significance level; default = 0.05.

method

Data analysis method, either generalized linear mixed effects model (GLMM) or generalized estimating equations (GEE). Accepts c('glmm', 'gee'); default = 'glmm'. Required.

quiet

When set to FALSE, displays simulation progress and estimated completion time, default = TRUE.

allSimData

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

seed

Option to set the seed. Default is NA.

nofit

Option to skip model fitting and analysis and only return the simulated data. Default = FALSE.

poorFitOverride

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

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.

irgtt

Logical. Default = FALSE. Is the experimental design an individually randomized group treatment trial? For details, see ?cps.irgtt.binary.

Details

The data generating model for observation \mjseqnj in cluster \mjseqni is:

\mjsdeqn

y_ij \sim Bernoulli(\frace^p_1 + b_i1 + e^p_1 + b_i ) for the first group or arm, where \mjseqnb_i \sim N(0,\sigma_b^2), while for the second group, \mjsdeqny_ij \sim Bernoulli(\frace^p_2 + b_i1 + e^p_2 + b_i ) where \mjseqnb_i \sim N(0,\sigma_b_2^2); if \mjseqn\sigma_b_2^2 is not used, then the second group uses \mjseqnb_i \sim N(0,\sigma_b^2).

All random terms are generated independent of one another.

Non-convergent models are not included in the calculation of exact confidence intervals.

Value

If nofit = F, a list with the following components:

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

Testing details

This function has been verified against reference values from the NIH's GRT Sample Size Calculator, PASS11, CRTsize::n4prop, and clusterPower::cpa.binary.

Author(s)

Alexander R. Bogdan, Alexandria C. Sakrejda (acbro0@umass.edu), and Ken Kleinman (ken.kleinman@gmail.com) #'

References

Elridge, S., Ukoumunne, O. & Carlin, J. The Intra-Cluster Correlation Coefficient in Cluster Randomized Trials: A Review of Definitions. International Statistical Review (2009), 77, 3, 378-394. doi: 10.1111/j.1751-5823.2009.00092.x

Snjiders, T. & Bosker, R. Multilevel Analysis: an Introduction to Basic and Advanced Multilevel Modelling. London, 1999: Sage.

Wu S, Crespi CM, Wong WK. Comparison of Methods for Estimating Intraclass Correlation Coefficient for Binary Responses in Cancer Prevention Cluster Randomized Trials. Contemp Clin Trials. 2012; 33(5): 869-880. doi:10.1016/j.cct.2012.05.004 London: Arnold; 2000.

See Also

An intracluster correlation coefficient (ICC) for binary outcome data is neither a natural parameter of the data generating model nor a function of its parameters. Several methods for calculation have been suggested (Wu, Crespi, and Wong, 2012). We provide several versions of ICCs for comparison. These can be accessed in the bincalcICC() function.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Estimate power for a trial with 10 clusters in each arm, 20 subjects in
# each cluster, with a probability of 0.8 in the first arm and 0.5 in the
# second arm, with a sigma_b_sq = 1 in the first arm sigma_b_sq = 1.2 in
# the second arm.

## Not run: 
binary.sim = cps.binary(nsim = 100, nsubjects = 20,
  nclusters = 10, p1 = 0.8,
  p2 = 0.5, sigma_b_sq = 1,
  sigma_b_sq2 = 1.2, alpha = 0.05,
  method = 'glmm', allSimData = FALSE)

## End(Not run)

# Estimate power for a trial just as above, except that in the first arm,
# the clusters have 10 subjects in 9 of the 10 clusters and 100 in the tenth
# cluster, while in the second arm all clusters have 20 subjects.

## Not run: 
binary.sim2 = cps.binary(nsim = 100,
  nsubjects = c(c(rep(10,9),100), rep(20,10)),
  nclusters = 10, p1 = 0.8,
  p2 = 0.5, sigma_b_sq = 1,
  sigma_b_sq2 = 1.2, alpha = 0.05,
  method = 'gee', allSimData = FALSE)

## End(Not run)

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