## Introduction

Here, we present the calculations for the initial design of the DEFUSE3 trial based on [@Lai2014191] and [@Lai201593]. The trial parameters are fixed as follows.

NOTE The number of simulations has been drastically reduced in this vignette in order to avoid taxing CRAN servers. The full_doc sources contain the complete sources and output; see files in the directory

system.file("full_doc", package="ASSISTant")
library(ASSISTant)
##Fix randomization vector N, errors, eps
trialParameters <- list(N = c(200, 340, 476), type1Error = 0.025,
eps = 1/2, type2Error = 0.1)

The design parameters are the following for various scenarios.

designParameters <- list(
nul0 = list(prevalence = rep(1/6, 6), mean = matrix(0, 2, 6),
sd = matrix(1, 2, 6)),
alt1 = list(prevalence = rep(1/6, 6), mean = rbind(rep(0, 6),
c(0.5, 0.4, 0.3, 0, 0, 0)),
sd = matrix(1, 2, 6)),
alt2 = list(prevalence = rep(1/6, 6), mean = rbind(rep(0, 6),
c(0.5, 0.5, 0, 0, 0, 0)),
sd = matrix(1,2, 6)),
alt3 = list(prevalence = rep(1/6, 6), mean = rbind(rep(0, 6), rep(0.36, 6)),
sd = matrix(1,2, 6)),
alt4 = list(prevalence = rep(1/6, 6), mean = rbind(rep(0, 6), rep(0.30, 6)),
sd = matrix(1,2, 6)),
alt5 = list(prevalence = rep(1/6, 6), mean = rbind(rep(0, 6),
c(0.4, 0.3, 0.2, 0, 0, 0)),
sd = matrix(1,2, 6)),
alt6 = list(prevalence = rep(1/6, 6), mean = rbind(rep(0, 6),
c(0.5, 0.5, 0.3, 0.3, 0.1, 0.1)),
sd = matrix(1,2, 6))
)

## The NULL Scenario

defuse3 <- DEFUSE3Design$new(trialParameters = trialParameters, numberOfSimulations = 100, designParameters = designParameters$nul0, showProgress = FALSE)
print(defuse3)
## Design Parameters:
## List of 4
##  $prevalence: num [1:6] 0.167 0.167 0.167 0.167 0.167 ... ##$ mean      : num [1:2, 1:6] 0 0 0 0 0 0 0 0 0 0 ...
##  $sd : num [1:2, 1:6] 1 1 1 1 1 1 1 1 1 1 ... ##$ J         : int 6
## Trial Parameters:
## List of 5
##  $N : num [1:3] 200 340 476 ##$ type1Error: num 0.025
##  $eps : num 0.5 ##$ type2Error: num 0.1
##  $effectSize: num 0.107 ## Boundaries: ## Named num [1:3] -1.88 2.63 2.61 ## - attr(*, "names")= chr [1:3] "btilde" "b" "c" ## Data Generating function: ## function (prevalence = rep(1/6, 6), N, mean = matrix(0, 2, 6), ## sd = matrix(1, 2, 6)) ## { ## if (N == 0) { ## data.frame(subGroup = integer(0), trt = integer(0), score = numeric(0)) ## } ## else { ## subGroup <- sample(seq_along(prevalence), N, replace = TRUE, ## prob = prevalence) ## trt <- sample(c(0L, 1L), N, replace = TRUE) ## rankin <- unlist(Map(function(i, j) rnorm(n = 1, mean = mean[i, ## j], sd = sd[i, j]), trt + 1, subGroup)) ## data.frame(subGroup = subGroup, trt = trt, score = rankin) ## } ## } ## <environment: 0x7fd45ff08748> result <- defuse3$explore(numberOfSimulations = 50, showProgress = FALSE)
analysis <- defuse3$analyze(result) print(defuse3$summary(analysis))
## P(Reject H0_ITT) = 0.000000; P(Reject H0_subgp) = 0.000000; P(Reject H0) = 0.000000
## P(Early stop for efficacy [futility]) = 0.000000 [0.760000]
## Mean [SD] Randomized N = 336.240000 [98.565747]
##
## Stage at exit (proportion)
##
##    1    2    3
## 0.26 0.50 0.24
##
## Mean [SD] Lost N = 112.120000 [71.814568]
## Mean [SD] Analyzed N = 224.120000 [79.321264]
##
## Chance of each subpopulation rejected
## numeric(0)
##
## Counts by futility stage and subgroup choice
##
##      1  2  3  4  5
##   1  8  5  8  2 13
##   2  3  1  3  2  4
##   3  0  0  0  1  0
##
## Mean loss by futility stage and subgroup
##          1     2        3     4        5
## 1 167.2500 134.2 101.1250  62.5 32.15385
## 2 292.6667 223.0 171.3333 113.0 58.75000
## 3       NA    NA       NA 169.0       NA
##
## SD loss by futility stage and subgroup
##          1        2        3         4        5
## 1 5.548488 6.978539 5.139136 0.7071068 7.935639
## 2 4.618802       NA 9.865766 8.4852814 3.685557
## 3       NA       NA       NA        NA       NA
##          1        2        3         4        5
## 1 5.548488 6.978539 5.139136 0.7071068 7.935639
## 2 4.618802       NA 9.865766 8.4852814 3.685557
## 3       NA       NA       NA        NA       NA

