MyNixOS website logo
Description

Bayesian Model Averaging for Basket Trials.

An implementation of the Bayesian model averaging method of Psioda and others (2019) <doi:10.1093/biostatistics/kxz014> for basket trials. Contains a user-friendly wrapper for simulating basket trials under conditions and analyzing them with a Bayesian model averaging approach.

bmabasket

R-CMD-check

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.

Installation

You can install the released version of bmabasket from CRAN with:

install.packages("bmabasket")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("ethan-alt/bmabasket")

Example

This is a basic example which shows you how to solve a common problem:

library(bmabasket)
## REPEAT SIMS FROM BIOSTATISTICS JOURNAL PUBLICATION
nSims      <- 100             ## change to ~250000 to repeat journal results                   
meanTime   <- 0.01
sdTime     <- 0.0000000001
mu0        <- 0.45
phi0       <- 1.00
ppEffCrit  <- 0.985
ppFutCrit  <- 0.2750
pmp0       <- 2
n1         <- 7
n2         <- 16
targSSPer  <- c(n1, n2)
nInterim   <- 2
futOnly    <- 1
K0         <- 5
row        <- 0
mss        <- 4
minSSFut   <- mss  ## minimum number of subjects in basket to assess futility using BMA
minSSEff   <- mss  ## minimum number of subjects in basket to assess activity using BMA
rTarg      <- 0.45
rNull      <- 0.15
rRatesMod  <- matrix(rNull,(K0+1)+3,K0)
rRatesNull <- rep(rNull,K0)
rRatesMid  <- rep(rTarg,K0)
eRatesMod  <- rep(1, K0)

## min and max #' of new subjects per basket before next analysis (each row is interim)
minSSEnr <- matrix(rep(mss, K0), nrow=nInterim ,ncol=K0, byrow=TRUE) 
maxSSEnr <- matrix(rep(100, K0), nrow=nInterim, ncol=K0, byrow=TRUE) 

## construct matrix of rates
for (i in 1:K0)  
{
  rRatesMod[(i+1):(K0+1),i]= rTarg     
}
rRatesMod[(K0+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)

## conduct simulation of trial data and analysis
x <- bma_design(
  nSims, K0, K0, eRatesMod, rRatesMod[i+1,], meanTime, sdTime, 
  ppEffCrit, ppFutCrit, as.logical(futOnly), rRatesNull, rRatesMid, 
  minSSFut, minSSEff, minSSEnr, maxSSEnr, targSSPer, nInterim, mu0, 
  phi0, priorModelProbs = NULL, pmp0 = pmp0
)
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
Metadata

Version

0.1.2

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows