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.

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,
                             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.105
## 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: 0x7fb112f7bad8>
result <- defuse3$explore(numberOfSimulations = 5000, showProgress = FALSE)
analysis <- defuse3$analyze(result)
print(defuse3$summary(analysis))
## P(Reject H0_ITT) = 0.011200; P(Reject H0_subgp) = 0.016800; P(Reject H0) = 0.028000
## P(Early stop for efficacy [futility]) = 0.016000 [0.744400]
## Mean [SD] Randomized N = 344.081600 [91.690913]
## 
## Stage at exit (proportion)
## 
##      1      2      3 
## 0.2036 0.5568 0.2396 
## 
## Mean [SD] Lost N = 125.678400 [66.904172]
## Mean [SD] Analyzed N = 218.403200 [82.417665]
## 
## Chance of each subpopulation rejected
## 
##      1      2      3      4      5      6 
## 0.0060 0.0058 0.0026 0.0008 0.0016 0.0112 
## 
## Counts by futility stage and subgroup choice
##    
##        0    1    2    3    4    5
##   0   56    0    0    0    0    0
##   1    0 1322  741  576  506  588
##   2    0  179  158  156  141  268
##   3    0   30   27   52   64  136
## 
## Mean loss by futility stage and subgroup
##    0        1        2        3         4        5
## 0  0       NA       NA       NA        NA       NA
## 1 NA 166.7617 133.4251 100.3038  66.75889 33.09354
## 2 NA 283.1508 226.9810 169.9551 113.48936 56.94776
## 3 NA 398.0000 312.8889 236.4231 159.90625 79.49265
## 
## SD loss by futility stage and subgroup
##    0        1         2        3         4        5
## 0  0       NA        NA       NA        NA       NA
## 1 NA 5.262090  6.976901 7.049370  6.896201 5.289869
## 2 NA 6.810817  8.431418 8.729884  7.711417 7.435432
## 3 NA 6.721043 12.564704 9.933793 10.431513 7.785072
##    0        1         2        3         4        5
## 0  0       NA        NA       NA        NA       NA
## 1 NA 5.262090  6.976901 7.049370  6.896201 5.289869
## 2 NA 6.810817  8.431418 8.729884  7.711417 7.435432
## 3 NA 6.721043 12.564704 9.933793 10.431513 7.785072

The ALT1 Scenario

result <- defuse3$explore(numberOfSimulations = 5000, trueParameters = designParameters$alt1,
                          showProgress = FALSE)
analysis <- defuse3$analyze(result)
print(defuse3$summary(analysis))
## P(Reject H0_ITT) = 0.326800; P(Reject H0_subgp) = 0.571200; P(Reject H0) = 0.898000
## P(Early stop for efficacy [futility]) = 0.462200 [0.014400]
## Mean [SD] Randomized N = 394.578400 [95.017737]
## 
## Stage at exit (proportion)
## 
##      1      2      3 
## 0.1186 0.3580 0.5234 
## 
## Mean [SD] Lost N = 126.942200 [111.547085]
## Mean [SD] Analyzed N = 267.636200 [107.679367]
## 
## Chance of each subpopulation rejected
## 
##      1      2      3      4      5      6 
## 0.1114 0.1684 0.2312 0.0466 0.0136 0.3268 
## 
## Counts by futility stage and subgroup choice
##    
##        0    1    2    3    4    5
##   0 1634    0    0    0    0    0
##   1    0  327  378  383  100   52
##   2    0  138  226  332   86   37
##   3    0  125  299  603  176  104
## 
## Mean loss by futility stage and subgroup
##    0        1        2        3        4        5
## 0  0       NA       NA       NA       NA       NA
## 1 NA 166.9174 134.0952 100.5770  66.6400 32.88462
## 2 NA 282.4855 225.8761 171.1265 113.3140 56.29730
## 3 NA 395.2000 316.3010 238.2803 158.3523 80.25000
## 
## SD loss by futility stage and subgroup
##    0        1         2         3         4        5
## 0  0       NA        NA        NA        NA       NA
## 1 NA 5.202869  6.307036  6.819566  6.456568 4.730601
## 2 NA 8.103559  8.040047  9.374821  7.933935 6.054681
## 3 NA 8.918990 10.318568 11.053903 10.395097 8.365150
##    0        1         2         3         4        5
## 0  0       NA        NA        NA        NA       NA
## 1 NA 5.202869  6.307036  6.819566  6.456568 4.730601
## 2 NA 8.103559  8.040047  9.374821  7.933935 6.054681
## 3 NA 8.918990 10.318568 11.053903 10.395097 8.365150