## The ALT1 Scenario

result <- defuse3$explore(numberOfSimulations = 50, trueParameters = designParameters$alt1,
showProgress = FALSE)
analysis <- defuse3$analyze(result) print(defuse3$summary(analysis))
## P(Reject H0_ITT) = 0.300000; P(Reject H0_subgp) = 0.580000; P(Reject H0) = 0.880000
## P(Early stop for efficacy [futility]) = 0.540000 [0.040000]
## Mean [SD] Randomized N = 380.320000 [93.101972]
##
## Stage at exit (proportion)
##
##    1    2    3
## 0.12 0.46 0.42
##
## Mean [SD] Lost N = 123.060000 [110.534030]
## Mean [SD] Analyzed N = 257.260000 [111.417181]
##
## Chance of each subpopulation rejected
##
##    1    2    3    4    6
## 0.12 0.12 0.32 0.02 0.30
##
## Counts by futility stage and subgroup choice
##
##      0  1  2  3  4  5
##   0 15  0  0  0  0  0
##   1  0  4  0 10  0  1
##   2  0  0  6  3  1  1
##   3  0  2  1  4  1  1
##
## Mean loss by futility stage and subgroup
##    0     1     2      3   4  5
## 0  0    NA    NA     NA  NA NA
## 1 NA 163.0    NA 101.60  NA 30
## 2 NA    NA 230.5 182.00 113 54
## 3 NA 408.5 322.0 245.25 162 77
##
## SD loss by futility stage and subgroup
##    0         1        2         3  4  5
## 0  0        NA       NA        NA NA NA
## 1 NA 6.9761498       NA  6.785606 NA NA
## 2 NA        NA 7.556454 14.730920 NA NA
## 3 NA 0.7071068       NA  6.994045 NA NA
##    0         1        2         3  4  5
## 0  0        NA       NA        NA NA NA
## 1 NA 6.9761498       NA  6.785606 NA NA
## 2 NA        NA 7.556454 14.730920 NA NA
## 3 NA 0.7071068       NA  6.994045 NA NA

## The ALT2 Scenario

result <- defuse3$explore(numberOfSimulations = 50, trueParameters = designParameters$alt2,
showProgress = FALSE)
analysis <- defuse3$analyze(result) print(defuse3$summary(analysis))
## P(Reject H0_ITT) = 0.180000; P(Reject H0_subgp) = 0.740000; P(Reject H0) = 0.920000
## P(Early stop for efficacy [futility]) = 0.640000 [0.000000]
## Mean [SD] Randomized N = 369.360000 [93.353347]
##
## Stage at exit (proportion)
##
##    1    2    3
## 0.14 0.50 0.36
##
## Mean [SD] Lost N = 158.700000 [100.267448]
## Mean [SD] Analyzed N = 210.660000 [90.674032]
##
## Chance of each subpopulation rejected
##
##    1    2    3    4    6
## 0.08 0.58 0.06 0.02 0.18
##
## Counts by futility stage and subgroup choice
##
##      0  1  2  3  4  5
##   0  9  0  0  0  0  0
##   1  0  2 16  1  0  0
##   2  0  2 10  2  0  1
##   3  0  1  4  1  1  0
##
## Mean loss by futility stage and subgroup
##    0     1     2   3   4  5
## 0  0    NA    NA  NA  NA NA
## 1 NA 168.5 134.5 104  NA NA
## 2 NA 287.5 226.6 181  NA 75
## 3 NA 404.0 316.5 229 165 NA
##
## SD loss by futility stage and subgroup
##    0         1        2        3  4  5
## 0  0        NA       NA       NA NA NA
## 1 NA 0.7071068 7.080490       NA NA NA
## 2 NA 2.1213203 6.363088 4.242641 NA NA
## 3 NA        NA 8.544004       NA NA NA
##    0         1        2        3  4  5
## 0  0        NA       NA       NA NA NA
## 1 NA 0.7071068 7.080490       NA NA NA
## 2 NA 2.1213203 6.363088 4.242641 NA NA
## 3 NA        NA 8.544004       NA NA NA

