bma_design {bmabasket}  R Documentation 
Simulate a BMA design
Description
Simulates a BMA design given hyperparameters
Usage
bma_design(
nSims,
nBaskets,
maxDistinct = nBaskets,
eRates,
rRates,
meanTime,
sdTime,
ppEffCrit,
ppFutCrit,
futOnly = FALSE,
rRatesNull,
rRatesAlt,
minSSFut,
minSSEff,
minSSEnr,
maxSSEnr,
targSSPer,
I0,
mu0 = 0.5,
phi0 = 1,
priorModelProbs = NULL,
pmp0 = 1
)
Arguments
nSims 
number of simulation studies to be performed 
nBaskets 
number of baskets 
maxDistinct 
integer between 1 and 
eRates 
scalar or vector of Poisson process rates for each basket 
rRates 
scalar or vector of true response rates for each basket 
meanTime 
mean parameter for time to outcome ascertainment 
sdTime 
standard deviation parameter for time to outcome ascertainment 
ppEffCrit 
scalar or vector giving basketspecific posterior probability threshold for activity (i.e., efficacy). 
ppFutCrit 
scalar or vector giving basketspecific posterior probability threshold for futility 
futOnly 

rRatesNull 
scalar or vector of basketspecific null hypothesis values (for efficacy determination) 
rRatesAlt 
scalar or vector of basketspecific hypothesized alternative values (for futility determination) 
minSSFut 
minimum number of subjects in basket to assess futility 
minSSEff 
minimum number of subjects in basket to assess activity 
minSSEnr 
matrix giving minimum number of new subjects per basket before next analysis (each row is an interim analysis, each column is a basket) 
maxSSEnr 
matrix giving maximum number of new subjects per basket before next analysis (each row is an interim analysis, each column is a basket) 
targSSPer 
scalar or vector giving target sample size increment for each basket 
I0 
maximum number of analyses 
mu0 
prior mean for the response probabilities 
phi0 
prior dispersion response probabilities 
priorModelProbs 
vector giving prior probabilities for models. Default is prior of each model is proportional 
pmp0 
scalar giving power for 
Value
a nested list giving results of the simulation with the following structure:

hypothesis.testing  hypothesis testing information

rr  basketspecific null hypothesis rejection rate

fw.fpr  familywise false positive rate (across all inactive baskets)

nerr  average number of false null hypothesis rejections

fut  basketspecific probability of futility stopping


sample.size  trial sample size information

basket.ave  basketspecific expected sample size

basket.med  basketspecific median sample size

basket.min  basketspecific minimum sample size

basket.max  basketspecific maximum sample size

overall.ave  expected overall sample size


point.estimation  point estimation information

PM.ave  basketspecific average posterior mean

SP.ave  basketspecific average sample proportion

PP.ave  basketspecific average posterior probability

bias  basketspecific bias of the posterior mean

mse  basketspecific MSE of the posterior mean


early.stopping  early stopping information

interim.stop.prob  probability of trial stoppage by interim

baskets.continuing.ave  average number of baskets continuing past interim

Examples
## SIMULATE DATA AND SET SIMULATION PARAMS
nSims < 100 ## would be much more in practice
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
)