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 nBaskets giving number of distinct model probabilities to use. Defaults to nBaskets. It is recommended to call numModels to ensure that computation is tractable.

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 basket-specific posterior probability threshold for activity (i.e., efficacy).

ppFutCrit

scalar or vector giving basket-specific posterior probability threshold for futility

futOnly

logical giving whether design allows only for futility stopping (TRUE = futility only, FALSE = both futility and efficacy)

rRatesNull

scalar or vector of basket-specific null hypothesis values (for efficacy determination)

rRatesAlt

scalar or vector of basket-specific 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 exp(pmp0 * D) where D is the number of distinct parameters in the model

pmp0

scalar giving power for priorModelProbs. If pmp0==0, a uniform prior is used for model probabilities. Defaults to 1. Ignored if priorModelProbs is not NULL

Value

a nested list giving results of the simulation with the following structure:

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
)

[Package bmabasket version 0.1.2 Index]