## The ALT3 Scenario

result <- defuse3$explore(numberOfSimulations = 50, trueParameters = designParameters$alt3,
showProgress = FALSE)
analysis <- defuse3$analyze(result) print(defuse3$summary(analysis))
## P(Reject H0_ITT) = 0.860000; P(Reject H0_subgp) = 0.080000; P(Reject H0) = 0.940000
## P(Early stop for efficacy [futility]) = 0.700000 [0.000000]
## Mean [SD] Randomized N = 330.400000 [112.995575]
##
## Stage at exit (proportion)
##
##    1    2    3
## 0.36 0.34 0.30
##
## Mean [SD] Lost N = 17.200000 [44.723185]
## Mean [SD] Analyzed N = 313.200000 [108.781001]
##
## Chance of each subpopulation rejected
##
##    1    2    3    4    6
## 0.02 0.02 0.02 0.02 0.86
##
## Counts by futility stage and subgroup choice
##
##      0  1  2  3  4  5
##   0 43  0  0  0  0  0
##   1  0  1  1  1  0  0
##   3  0  0  0  0  2  2
##
## Mean loss by futility stage and subgroup
##    0   1   2   3     4    5
## 0  0  NA  NA  NA    NA   NA
## 1 NA 158 129 105    NA   NA
## 3 NA  NA  NA  NA 153.5 80.5
##
## SD loss by futility stage and subgroup
##    0  1  2  3        4         5
## 0  0 NA NA NA       NA        NA
## 1 NA NA NA NA       NA        NA
## 3 NA NA NA NA 9.192388 0.7071068
##    0  1  2  3        4         5
## 0  0 NA NA NA       NA        NA
## 1 NA NA NA NA       NA        NA
## 3 NA NA NA NA 9.192388 0.7071068

## The ALT4 Scenario

result <- defuse3$explore(numberOfSimulations = 50, trueParameters = designParameters$alt4,
showProgress = FALSE)
analysis <- defuse3$analyze(result) print(defuse3$summary(analysis))
## P(Reject H0_ITT) = 0.660000; P(Reject H0_subgp) = 0.100000; P(Reject H0) = 0.760000
## P(Early stop for efficacy [futility]) = 0.540000 [0.020000]
## Mean [SD] Randomized N = 363.440000 [113.770295]
##
## Stage at exit (proportion)
##
##    1    2    3
## 0.26 0.30 0.44
##
## Mean [SD] Lost N = 42.860000 [72.049589]
## Mean [SD] Analyzed N = 320.580000 [98.622159]
##
## Chance of each subpopulation rejected
##
##    1    3    5    6
## 0.02 0.04 0.04 0.66
##
## Counts by futility stage and subgroup choice
##
##      0  1  2  3  4  5
##   0 33  0  0  0  0  0
##   1  0  1  1  1  1  2
##   2  0  0  1  1  0  1
##   3  0  0  0  2  3  3
##
## Mean loss by futility stage and subgroup
##    0   1   2   3   4  5
## 0  0  NA  NA  NA  NA NA
## 1 NA 176 131  87  77 26
## 2 NA  NA 217 175  NA 46
## 3 NA  NA  NA 237 153 83
##
## SD loss by futility stage and subgroup
##    0  1  2        3        4        5
## 0  0 NA NA       NA       NA       NA
## 1 NA NA NA       NA       NA 5.656854
## 2 NA NA NA       NA       NA       NA
## 3 NA NA NA 8.485281 5.291503 1.732051
##    0  1  2        3        4        5
## 0  0 NA NA       NA       NA       NA
## 1 NA NA NA       NA       NA 5.656854
## 2 NA NA NA       NA       NA       NA
## 3 NA NA NA 8.485281 5.291503 1.732051

