The smartsizer
package
is designed to assist investigators who are planning sequential,
multiple assignment, randomized trials (SMART) in determining the sample
size of individuals to enroll. The main goal motivating SMART designs is
determination of optimal dynamic treatment regime (DTR). Therefore,
investigators are interested in sizing SMARTs based on the ability to
screen out DTRs inferior to the best by a specified amount Δmin with probability
1 − β while identifying the
true best with a specified probability 1 − α. The smartsizer
package utilizes the
Multiple Comparisons with the Best (MCB) methodology for determining a
set of best DTRs while adjusting for multiple comparisons.
Using smartsizer
,
investigators may perform power analyses for an arbitrary type of
SMART.
Details on the methodology and guidelines for choosing the covariance matrix are available in ‘’W.J. Artman, I. Nahum-Shani, T. Wu, J.R. Mckay, and A. Ertefaie. Power analysis in a SMART design: sample size estimation for determining the best embedded dynamic treatment regime. Biostatistics, 2018’’.
The computePower
function computes the power as a function of the given covariance
matrix, effect sizes, type I error rate, and sample size. The power is
the probability of excluding from the set of best all embedded DTR
(EDTR) which are inferior to the true best DTR by Δmin or more.
The arguments of the computePower
function are as
follows:
1. V
: the covariance
matrix of mean EDTR outcome estimators.
2. Delta
: the vector of
effect sizes.
3. min_Delta
: the minimum
detectable effect size.
4. alpha
: the type I error
rate (less than 0.5 and greater than 0).
5. sample_size
: the number
of individuals enrolled in the SMART.
We will now look at how to use the computePower function. Consider the following covariance matrices:
V1
corresponds to a
SMART in which there are six EDTRs. V2
corresponds to a SMART in
which there are four EDTRs.
Let the vector of effect sizes be
Delta1 <- c(0, 0.5, 0.5, 0.5, 0.5, 0.5)
min_Delta1 <- 0.5
Delta2 <- c(0, 0.2, 0.3, 1.5)
min_Delta2 <- 0.2
In both Delta1 and Delta2, we are assuming the first DTR is best. For
Delta1 we are being as conservative as possible by assuming all other
DTRs are the minimum detectable effect size away. In the first example,
the power is the probability of excluding all EDTRs 0.5 away from the
first EDTR or more. In particular, the power is the probability of
excluding EDTR2, ..., EDTR6.
In the second example, we have information that some of the effect
sizes are further away from the best than than the min detectable effect
size which yields greater power. The power is the probability of
excluding EDTR2, EDTR3, EDTR4
from the set of best.
We assume the type I error rate to be at most 0.05 so that the best DTR is included in the set of best with probability at least 1 − α. The power is computed as follows:
computePower(V1, Delta1, min_Delta1, alpha = 0.05, sample_size = 120)
#> [1] 0.83
computePower(V2, Delta2, min_Delta2, alpha = 0.05, sample_size = 250)
#> [1] 0.64
We see that the power is 83% in the first example and 64% in the second.
The computeSampleSize
function estimates the minimum number of individuals that need to be
enrolled in order to achieve a specified power.
The arguments of the computeSampleSize
function are as
follows:
1. V
: the covariance
matrix of mean EDTR outcome estimators.
2. Delta
: the vector of
effect sizes.
3. min_Delta
: the minimum
detectable effect size.
4. alpha
: the type I error
rate (less than 0.5 and greater than 0).
5. power
: the desired
power.
We will look at the same example as in the power calculation. Let
Assume the vector of effect sizes are
Delta1 <- c(0, 0.5, 0.5, 0.5, 0.5, 0.5)
min_Delta1 <- 0.5
Delta2 <- c(0, 0.2, 0.3, 1.5)
min_Delta2 <- 0.2
computeSampleSize(V1, Delta1, min_Delta1, alpha = 0.05, desired_power = 0.8)
#> [1] 113
computeSampleSize(V2, Delta2, min_Delta2, alpha = 0.05, desired_power = 0.8)
#> [1] 345
The sample size in the first example is the minimum number of individuals which need to be enrolled in order achieve 80% power of excluding EDTR2, EDTR3, EDTR4, EDTR5, and EDTR6 from the set of best.
The second example computes the minimum number of individuals
which need to be enrolled in order to achieve 80% power to exclude EDTR2, EDTR3, and
EDTR4.
Consequently, 114 individuals need to be enrolled in the first
example and 347 individuals need to be enrolled in the second example in
order to achieve 80% power.
We now demonstrate the computePowerBySampleSize
and
plotPowerByN
functions.
computePowerBySampleSize
computes the power over a grid of sample size values.
computePowerBySampleSize(V1, Delta1, min_Delta1, alpha = 0.05, sample_size_grid = seq(50, 200, 25))
#> [1] 0.26 0.51 0.72 0.86 0.93 0.97 0.99
computePowerBySampleSize(V2, Delta2, min_Delta2, alpha = 0.05, sample_size_grid = seq(50, 500, 50))
#> [1] 0.09 0.23 0.38 0.52 0.64 0.73 0.80 0.86 0.90 0.93
The plotPowerByN
function plots the power vs. the sample size over a grid of sample size
values. The following two example plots demonstrate the function. The
power is computed using common random variables to reduce the variance
and to speed up generation of the plots.
plotPowerByN(V1, Delta1, min_Delta1, alpha = 0.05, sample_size_grid = seq(50, 200, 25), color = "black")
plotPowerByN(V2, Delta2, min_Delta2, alpha = 0.05, sample_size_grid = seq(50, 500, 50), color = "blue")
Special thanks to Tingting Zhan for discovering a bug in computePowerBySampleSize
.
Please cite ‘’W.J. Artman, I. Nahum-Shani, T. Wu, J.R. Mckay, and A. Ertefaie. Power analysis in a SMART design: sample size estimation for determining the best embedded dynamic treatment regime. Biostatistics, 2018.’’ if you use this package.