Description Usage Arguments Details Value Note Authors References Examples
View source: R/cpa.ma.normal.R
Compute the power of the overall F-test for a multi-arm cluster randomized trial with a continuous outcome, or determine parameters to obtain a target power.
1 2 3 4 5 6 7 8 9 10 11 |
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. |
narms |
The number of independent arms (conditions). It must be greater than 2. |
nclusters |
The number of clusters per arm. It must be greater than 1. |
nsubjects |
The cluster size. |
vara |
The between-arm variance. |
varc |
The between-cluster variance. |
vare |
The within-cluster variance. |
tol |
Numerical tolerance used in root finding. The default provides at least four significant digits. |
Exactly one of alpha
, power
, narms
, nclusters
,
nsubjects
, vara
, varc
, and vare
must be passed as NA
.
Note that alpha
and power
have non-NA
defaults, so if those are the parameters of interest they must be
explicitly passed as NA
.
Assuming a balanced design, the between-arm variance σ_a^2 (corresponding to
the function argument vara
) can be estimated using the formula:
σ_a^2 = ∑\limits_{i=1}^{n_a}(μ_i - μ)^2/(n_a-1)
where n_a is the number of arms, μ_i is the estimate of the i-th arm
mean, and μ is the estimate of the overall mean of the outcome. This
variance can be computed in R using the var
function and a vector of arm means.
For example, suppose the estimated means for a three-arm trial were 74, 80, and 86 Then the
estimate of the between-arm variance could be computed with var(c(74,80,86))
,
yielding a value of 36.
The computed argument.
This function was inspired by work from Stephane Champely (pwr.t.test), Peter Dalgaard (power.t.test), and Claus Ekstrom (power.anova.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.
Jonathan Moyer (jon.moyer@gmail.com), Ken Kleinman (ken.kleinman@gmail.com)
Murray DM. Design and Analysis of Group-Randomized Trials. New York, NY: Oxford University Press; 1998.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # Suppose we are planning a multi-arm trial composed of a control arm and
# two treatment arms. It is known that each arm will contain 5 clusters. We
# wish to know the minimum number of subjects per cluster necessary to
# attain 80% power at a 5% level of significance. A pilot study was used to
# determine estimates of the between-arm variance, the between-cluster
# variance, and the within-cluster variance. The observed means of each arm
# in the pilot study were 74, 80, and 86, so the between-arm variance is 36.
# As discussed in the "Details" section above, this can be calculated using
# the command var(c(74,80,86)). The within-cluster and between-cluster
# standard deviations were observed to be 8 and 3, respectively. This means
# the within-cluster and between-cluster variances are 64 and 9, respectively.
# These values are entered into the function as follows:
cpa.ma.normal(narms=3,nclusters=5,vara=36,varc=9,vare=64)
#
# The result, showing nsubjects of greater than 20, suggests 21 subjects per
# cluster should be used.
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.