The ALT2 Scenario

result <- defuse3$explore(numberOfSimulations = 5000, trueParameters = designParameters$alt2,
                          showProgress = FALSE)
analysis <- defuse3$analyze(result)
print(defuse3$summary(analysis))
## P(Reject H0_ITT) = 0.218800; P(Reject H0_subgp) = 0.684000; P(Reject H0) = 0.902800
## P(Early stop for efficacy [futility]) = 0.496600 [0.018200]
## Mean [SD] Randomized N = 392.323200 [90.283621]
## 
## Stage at exit (proportion)
## 
##      1      2      3 
## 0.0976 0.4172 0.4852 
## 
## Mean [SD] Lost N = 161.566800 [113.976931]
## Mean [SD] Analyzed N = 230.756400 [103.036576]
## 
## Chance of each subpopulation rejected
## 
##      1      2      3      4      5      6 
## 0.1166 0.4622 0.0776 0.0208 0.0068 0.2188 
## 
## Counts by futility stage and subgroup choice
##    
##        0    1    2    3    4    5
##   0 1094    0    0    0    0    0
##   1    0  362  895  192   81   41
##   2    0  151  687  135   64   40
##   3    0   97  872  163   73   53
## 
## Mean loss by futility stage and subgroup
##    0        1        2        3         4       5
## 0  0       NA       NA       NA        NA      NA
## 1 NA 167.3978 134.1352 101.1562  68.95062 33.7561
## 2 NA 283.9603 227.0247 170.7111 115.95312 57.3750
## 3 NA 394.6907 316.6594 238.8589 159.65753 79.0000
## 
## SD loss by futility stage and subgroup
##    0        1         2         3         4        5
## 0  0       NA        NA        NA        NA       NA
## 1 NA 5.551751  6.827914  6.696609  6.268774 5.651462
## 2 NA 6.937705  8.463830  8.232504  8.169688 7.827262
## 3 NA 7.620369 10.098018 11.201784 11.476085 8.678000
##    0        1         2         3         4        5
## 0  0       NA        NA        NA        NA       NA
## 1 NA 5.551751  6.827914  6.696609  6.268774 5.651462
## 2 NA 6.937705  8.463830  8.232504  8.169688 7.827262
## 3 NA 7.620369 10.098018 11.201784 11.476085 8.678000

The ALT3 Scenario

result <- defuse3$explore(numberOfSimulations = 5000, trueParameters = designParameters$alt3,
                          showProgress = FALSE)
