The goal of bmabasket is to simulate basket trial data based on hyperparameters and analyze things such as the family-wise error rate, bias, and MSE. The package uses Bayesian model average (BMA) to compute the posterior probability that response within a basket exceeds some threshold.
You can install the released version of bmabasket from CRAN with:
install.packages("bmabasket")
And the development version from GitHub with:
# install.packages("devtools")
::install_github("ethan-alt/bmabasket") devtools
This is a basic example which shows you how to solve a common problem:
library(bmabasket)
## REPEAT SIMS FROM BIOSTATISTICS JOURNAL PUBLICATION
<- 100 ## change to ~250000 to repeat journal results
nSims <- 0.01
meanTime <- 0.0000000001
sdTime <- 0.45
mu0 <- 1.00
phi0 <- 0.985
ppEffCrit <- 0.2750
ppFutCrit <- 2
pmp0 <- 7
n1 <- 16
n2 <- c(n1, n2)
targSSPer <- 2
nInterim <- 1
futOnly <- 5
K0 <- 0
row <- 4
mss <- mss ## minimum number of subjects in basket to assess futility using BMA
minSSFut <- mss ## minimum number of subjects in basket to assess activity using BMA
minSSEff <- 0.45
rTarg <- 0.15
rNull <- matrix(rNull,(K0+1)+3,K0)
rRatesMod <- rep(rNull,K0)
rRatesNull <- rep(rTarg,K0)
rRatesMid <- rep(1, K0)
eRatesMod
## min and max #' of new subjects per basket before next analysis (each row is interim)
<- matrix(rep(mss, K0), nrow=nInterim ,ncol=K0, byrow=TRUE)
minSSEnr <- matrix(rep(100, K0), nrow=nInterim, ncol=K0, byrow=TRUE)
maxSSEnr
## construct matrix of rates
for (i in 1:K0)
{+1):(K0+1),i]= rTarg
rRatesMod[(i
}+2),] <- c(0.05,0.15,0.25,0.35,0.45)
rRatesMod[(K0+3),] <- c(0.15,0.30,0.30,0.30,0.45)
rRatesMod[(K0+4),] <- c(0.15,0.15,0.30,0.30,0.30)
rRatesMod[(K0
## conduct simulation of trial data and analysis
<- bma_design(
x +1,], meanTime, sdTime,
nSims, K0, K0, eRatesMod, rRatesMod[ias.logical(futOnly), rRatesNull, rRatesMid,
ppEffCrit, ppFutCrit,
minSSFut, minSSEff, minSSEnr, maxSSEnr, targSSPer, nInterim, mu0, priorModelProbs = NULL, pmp0 = pmp0
phi0,
)
x#> $hypothesis.testing
#> $hypothesis.testing$rr
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 0.92 0.85 0.86 0.87 0.84
#>
#> $hypothesis.testing$fw.fpr
#> [1] 0
#>
#> $hypothesis.testing$nerr
#> [1] 0
#>
#> $hypothesis.testing$fut
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 0.05 0.11 0.07 0.09 0.07
#>
#>
#> $sample.size
#> $sample.size$basket.ave
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 22.66 21.25 21.65 21.61 20.93
#>
#> $sample.size$basket.med
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 23 23 22 23 22
#>
#> $sample.size$basket.min
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 4 4 4 4 4
#>
#> $sample.size$basket.max
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 35 34 36 32 34
#>
#> $sample.size$overall.ave
#> [,1]
#> [1,] 108.1
#>
#>
#> $point.estimation
#> $point.estimation$PM.ave
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 0.4424834 0.4289148 0.4317818 0.4387614 0.4250887
#>
#> $point.estimation$SP.ave
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 0.4391716 0.4222146 0.4279804 0.435188 0.4190648
#>
#> $point.estimation$PP.ave
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 0.9711071 0.9174152 0.9445281 0.94365 0.9445365
#>
#> $point.estimation$bias
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] -0.007516613 -0.02108521 -0.01821818 -0.01123862 -0.02491135
#>
#> $point.estimation$mse
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 0.009406759 0.02019997 0.01433251 0.01463391 0.01342345
#>
#>
#> $trial.duration
#> $trial.duration$average
#> [1] 61.73358
#>
#>
#> $early.stopping
#> $early.stopping$interim.stop.prob
#> [,1] [,2]
#> [1,] 0.03 0.97
#>
#> $early.stopping$baskets.continuing.ave
#> [,1] [,2]
#> [1,] 4.47 0.27