cpa.normal: Analytic power calculations for parallel arm...

Description Usage Arguments Value Note Testing details Authors References Examples

View source: R/cpa.normal.R

Description

\loadmathjax

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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, \mjseqn\sigma^2.

sigma_b_sq

Between-cluster variance \mjseqn\sigma^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 \mjseqn\sigma_b^2 / (\sigma_b^2 + \sigma^2). Accepts a numeric between 0-1.

vart

The total variation of the outcome (the sum of within- and between-cluster variation) \mjseqn\sigma_b^2 + \sigma^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.

Note

This function was inspired by work from Stephane Champely (pwr.t.test) and Peter Dalgaard (power.t.test). As with those functions, 'uniroot' is used to solve power equation for unknowns, so you may see errors from it, notably about inability to bracket the root when invalid arguments are given. This generally means that no solution exists for which the omitted parameter and the supplied parameters fulfill the equation. In particular, the desired power may not be achievable with any number of subjects or clusters.

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

 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
28
29
30
31
32
33
34
35
36
37
38
39
# 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)
 
## End(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)

## End(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)

## End(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)

## End(Not run)
# The result shows the power is 0.4559881.

nickreich/clusterPower documentation built on Feb. 3, 2021, 6:54 p.m.