analysis <- defuse3$analyze(result)
print(defuse3$summary(analysis))
## P(Reject H0_ITT) = 0.873600; P(Reject H0_subgp) = 0.055600; P(Reject H0) = 0.929200
## P(Early stop for efficacy [futility]) = 0.751400 [0.015200]
## Mean [SD] Randomized N = 310.758400 [109.553894]
## 
## Stage at exit (proportion)
## 
##      1      2      3 
## 0.4356 0.3310 0.2334 
## 
## Mean [SD] Lost N = 16.931800 [53.698993]
## Mean [SD] Analyzed N = 293.826600 [101.694573]
## 
## Chance of each subpopulation rejected
## 
##      1      2      3      4      5      6 
## 0.0142 0.0108 0.0098 0.0102 0.0106 0.8736 
## 
## Counts by futility stage and subgroup choice
##    
##        0    1    2    3    4    5
##   0 4368    0    0    0    0    0
##   1    0   54   41   24   27   55
##   2    0   14   16   17   23   39
##   3    0   18   23   39   76  166
## 
## Mean loss by futility stage and subgroup
##    0        1        2        3         4        5
## 0  0       NA       NA       NA        NA       NA
## 1 NA 166.8889 131.5610 101.2500  65.48148 33.94545
## 2 NA 284.5714 228.5625 166.5294 114.08696 57.84615
## 3 NA 398.2222 319.0435 238.2051 155.55263 79.62651
## 
## SD loss by futility stage and subgroup
##    0        1         2        3         4        5
## 0  0       NA        NA       NA        NA       NA
## 1 NA 5.903842  5.835447 6.144987  6.874537 5.085995
## 2 NA 7.397653  7.991402 9.868622 10.334906 7.364704
## 3 NA 7.108864 10.407507 9.509495  9.082430 8.368354
##    0        1         2        3         4        5
## 0  0       NA        NA       NA        NA       NA
## 1 NA 5.903842  5.835447 6.144987  6.874537 5.085995
## 2 NA 7.397653  7.991402 9.868622 10.334906 7.364704
## 3 NA 7.108864 10.407507 9.509495  9.082430 8.368354

The ALT4 Scenario

result <- defuse3$explore(numberOfSimulations = 5000, trueParameters = designParameters$alt4,
                          showProgress = FALSE)
analysis <- defuse3$analyze(result)
print(defuse3$summary(analysis))
## P(Reject H0_ITT) = 0.726600; P(Reject H0_subgp) = 0.099600; P(Reject H0) = 0.826200
## P(Early stop for efficacy [futility]) = 0.579000 [0.037400]
## Mean [SD] Randomized N = 350.981600 [112.886397]
## 
## Stage at exit (proportion)
## 
##      1      2      3 
## 0.2942 0.3222 0.3836 
## 
## Mean [SD] Lost N = 37.431800 [75.444388]
## Mean [SD] Analyzed N = 313.549800 [105.160805]
## 
## Chance of each subpopulation rejected
## 
##      1      2      3      4      5      6 
## 0.0266 0.0208 0.0166 0.0192 0.0164 0.7266 
## 
## Counts by futility stage and subgroup choice
##    
##        0    1    2    3    4    5
##   0 3633    0    0    0    0    0
##   1    0  123   83   64   55   93
##   2    0   46   35   37   66  103
##   3    0   37   55   90  135  345
## 
## Mean loss by futility stage and subgroup
##    0        1        2        3         4        5
## 0  0       NA       NA       NA        NA       NA
## 1 NA 166.0325 132.9880 100.8281  68.07273 34.13978
## 2 NA 282.5000 222.9429 169.7568 114.21212 55.74757
## 3 NA 394.0811 314.9818 237.9889 158.33333 79.04058
## 
## SD loss by futility stage and subgroup
##    0        1         2         3         4        5
## 0  0       NA        NA        NA        NA       NA
## 1 NA 5.636437  6.511704  7.358301  6.491746 5.418550
## 2 NA 7.070282  9.486656  8.118584  8.681572 6.609142
## 3 NA 9.373065 10.012013 11.970464 10.154772 7.771712
##    0        1         2         3         4        5
## 0  0       NA        NA        NA        NA       NA
## 1 NA 5.636437  6.511704  7.358301  6.491746 5.418550
## 2 NA 7.070282  9.486656  8.118584  8.681572 6.609142
## 3 NA 9.373065 10.012013 11.970464 10.154772 7.771712

The ALT5 Scenario

result <- defuse3$explore(numberOfSimulations = 5000, trueParameters = designParameters$alt5,
                          showProgress = FALSE)