## The ALT5 Scenario

result <- defuse3$explore(numberOfSimulations = 50, trueParameters = designParameters$alt5,
showProgress = FALSE)
analysis <- defuse3$analyze(result) print(defuse3$summary(analysis))
## P(Reject H0_ITT) = 0.240000; P(Reject H0_subgp) = 0.580000; P(Reject H0) = 0.820000
## P(Early stop for efficacy [futility]) = 0.460000 [0.060000]
## Mean [SD] Randomized N = 399.680000 [78.897878]
##
## Stage at exit (proportion)
##
##    1    2    3
## 0.04 0.48 0.48
##
## Mean [SD] Lost N = 128.660000 [97.466396]
## Mean [SD] Analyzed N = 271.020000 [95.784088]
##
## Chance of each subpopulation rejected
##
##    1    2    3    5    6
## 0.24 0.20 0.12 0.02 0.24
##
## Counts by futility stage and subgroup choice
##
##      0  1  2  3  4  5
##   0 12  0  0  0  0  0
##   1  0  8  7  3  0  2
##   2  0  4  1  4  0  1
##   3  0  0  2  2  2  2
##
## Mean loss by futility stage and subgroup
##    0       1        2         3   4    5
## 0  0      NA       NA        NA  NA   NA
## 1 NA 167.625 132.5714  94.66667  NA 42.0
## 2 NA 284.250 225.0000 175.75000  NA 64.0
## 3 NA      NA 326.5000 247.50000 178 81.5
##
## SD loss by futility stage and subgroup
##    0        1         2         3        4        5
## 0  0       NA        NA        NA       NA       NA
## 1 NA 4.627171 7.4578179  4.725816       NA 7.071068
## 2 NA 6.751543        NA  8.732125       NA       NA
## 3 NA       NA 0.7071068 12.020815 1.414214 2.121320
##    0        1         2         3        4        5
## 0  0       NA        NA        NA       NA       NA
## 1 NA 4.627171 7.4578179  4.725816       NA 7.071068
## 2 NA 6.751543        NA  8.732125       NA       NA
## 3 NA       NA 0.7071068 12.020815 1.414214 2.121320

## The ALT6 Scenario

result <- defuse3$explore(numberOfSimulations = 50, trueParameters = designParameters$alt6,
showProgress = FALSE)
analysis <- defuse3$analyze(result) print(defuse3$summary(analysis))
## P(Reject H0_ITT) = 0.620000; P(Reject H0_subgp) = 0.360000; P(Reject H0) = 0.980000
## P(Early stop for efficacy [futility]) = 0.540000 [0.000000]
## Mean [SD] Randomized N = 366.160000 [114.819354]
##
## Stage at exit (proportion)
##
##    1    2    3
## 0.26 0.28 0.46
##
## Mean [SD] Lost N = 81.300000 [118.578528]
## Mean [SD] Analyzed N = 284.860000 [109.446662]
##
## Chance of each subpopulation rejected
##
##    1    2    3    4    5    6
## 0.08 0.08 0.12 0.06 0.02 0.62
##
## Counts by futility stage and subgroup choice
##
##      0  1  2  3  4  5
##   0 31  0  0  0  0  0
##   1  0  2  0  1  1  1
##   2  0  1  2  0  0  0
##   3  0  1  2  6  2  0
##
## Mean loss by futility stage and subgroup
##    0     1     2   3     4  5
## 0  0    NA    NA  NA    NA NA
## 1 NA 163.5    NA  97  70.0 37
## 2 NA 286.0 231.5  NA    NA NA
## 3 NA 410.0 325.0 234 160.5 NA
##
## SD loss by futility stage and subgroup
##    0        1        2        3       4  5
## 0  0       NA       NA       NA      NA NA
## 1 NA 17.67767       NA       NA      NA NA
## 2 NA       NA 12.02082       NA      NA NA
## 3 NA       NA 14.14214 15.97498 2.12132 NA
##    0        1        2        3       4  5
## 0  0       NA       NA       NA      NA NA
## 1 NA 17.67767       NA       NA      NA NA
## 2 NA       NA 12.02082       NA      NA NA
## 3 NA       NA 14.14214 15.97498 2.12132 NA