Description Usage Arguments Details Value Author(s) References See Also Examples
View source: R/Maxcombo_size.R
Sample size calculation to control the type II error or the power of an interim analysis with Maxcombo tests.
1 2 3 4 5 6 7 8 9 10 11 | Maxcombo.sz(
Sigma1,
mu1,
z_alpha_vec,
beta,
interim_vec,
R,
n_range,
sum_D,
n.rep = 5
)
|
Sigma1 |
the correlation matrix under the alternative hypothesis. |
mu1 |
the unit mu under the alternative hypothesis (the mean of the expectation of each subject scaled weighted log-rank test statistic, which can be approximated using the formula for E^* in Hasegawa 2014 paper. ). |
z_alpha_vec |
same as the one exported from Maxcombo.bd, which is the boundaries for ordered test statistics, its order should be consistent to the rows and columns in |
beta |
type II error. |
interim_vec |
the vector of the interims in each stages, not that it should be a repeat vector with same iterim values for all the test statitics at same stages. |
R |
end of the enrollment time, which is identical to |
n_range |
the range ot the expected patient numbers. |
sum_D |
same as the exported value from |
n.rep |
number of repeats to take the median for output |
Assume that there are 2 stages (1 interm, 1 final), and two tests for a max-combo in each stage, then we have 4 test statistics, and the two cutoff values for the two stages have been determined by Maxcombo.bd
in advance using their correlation matrix and the error spending function α_1, α. The goal of this function is to control the sample size n (number of patients for both arms) or d (observed events) to achieve the ideal type II error β or the power (1-β), i.e. \P(Z_{11}<z_1,Z_{12}<z_1,Z_{21}<z_2,Z_{22}<z_2)=β.
n |
the number of patients needed for the trial to achieve the predefined power. |
d |
the number of events needed for the trial to achieve the predefined power. |
sum_D |
the input |
Lili Wang
Hasegawa, T. (2014). Sample size determination for the weighted log‐rank test with the Fleming–Harrington class of weights in cancer vaccine studies. Pharmaceutical statistics, 13(2), 128-135.
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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | ## Not run:
# install.packages("mvtnorm")
library(mvtnorm)
# install.packages("gsDesign")
library(gsDesign)
alpha <- 0.025
beta <- 0.1
# If there are two stages (K = 2), with on interim stage and a final stage
# First we obtain the errors spent at each stage to be identical to the ones
from regular interim analysis assuming that the interim stage happened at
60% of events have been observed. The error spending function used below
is O\'Brien-Fleming.
x <- gsDesign::gsDesign(
k = 2,
test.type = 1,
timing = 0.6,
sfu = "OF",
alpha = alpha,
beta = beta,
delta = -log(0.7)
)
(z <- x$upper$bound)
x
Sigma0_v <- rep(0.5,6)
Sigma0 <- matrix(1, ncol = 4, nrow = 4)
Sigma0[upper.tri(Sigma0)]<- Sigma0_v
Sigma0[lower.tri(Sigma0)]<- t(Sigma0)[lower.tri(t(Sigma0))]
Sigma0
alpha_interim <- pnorm(z[1],lower.tail = F) # The error you would like to spend at the interim stage
zz <- Maxcombo.bd(
Sigma0 = Sigma0,
index = c(1, 1, 2, 2),
alpha_sp = c(alpha_interim,alpha)
)
zz$z_alpha # boundary value for each stage
zz$z_alpha_vec # boundary value for each test statistic correponding to index
# Correlation matrix under the alternative hypothesis
Sigma1_v<-rep(0.5,6)
Sigma1<-matrix(1, ncol=4,nrow=4)
Sigma1[upper.tri(Sigma1)]<- Sigma1_v
Sigma1[lower.tri(Sigma1)]<- t(Sigma1)[lower.tri(t(Sigma1))]
Sigma1
# Define mu1
mu1=c(0.1,0.1,0.2,0.2)
# Obtain the sample size
Maxcombo.sz(
Sigma1 = Sigma1,
mu1 = mu1,
z_alpha_vec = zz$z_alpha_vec,
beta = 0.1,
interim_vec=c(10,10,18,18),
R = 14,
n_range = c(100,1000),
sum_D = 0.6)
# need 232 patients, 140 deaths
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.