analysis <- defuse3$analyze(result)
print(defuse3$summary(analysis))
## P(Reject H0_ITT) = 0.173000; P(Reject H0_subgp) = 0.590600; P(Reject H0) = 0.763600
## P(Early stop for efficacy [futility]) = 0.361000 [0.053400]
## Mean [SD] Randomized N = 408.693600 [87.445390]
## 
## Stage at exit (proportion)
## 
##      1      2      3 
## 0.0782 0.3362 0.5856 
## 
## Mean [SD] Lost N = 149.156000 [102.877708]
## Mean [SD] Analyzed N = 259.537600 [101.979950]
## 
## Chance of each subpopulation rejected
## 
##      1      2      3      4      5      6 
## 0.1742 0.1888 0.1782 0.0388 0.0106 0.1730 
## 
## Counts by futility stage and subgroup choice
##    
##       0   1   2   3   4   5
##   0 865   0   0   0   0   0
##   1   0 569 523 440 156  99
##   2   0 242 299 379 131  89
##   3   0 157 319 424 173 135
## 
## Mean loss by futility stage and subgroup
##    0        1        2         3         4        5
## 0  0       NA       NA        NA        NA       NA
## 1 NA 167.4130 133.5143  99.96591  68.40385 33.35354
## 2 NA 282.8926 226.3411 169.71504 114.23664 57.83146
## 3 NA 395.5478 317.6238 236.84670 158.54335 80.68148
## 
## SD loss by futility stage and subgroup
##    0        1         2         3         4        5
## 0  0       NA        NA        NA        NA       NA
## 1 NA 5.254767  6.505913  6.953226  6.657306 5.198730
## 2 NA 6.969765  8.627100  8.957753  9.170045 6.465355
## 3 NA 7.965829 10.427778 11.075396 10.630946 8.073036
##    0        1         2         3         4        5
## 0  0       NA        NA        NA        NA       NA
## 1 NA 5.254767  6.505913  6.953226  6.657306 5.198730
## 2 NA 6.969765  8.627100  8.957753  9.170045 6.465355
## 3 NA 7.965829 10.427778 11.075396 10.630946 8.073036

The ALT6 Scenario

result <- defuse3$explore(numberOfSimulations = 5000, trueParameters = designParameters$alt6,
                          showProgress = FALSE)
analysis <- defuse3$analyze(result)
print(defuse3$summary(analysis))
## P(Reject H0_ITT) = 0.702400; P(Reject H0_subgp) = 0.239600; P(Reject H0) = 0.942000
## P(Early stop for efficacy [futility]) = 0.601800 [0.007800]
## Mean [SD] Randomized N = 354.594400 [111.356733]
## 
## Stage at exit (proportion)
## 
##      1      2      3 
## 0.2750 0.3346 0.3904 
## 
## Mean [SD] Lost N = 53.768600 [95.862006]
## Mean [SD] Analyzed N = 300.825800 [108.616694]
## 
## Chance of each subpopulation rejected
## 
##      1      2      3      4      5      6 
## 0.0352 0.0804 0.0486 0.0600 0.0154 0.7024 
## 
## Counts by futility stage and subgroup choice
##    
##        0    1    2    3    4    5
##   0 3512    0    0    0    0    0
##   1    0   95  142   82   83   48
##   2    0   50  112   56   79   24
##   3    0   41  196  150  226  104
## 
## Mean loss by futility stage and subgroup
##    0        1        2        3         4        5
## 0  0       NA       NA       NA        NA       NA
## 1 NA 166.4947 133.1127 100.7195  68.25301 34.02083
## 2 NA 282.6400 227.0893 172.1964 115.29114 56.91667
## 3 NA 397.2195 318.2449 238.7333 159.87168 79.62500
## 
## SD loss by futility stage and subgroup
##    0         1         2         3        4        5
## 0  0        NA        NA        NA       NA       NA
## 1 NA  5.779409  5.815239  6.896545 7.701510 4.896762
## 2 NA  6.799640  7.902051  9.891079 7.644592 6.198995
## 3 NA 10.150153 10.694414 10.252953 9.637261 7.837163
##    0         1         2         3        4        5
## 0  0        NA        NA        NA       NA       NA
## 1 NA  5.779409  5.815239  6.896545 7.701510 4.896762
## 2 NA  6.799640  7.902051  9.891079 7.644592 6.198995
## 3 NA 10.150153 10.694414 10.252953 9.637261 7.837163