Learn R Programming

clusterPower (version 0.7.0)

cpa.normal: Analytic power calculations for parallel arm cluster-randomized trials with normal outcomes

Description

Compute the power, number of clusters needed, number of subjects per cluster needed, or other key parameters for a simple parallel cluster randomized trial with a normal outcome.

Exactly one of alpha, power, nclusters, nsubjects, CV, and d must be passed as NA. Note that alpha, power, and CV have non-NA defaults, so if those are the parameters of interest they must be explicitly passed as NA. The user must supply sufficient variance parameters to produce values for both the ICC and the total variance by providing 2 of the following: ICC, vart, sigma_b_sq, or sigma_sq.

If nsubjects is a vector, the values nclusters and CV will be recalculated using the values in nsubjects. If nsubjects is a vector and method is "taylor", the exact relative efficiency will be calculated as described in van Breukelen et al (2007).

Usage

cpa.normal(
  alpha = 0.05,
  power = NA,
  nclusters = NA,
  nsubjects = NA,
  sigma_sq = NA,
  sigma_b_sq = NA,
  CV = 0,
  d = NA,
  ICC = NA,
  vart = NA,
  method = c("taylor", "weighted"),
  tol = .Machine$double.eps^0.25
)

Arguments

alpha

The level of significance of the test, the probability of a Type I error.

power

The power of the test, 1 minus the probability of a Type II error. Defaults to NA.

nclusters

The number of clusters per condition. It must be greater than 1.

nsubjects

The mean of the cluster sizes, or a vector of cluster sizes for one arm. When nsubjects is a vector, CV and nclusters are calculated from nsubjects and user-entered CV and nclusters is ignored.

sigma_sq

Within-cluster (residual) variance, ^2.

sigma_b_sq

Between-cluster variance ^2_b.

CV

The coefficient of variation of the cluster sizes. When CV = 0, the clusters all have the same size.

d

The difference in condition means.

ICC

The intraclass correlation _b^2 / (_b^2 + ^2). Accepts a numeric between 0-1.

vart

The total variation of the outcome (the sum of within- and between-cluster variation) _b^2 + ^2.

method

The method for calculating variance inflation due to unequal cluster sizes. Either a method based on Taylor approximation of relative efficiency ("taylor"), or weighting by cluster size ("weighted"). Default is "taylor".

tol

Numerical tolerance used in root finding. The default provides at least four significant digits.

Value

The computed value of the NA parameter (from among alpha, power, nclusters, nsubjects, CV, and d) needed to satisfy the power and sample size equation.

Testing details

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

Authors

Jonathan Moyer (jon.moyer@gmail.com), Alexandria C. Sakrejda (acbro0@umass.edu), and Ken Kleinman (ken.kleinman@gmail.com)

References

Eldridge SM, Ukoumunne OC, Carlin JB. (2009) The Intra-Cluster Correlation Coefficient in Cluster Randomized Trials: A Review of Definitions. Int Stat Rev. 77: 378-394.

Eldridge SM, Ashby D, Kerry S. (2006) Sample size for cluster randomized trials: effect of coefficient of variation of cluster size and analysis method. Int J Epidemiol. 35(5):1292-300.

van Breukelen GJP, Candel MJJM, Berger MPF. (2007) Relative efficiency of unequal versus equal cluster sizes in cluster randomized and multicentre trials. Statist Med. 26:2589-2603.

Examples

Run this code
# NOT RUN {
# Find the number of clusters per condition needed for a trial with alpha = .05, 
# power = 0.8, 10 observations per cluster, no variation in cluster size, a difference 
# of 1 unit,  ICC = 0.1 and a variance of five units:
# }
# NOT RUN {
cpa.normal(nsubjects = 10, d = 1, ICC = .1, vart = 5)
 
# }
# NOT RUN {
# The result, showing nclusters of greater than 15, suggests 16 clusters per 
# condition should be used.

# Find the power achieved with 16 clusters, 10 subjects per cluster,
# difference between condition of 1 unit, ICC = .1, and total variance
# of 5 units:
# }
# NOT RUN {
cpa.normal(power = NA, nclusters = 16, nsubjects = 10, d = 1,
           sigma_b_sq = .5, vart = 5)
# }
# NOT RUN {
# The result shows the power is 0.801766.

# Find the power achieved when each trial arm has 5 clusters of
# sizes 100, 50, 25, 100, and 100. When a vector of cluster sizes 
# is provided (as in this example), the "ncluster" argument is ignored.

# }
# NOT RUN {
cpa.normal(alpha = .05, power = NA, nsubjects = c(100, 50, 25, 100, 100),
           d = .2, ICC = .1, sigma_b_sq = .1)
# }
# NOT RUN {
# The result shows the power is 0.13315.

# Find the power achieved with 20 clusters per arm, where
# the cluster sizes vary but have a mean size of 100 and coefficient of variation of .5:
# }
# NOT RUN {
cpa.normal(alpha = .05, power = NA, nclusters = 20, nsubjects = 100, CV = .5,
           d = .2, ICC = .1, sigma_b_sq = .1)
# }
# NOT RUN {
# The result shows the power is 0.4559881.

# }

Run the code above in your browser using DataLab