Package 'Phase12Compare'

Title: Simulates SPSO and Efftox Phase 12 Trials with Correlated Outcomes
Description: Simulating and conducting four phase 12 clinical trials with correlated binary bivariate outcomes described. Uses the 'Efftox' (efficacy and toxicity tradeoff, <https://biostatistics.mdanderson.org/SoftwareDownload/SingleSoftware/Index/2>) and SPSO (Semi-Parametric Stochastic Ordering) models with Utility and Desirability based objective functions for dose finding.
Authors: Andrew G Chapple
Maintainer: Andrew G Chapple <[email protected]>
License: GPL-2
Version: 1.5
Built: 2024-10-31 21:17:31 UTC
Source: CRAN

Help Index


Determines the optimal dose to assign the next patient cohort.

Description

This function returns the optimal acceptable dose number to assign the next patient cohort or stops the trial if no dose is deemed acceptable.

Usage

AssignEffTox(
  YE,
  YT,
  Doses,
  Dose,
  DosesTried,
  Hypermeans,
  Hypervars,
  Contour,
  PiLim,
  ProbLim,
  B
)

Arguments

YE

Vector containing observed efficacy indicators.

YT

Vector containing observed toxicity indicators.

Doses

Vector containing numbered Doses of patients in trial.

Dose

Vector containing the standardized doses considered.

DosesTried

Binary vector corresponding to which doses have been tried.

Hypermeans

Vector containing prior hypermeans of length 6 for Eff-Tox parameters.

Hypervars

Vector containing prior hypervariances of length 6 for Eff-Tox parameters.

Contour

Vector containing 4 entries used to make the desireability function. Contour[1] contains a desired toxicity probability given efficacy, Countour[2] contains a desired efficacy probability given toxicity, and (Contour[3],Contour[4]) is an equally desireable pair of efficacy and toxicity probabilities that are non-zero or one.

PiLim

Vector of length two with PiLim[1] containing the acceptable lower limit on efficacy probability and PiLim[2] containing the acceptable upper limit on toxicity probability.

ProbLim

Vector of length two with ProbLim[1] containing the probability cutoff for acceptable efficacy probability and ProbLim[2] containing the probability cutoff for acceptable toxicity probability.

B

Number of iterations to perform in the MCMC.

Value

The optimal dose level to administer the next patient cohort.

Examples

##Doses, YE,YT
Doses= c(1,1,1,2,2,2,1,1,1,3,3,3,1,1,1,2,2,2)
YE = c(0,0,1,1,1,0,0,0,0,1,1,1,0,0,1,1,1,0)
YT=c(0,0,0,1,1,0,1,0,0,1,1,1,0,0,0,1,0,0)
##Vector of Numerical Doses
Dose = c(1,2,3,3.5,5)
Dose=(Dose-mean(Dose))/sd(Dose)
##Five doses, but only 3 tried so we have
DosesTried=c(1,1,1,0,0)
## Contour Vector
Contour = c(.35, .75,.7,.4)
##Hypermeans
Hypermeans = c(.022,3.45,0,-4.23,3.1,0)
Hypervars = c(2.6761, 2.6852, .2, 3.1304, 3.1165, 1)
Hypervars=Hypervars^2
##Acceptability Criteria
PiLim = c(.3,.4)
ProbLim=c(.1,.1)
##Number of iterations
B=2000
AssignEffTox(YE,YT, Doses, Dose, DosesTried, Hypermeans,  Hypervars, Contour, PiLim,  ProbLim, B )

Determines the optimal dose to assign the next patient cohort.

Description

This function returns the optimal acceptable dose number to assign the next patient cohort or stops the trial if no dose is deemed acceptable.

Usage

AssignEffToxUT(
  YE,
  YT,
  Doses,
  Dose,
  DosesTried,
  Hypermeans,
  Hypervars,
  UT,
  PiLim,
  ProbLim,
  B
)

Arguments

YE

Vector containing observed efficacy indicators.

YT

Vector containing observed toxicity indicators.

Doses

Vector containing numbered Doses of patients in trial.

Dose

Vector containing the standardized doses considered.

DosesTried

Binary vector corresponding to which doses have been tried.

Hypermeans

Vector containing prior hypermeans of length 6 for Eff-Tox parameters.

Hypervars

Vector containing prior hypervariances of length 6 for Eff-Tox parameters.

UT

2x2 utility matrix.

PiLim

Vector of length two with PiLim[1] containing the acceptable lower limit on efficacy probability and PiLim[2] containing the acceptable upper limit on toxicity probability.

ProbLim

Vector of length two with ProbLim[1] containing the probability cutoff for acceptable efficacy probability and ProbLim[2] containing the probability cutoff for acceptable toxicity probability.

B

Number of iterations to perform in the MCMC.

Value

The optimal dose level to administer the next patient cohort.


Generate binary bivariate data.

Description

Generates binary bivariate data from a 2x2 matrix of probabilities.

Usage

GETBIN(PVEC)

Arguments

PVEC

Contains TRUE pi00,pi10, pi01, pi11 for each dose

Value

Binary bivariate random variate (YE,YT).


Returns the desireability value of a dose.

Description

Takes estimated posterior mean efficacy and toxicity values and returns the posterior mean desireability score for a given tradeoff contour.

Usage

GetDesire(PE, PT, Contour)

Arguments

PE

True or estimated probability of efficacy.

PT

True of estimated probability of toxicity.

Contour

Vector containing 4 entries used to make the desireability function. Contour(1) contains a desired toxicity probability given efficacy, Countour(2) contains a desired efficacy probability given toxicity, and (Contour(3),Contour(4)) is an equally desireable pair of efficacy and toxicity probabilities that are non zero or one.

Value

Computes the real-valued desireability for an estimated (PE, PT) pair and elicited co

Examples

PE=.6
PT=.2
##Contour values
Contour=c(.35,.7,.8,.6)
GetDesire(PE,PT,Contour)

Assigns next patient cohort based on the Efftox model with a Desirability based objective function.

Description

Provides the optimal dose level as determined by the Efftox model, posterior mean toxicity probability, efficacy probability, and desirability of each dose level. Doses that are unacceptably toxic or inefficous have a desirability of 0.

Usage

GetEfftoxContour(
  YE,
  YT,
  Doses,
  Dose,
  Dosetried,
  cohort,
  Contour,
  CutE,
  CutT,
  AcceptE,
  AcceptT,
  HypermeansEFF,
  HypervarsEFF,
  B
)

Arguments

YE

Length n binary indicator vector of efficacy status.

YT

Length n binary indicator vector of toxicity status.

Doses

Length n vector of integer Doses given to patients.

Dose

Vector of standardized log-dose levels considered in the trial.

Dosetried

Binary vector corresponding to which doses have been tried.

cohort

Cohort size for the trial.

Contour

Contour vector for desirability function. Contains in order: (pi_1,E,pi_2,T,pi_3,E,pi_4,T).

CutE

Cutoff for efficacy probability acceptability. Dose-efficacy probabilities must be larger than this for patient assignment.

CutT

Cutoff for toxicity probability acceptability. Dose-toxicity probabilities must be smaller than this for patient assignment.

AcceptE

Posterior probability threshold for efficacy acceptability.

AcceptT

Posterior probability threshold for toxicity acceptability.

HypermeansEFF

Hypermeans for the Efftox model. In order, entries are hypermeans for (beta_0,E,beta_1,E,beta_2,E,beta_0,T,beta_1,T,psi).

HypervarsEFF

Hypervariances for the Efftox model. In order, entries are hypervariances for (beta_0,E,beta_1,E,beta_2,E,beta_0,T,beta_1,T,psi).

B

Number of iterations to run for the MCMC.

Value

A list containing the optimal dose level to assign the next patient cohort in the first entry and a matrix in the second entry, with rows corresponding to (1) the dose #, (2) mean posterior toxicity probability at each dose, mean posterior efficacy probability at each dose, and acceptable posterior desirability score of each dose level (0s indicate the dose is not acceptably efficous or toxic).

Examples

##Get the Data
##True Tox Prob
PT = c(.1,.2,.25,.5,.7)
##True EFF Prob
PE = c(.3,.4,.7,.5,.5)
Doses=c(1,1,1,2,2,2,3,3,3,2,2,2,1,1,1,2,2,2,3,3,3)
YE=Doses
YT=Doses
Dosetried=rep(0,length(PE))
##Generate data
for(k in 1:length(PE)){
if(sum(Doses==k)){
##Dose level has been tried
Dosetried[k]=1
YE[Doses==k]=rbinom(sum(Doses==k),1,PE[k])
YT[Doses==k]=rbinom(sum(Doses==k),1,PT[k])
}
}
##Hypermeans and hypervariances
HypermeansEFF = c(.022,3.45,0,-4.23,3.1,0)
HypervarsEFF = c(2.6761, 2.6852, .2, 3.1304, 3.1165, 1)
HypervarsEFF=HypervarsEFF^2
##Vector of Numerical Doses
Dose = c(1,2,3,3.5,5)
##Dose for Eff-Tox
Dose=log(Dose)-mean(log(Dose))
##Trial parameters
cohort=3
##Contour vector
Contour = c(.35, .75,.7,.4)
CutE=.3 ##Efficacy threshold
CutT=.4 ##Toxicity threshold
AcceptE=.3 ##Eff acceptability threshold
AcceptT= .3 ##Tox acceptability threshold
B=100##Number of iterations
GetEfftoxContour(YE, YT,Doses,Dose, Dosetried,
cohort, Contour,CutE, CutT, AcceptE, AcceptT,
HypermeansEFF, HypervarsEFF,B )

Assigns next patient cohort based on the Efftox model with a Utility based objective function.

Description

Provides the optimal dose level as determined by the Efftox model, posterior mean toxicity probability, efficacy probability, and mean utility of each dose level. Doses that are unacceptably toxic or inefficous have a utility of 0.

Usage

GetEfftoxUt(
  YE,
  YT,
  Doses,
  Dose,
  Dosetried,
  cohort,
  UT,
  CutE,
  CutT,
  AcceptE,
  AcceptT,
  HypermeansEFF,
  HypervarsEFF,
  B
)

Arguments

YE

Length n binary indicator vector of efficacy status.

YT

Length n binary indicator vector of toxicity status.

Doses

Length n vector of integer Doses given to patients.

Dose

Vector of standardized log-dose levels considered in the trial.

Dosetried

Binary vector corresponding to which doses have been tried.

cohort

Cohort size for the trial.

UT

Utility matrix for the four bivariate (efficacy, toxicity) events.

CutE

Cutoff for efficacy probability acceptability. Dose-efficacy probabilities must be larger than this for patient assignment.

CutT

Cutoff for toxicity probability acceptability. Dose-toxicity probabilities must be smaller than this for patient assignment.

AcceptE

Posterior probability threshold for efficacy acceptability.

AcceptT

Posterior probability threshold for toxicity acceptability.

HypermeansEFF

Hypermeans for the Efftox model. In order, entries are hypermeans for (beta_0,E,beta_1,E,beta_2,E,beta_0,T,beta_1,T,psi).

HypervarsEFF

Hypervariances for the Efftox model. In order, entries are hypervariances for (beta_0,E,beta_1,E,beta_2,E,beta_0,T,beta_1,T,psi).

B

Number of iterations to run for the MCMC.

Value

A list containing the optimal dose level to assign the next patient cohort in the first entry and a matrix in the second entry, with rows corresponding to (1) the dose #, (2) mean posterior toxicity probability at each dose, mean posterior efficacy probability at each dose, and acceptable posterior utility score of each dose level (0s indicate the dose is not acceptably efficous or toxic).

Examples

##Get the Data
##True Tox Prob
PT = c(.1,.2,.25,.5,.7)
##True EFF Prob
PE = c(.3,.4,.7,.5,.5)
Doses=c(1,1,1,2,2,2,3,3,3,2,2,2,1,1,1,2,2,2,3,3,3)
YE=Doses
YT=Doses
Dosetried=rep(0,length(PE))
##Generate data
for(k in 1:length(PE)){
if(sum(Doses==k)){
##Dose level has been tried
Dosetried[k]=1
YE[Doses==k]=rbinom(sum(Doses==k),1,PE[k])
YT[Doses==k]=rbinom(sum(Doses==k),1,PT[k])
}
}
##Hypermeans and hypervariances
HypermeansEFF = c(.022,3.45,0,-4.23,3.1,0)
HypervarsEFF = c(2.6761, 2.6852, .2, 3.1304, 3.1165, 1)
HypervarsEFF=HypervarsEFF^2
##Vector of Numerical Doses
Dose = c(1,2,3,3.5,5)
##Dose for Eff-Tox
Dose=log(Dose)-mean(log(Dose))
##Trial parameters
cohort=3
##Utility Matrix
UT = matrix(c(38.23529,100,0,61.76471),nrow=2,byrow=TRUE)
CutE=.3 ##Efficacy threshold
CutT=.4 ##Toxicity threshold
AcceptE=.3 ##Eff acceptability threshold
AcceptT= .3 ##Tox acceptability threshold
B=100##Number of iterations
GetEfftoxUt(YE, YT,Doses,Dose, Dosetried,
cohort, UT,CutE, CutT, AcceptE, AcceptT,
HypermeansEFF, HypervarsEFF,B )

Returns prior dose-specific means and prior ESS for the SPSO model.

Description

Uses elicited efficacy and toxicity dose-specific parameters along withlatent prior variance, dose-specific mean hypervariance, frailty variance, and global probability of monotonicity to determine dose-specific prior means for efficacy and toxicityand prints the prior effective sample size associated with the specified prior parameters.

Usage

GetPriorsSPSO(PROBST, PROBSE, tau, Var, HypVar, PGLOBAL)

Arguments

PROBST

Elicited prior toxicity probability at each dose.

PROBSE

Elicted prior efficacy probability at each dose.

tau

Frailty variance parameter.

Var

Latent parameter variance for normal probability of efficacy and toxicity.

HypVar

Hypervariance on dose specific mean efficacy and toxicity parameters.

PGLOBAL

Global monotonicity probability of dose-efficacy curve.

Value

A list contianing (1) the prior effective sample size, (2) the vector of dose-specific efficacy probability prior mean parameters and, (3) the vector of dose-specific toxicity probability prior mean parameters.

Examples

library(mvtnorm)
##Elicited probabilities of toxicity
PROBST=c(.05,.10,.15,.20,.30)
##Elicited probabilities of efficacy
PROBSE=c(.2,.4,.6,.65,.7)
##Sigma_0
Var=1
##Sigma_mu
HypVar=16
##Frailty Variance
tau=1
##Global Monotonicity Probability
PGLOBAL=.1
Z=GetPriorsSPSO(PROBST,PROBSE,tau,Var,HypVar,PGLOBAL)
Z

Assigns next patient cohort based on the SPSOP model with a Utility based objective function.

Description

Provides the optimal dose level as determined by the SPSO model, posterior mean toxicity probability, efficacy probability, and desirability of each dose level. Doses that are unacceptably toxic or inefficous have a desirability of 0.

Usage

GetSpsoContour(
  YE,
  YT,
  Doses,
  Dosetried,
  cohort,
  Contour,
  CutE,
  CutT,
  AcceptE,
  AcceptT,
  HypermeansE,
  HypermeansT,
  Hypervars,
  B
)

Arguments

YE

Length n binary indicator vector of efficacy status.

YT

Length n binary indicator vector of toxicity status.

Doses

Length n vector of integer Doses given to patients.

Dosetried

Binary vector corresponding to which doses have been tried.

cohort

Cohort size for the trial.

Contour

Contour vector for desirability function. Contains in order: (pi_1,E,pi_2,T,pi_3,E,pi_4,T).

CutE

Cutoff for efficacy probability acceptability. Dose-efficacy probabilities must be larger than this for patient assignment.

CutT

Cutoff for toxicity probability acceptability. Dose-toxicity probabilities must be smaller than this for patient assignment.

AcceptE

Posterior probability threshold for efficacy acceptability.

AcceptT

Posterior probability threshold for toxicity acceptability.

HypermeansE

Hypermeans for dose-specific efficacy parameters.

HypermeansT

Hypermeans for dose-specific toxcity parameters.

Hypervars

Hypervariances needed for the SPSO model. Contains, in order (sigma_0^2, sigma_mu^2,tau).

B

Number of iterations to run for the MCMC.

Value

A list containing the optimal dose level to assign the next patient cohort in the first entry and a matrix in the second entry, with rows corresponding to (1) the dose #, (2) mean posterior toxicity probability at each dose, mean posterior efficacy probability at each dose, and acceptable posterior desirability score of each dose level (0s indicate the dose is not acceptably efficous or toxic).

Examples

##Get the Data
##True Tox Prob
PT = c(.1,.2,.25,.5,.7)
##True EFF Prob
PE = c(.3,.4,.7,.5,.5)
Doses=c(1,1,1,2,2,2,3,3,3,2,2,2,1,1,1,2,2,2,3,3,3)
YE=Doses
YT=Doses
Dosetried=rep(0,length(PE))
##Generate data
for(k in 1:length(PE)){
if(sum(Doses==k)){
##Dose level has been tried
Dosetried[k]=1
YE[Doses==k]=rbinom(sum(Doses==k),1,PE[k])
YT[Doses==k]=rbinom(sum(Doses==k),1,PT[k])
}
}
##Hyperparameters
HypermeansE=c(-1,-.5,0,.5,1,2)
HypermeansT=HypermeansE
Hypervars=c(1,16,1)
##Trial parameters
cohort=3
##Contour vector
Contour = c(.35, .75,.7,.4)
CutE=.3 ##Efficacy threshold
CutT=.4 ##Toxicity threshold
AcceptE=.3 ##Eff acceptability threshold
AcceptT= .3 ##Tox acceptability threshold
B=100##Number of iterations
GetSpsoContour(YE,YT,Doses,Dosetried,cohort,Contour,CutE, CutT, AcceptE, AcceptT,
HypermeansE,  HypermeansT,Hypervars,B )

Assigns next patient cohort based on the SPSOP model with a Utility based objective function.

Description

Provides the optimal dose level as determined by the SPSO model, posterior mean toxicity probability, efficacy probability, and mean utility of each dose level. Doses that are unacceptably toxic or inefficous have a utility of 0.

Usage

GetSpsoUt(
  YE,
  YT,
  Doses,
  Dosetried,
  cohort,
  UT,
  CutE,
  CutT,
  AcceptE,
  AcceptT,
  HypermeansE,
  HypermeansT,
  Hypervars,
  B
)

Arguments

YE

Length n binary indicator vector of efficacy status.

YT

Length n binary indicator vector of toxicity status.

Doses

Length n vector of integer Doses given to patients.

Dosetried

Binary vector corresponding to which doses have been tried.

cohort

Cohort size for the trial.

UT

Utility matrix for the four bivariate (efficacy, toxicity) events.

CutE

Cutoff for efficacy probability acceptability. Dose-efficacy probabilities must be larger than this for patient assignment.

CutT

Cutoff for toxicity probability acceptability. Dose-toxicity probabilities must be smaller than this for patient assignment.

AcceptE

Posterior probability threshold for efficacy acceptability.

AcceptT

Posterior probability threshold for toxicity acceptability.

HypermeansE

Hypermeans for dose-specific efficacy parameters.

HypermeansT

Hypermeans for dose-specific toxcity parameters.

Hypervars

Hypervariances needed for the SPSO model. Contains, in order (sigma_0^2, sigma_mu^2,tau).

B

Number of iterations to run for the MCMC.

Value

A list containing the optimal dose level to assign the next patient cohort in the first entry and a matrix in the second entry, with rows corresponding to (1) the dose #, (2) mean posterior toxicity probability at each dose, mean posterior efficacy probability at each dose, and acceptable posterior utility score of each dose level (0s indicate the dose is not acceptably efficous or toxic).

Examples

##Get the Data
##True Tox Prob
PT = c(.1,.2,.25,.5,.7)
##True EFF Prob
PE = c(.3,.4,.7,.5,.5)
Doses=c(1,1,1,2,2,2,3,3,3,2,2,2,1,1,1,2,2,2,3,3,3)
YE=Doses
YT=Doses
Dosetried=rep(0,length(PE))
##Generate data
for(k in 1:length(PE)){
if(sum(Doses==k)){
##Dose level has been tried
Dosetried[k]=1
YE[Doses==k]=rbinom(sum(Doses==k),1,PE[k])
YT[Doses==k]=rbinom(sum(Doses==k),1,PT[k])
}
}
##Hyperparameters
HypermeansE=c(-1,-.5,0,.5,1,2)
HypermeansT=HypermeansE
Hypervars=c(1,16,1)
##Trial parameters
cohort=3
#'##UTILITY Matrix
UT = matrix(c(38.23529,100,0,61.76471),nrow=2,byrow=TRUE)
CutE=.3 ##Efficacy threshold
CutT=.4 ##Toxicity threshold
AcceptE=.3 ##Eff acceptability threshold
AcceptT= .3 ##Tox acceptability threshold
B=100##Number of iterations
GetSpsoUt(YE,YT,Doses,Dosetried,cohort,UT,CutE, CutT, AcceptE, AcceptT,
HypermeansE,  HypermeansT,Hypervars,B )

Obtains optimal dose level.

Description

Gives the optimal dose level to assign the next patient cohort to based on the vector of optimality function values for each dose level (desirability or utility based) and the doses tried throughout the trial.

Usage

ReturnOpt(Desire, DoseTried)

Arguments

Desire

Vector of optimality function values for each dose level.

DoseTried

Binary vector containing 1 for doses that have been tried during the trial and 0 otherwise.

Value

Optimal dose level to assign the next patient cohort.


Simulates utility based Efftox trials

Description

Simulates utility based Efftox trials

Usage

RunAdaptiveEffToxTrialCORR(
  DoseStart,
  Dose,
  Hypermeans,
  Hypervars,
  UT,
  PiLim,
  ProbLim,
  cohort,
  NET,
  NF,
  B,
  nSims,
  PMAT
)

Arguments

DoseStart

Dose level to START the EFF-Tox Trial

Dose

Vector of Doses considered in the trial

Hypermeans

6 vector of prior means

Hypervars

6 vector of prior standard deviations

UT

2x2 matrix of utilities corresponding to the four binary bivariate (toxicity, efficacy) events.

PiLim

2 vector of acceptable limits

ProbLim

2 vector of cutoff for acceptabilities

cohort

Cohort size

NET

Maximum Sample size to run the EFFtox Trial, must be divisible by cohort

NF

Minimum sample size to begin adaptive randomization, must be divisible by count

B

Number of reps to perform in MCMC

nSims

Number of Simulated trials to run.

PMAT

Contains TRUE pi00,pi10, pi01, pi11 for each dose

Value

Trial simulation results to be processed for operating characteristics summaries.


Simulates desirability based Efftox trials

Description

Simulates Efftox trials based on the desirability tradeoff contour.

Usage

RunAdaptiveEffToxTrialCORRCONTOUR(
  DoseStart,
  Dose,
  Hypermeans,
  Hypervars,
  Contour,
  PiLim,
  ProbLim,
  cohort,
  NET,
  NF,
  B,
  nSims,
  PMAT
)

Arguments

DoseStart

Dose level to START the EFF-Tox Trial

Dose

Vector of Doses considered in the trial

Hypermeans

6 vector of prior means

Hypervars

6 vector of prior standard deviations

Contour

4 vector used to specify the tradeoff contour.

PiLim

2 vector of acceptable limits

ProbLim

2 vector of cutoff for acceptabilities

cohort

Cohort size

NET

Maximum Sample size to run the EFFtox Trial, must be divisible by cohort

NF

Minimum sample size to begin adaptive randomization, must be divisible by count

B

Number of reps to perform in MCMC

nSims

Number of Simulated trials to run.

PMAT

Contains TRUE pi00,pi10, pi01, pi11 for each dose

Value

Trial simulation results to be processed for operating characteristics summaries.


Simulates trial replications from the Efftox model with desirability optimality function.

Description

Simulates replications from a Bayesian adaptive phase 12 clinical trial design using the Efftox model and a optimality function based on the desirability tradeoff contour.

Usage

SimEfftoxContour(
  NSims,
  Dose,
  PE,
  PT,
  corET,
  Nmax,
  cohort,
  Contour,
  CutE,
  CutT,
  AcceptE,
  AcceptT,
  HypermeansEFF,
  HypervarsEFF
)

Arguments

NSims

Number of trial simulations to run.

Dose

Logarithm of raw dose levels - the average logarithm of the raw dose levels.

PE

True efficacy probability for each dose.

PT

True toxicity probaiblity for each dose.

corET

Correlation parameter between efficacy and toxicity probability.

Nmax

Maximum trial sample size.

cohort

Patient cohort size.

Contour

Contour vector for desirability function. Contains in order: (pi_1,E,pi_2,T,pi_3,E,pi_4,T).

CutE

Cutoff for efficacy probability acceptability. Dose-efficacy probabilities must be larger than this for patient assignment.

CutT

Cutoff for toxicity probability acceptability. Dose-toxicity probabilities must be smaller than this for patient assignment.

AcceptE

Posterior probability threshold for efficacy acceptability.

AcceptT

Posterior probability threshold for toxicity acceptability.

HypermeansEFF

Hypermeans for the Efftox model. In order, entries are hypermeans for (beta_0,E,beta_1,E,beta_2,E,beta_0,T,beta_1,T,psi).

HypervarsEFF

Hypervariances for the Efftox model. In order, entries are hypervariances for (beta_0,E,beta_1,E,beta_2,E,beta_0,T,beta_1,T,psi).

Value

A list with the first entry corresponding to a matrix with: (1) True toxicity probabilities at each dose, (2) True efficacy probabilities at each dose, (3) True Desirability of each dose, (4) Optimal dose selection probability, (5) Average sample size of patients treated at each dose. The second entry of the list contains a vector with rows corresponding to (1) the true binary bivariate correlation between efficacy and toxicity, (2) Stopping probability of the trial, (3) Average number of efficacy events, (4) Average number of toxicity events, and (5) Delta.

Examples

library(mvtnorm)
##True toxicity probability
PT=c(.05,.10,.15,.20,.30)
##True Efficacy Probability
PE=c(.2,.4,.6,.65,.7)
#True Correlation
corET=.5
##Number of simulations
NSims=1 ##Increase this when using
##Hypermeans and hypervariances
HypermeansEFF = c(.022,3.45,0,-4.23,3.1,0)
HypervarsEFF = c(2.6761, 2.6852, .2, 3.1304, 3.1165, 1)
HypervarsEFF=HypervarsEFF^2
##Trial Parameters
##Cohort Size, N^F and N_ET
cohort=3
##Starting Dose
DoseStart=1
##Vector of Numerical Doses
Dose = c(1,2,3,3.5,5)
##Dose for Eff-Tox
Dose=log(Dose)-mean(log(Dose))
Nmax=30 ##Max Sample Size
#Acceptability Criterion
CutE=.3
CutT=.4
##Limits on acceptability
AcceptE=.1
AcceptT=.1
##Contour vector
Contour = c(.35, .75,.7,.4)
RESULTS=SimEfftoxContour(NSims, Dose,PE,  PT, corET,
Nmax, cohort, Contour, CutE, CutT, AcceptE,AcceptT,  HypermeansEFF, HypervarsEFF)
RESULTS

Simulates trial replications from the Efftox model with utility optimality function.

Description

Simulates replications from a Bayesian adaptive phase 12 clinical trial design using the Efftox model and a optimality function based on mean utility. Does not assign patient cohorts to unacceptably toxic or inefficous dose levels.

Usage

SimEfftoxUt(
  NSims,
  Dose,
  PE,
  PT,
  corET,
  Nmax,
  cohort,
  UT,
  CutE,
  CutT,
  AcceptE,
  AcceptT,
  HypermeansEFF,
  HypervarsEFF
)

Arguments

NSims

Number of trial simulations to run.

Dose

Logarithm of raw dose levels - the average logarithm of the raw dose levels.

PE

True efficacy probability for each dose.

PT

True toxicity probaiblity for each dose.

corET

Correlation parameter between efficacy and toxicity probability.

Nmax

Maximum trial sample size.

cohort

Patient cohort size.

UT

Utility matrix for the four bivariate (efficacy, toxicity) events.

CutE

Cutoff for efficacy probability acceptability. Dose-efficacy probabilities must be larger than this for patient assignment.

CutT

Cutoff for toxicity probability acceptability. Dose-toxicity probabilities must be smaller than this for patient assignment.

AcceptE

Posterior probability threshold for efficacy acceptability.

AcceptT

Posterior probability threshold for toxicity acceptability.

HypermeansEFF

Hypermeans for the Efftox model. In order, entries are hypermeans for (beta_0,E,beta_1,E,beta_2,E,beta_0,T,beta_1,T,psi).

HypervarsEFF

Hypervariances for the Efftox model. In order, entries are hypervariances for (beta_0,E,beta_1,E,beta_2,E,beta_0,T,beta_1,T,psi).

Value

A list with the first entry corresponding to a matrix with: (1) True toxicity probabilities at each dose, (2) True efficacy probabilities at each dose, (3) True mean utility of each dose, (4) Optimal dose selection probability, (5) Average sample size of patients treated at each dose. The second entry of the list contains a vector with rows corresponding to (1) the true binary bivariate correlation between efficacy and toxicity, (2) Stopping probability of the trial, (3) Average number of efficacy events, (4) Average number of toxicity events, and (5) Delta.

Examples

library(mvtnorm)
##True toxicity probability
PT=c(.05,.10,.15,.20,.30)
##True Efficacy Probability
PE=c(.2,.4,.6,.65,.7)
#True Correlation
corET=.5
##Number of simulations
NSims=1 ##Increase this when using
##Hypermeans and hypervariances
HypermeansEFF = c(.022,3.45,0,-4.23,3.1,0)
HypervarsEFF = c(2.6761, 2.6852, .2, 3.1304, 3.1165, 1)
HypervarsEFF=HypervarsEFF^2
##Trial Parameters
##Cohort Size, N^F and N_ET
cohort=3
##Starting Dose
DoseStart=1
##Vector of Numerical Doses
Dose = c(1,2,3,3.5,5)
##Dose for Eff-Tox
Dose=log(Dose)-mean(log(Dose))
Nmax=30 ##Max Sample Size
#Acceptability Criterion
CutE=.3
CutT=.4
##Limits on acceptability
AcceptE=.1
AcceptT=.1
##UTILITY Matrix
UT = matrix(c(38.23529,100,0,61.76471),nrow=2,byrow=TRUE)
RESULTS=SimEfftoxUt(NSims, Dose,PE,  PT, corET,
Nmax, cohort, UT, CutE, CutT, AcceptE,AcceptT,  HypermeansEFF, HypervarsEFF)
RESULTS

Simulates trial replications from the SPSO model with desirability optimality function.

Description

Simulates replications from a Bayesian adaptive phase 12 clinical trial design using the SPSO model and a optimality function based on the desirability tradeoff contour.

Usage

SimSpsoContour(
  NSims,
  PE,
  PT,
  corET,
  Nmax,
  cohort,
  Contour,
  CutE,
  CutT,
  AcceptE,
  AcceptT,
  HypermeansE,
  HypermeansT,
  Hypervars
)

Arguments

NSims

Number of trial simulations to run.

PE

True efficacy probability for each dose.

PT

True toxicity probaiblity for each dose.

corET

Correlation parameter between efficacy and toxicity probability.

Nmax

Maximum trial sample size.

cohort

Patient cohort size.

Contour

Contour vector for desirability function. Contains in order: (pi_1,E,pi_2,T,pi_3,E,pi_4,T).

CutE

Cutoff for efficacy probability acceptability. Dose-efficacy probabilities must be larger than this for patient assignment.

CutT

Cutoff for toxicity probability acceptability. Dose-toxicity probabilities must be smaller than this for patient assignment.

AcceptE

Posterior probability threshold for efficacy acceptability.

AcceptT

Posterior probability threshold for toxicity acceptability.

HypermeansE

Hypermeans for dose-specific efficacy parameters.

HypermeansT

Hypermeans for dose-specific toxcity parameters.

Hypervars

Hypervariances needed for the SPSO model. Contains, in order (sigma_0^2, sigma_mu^2,tau).

Value

A list with the first entry corresponding to a matrix with: (1) True toxicity probabilities at each dose, (2) True efficacy probabilities at each dose, (3) True Desirability of each dose, (4) Optimal dose selection probability, (5) Average sample size of patients treated at each dose. The second entry of the list contains a vector with rows corresponding to (1) the true binary bivariate correlation between efficacy and toxicity, (2) Stopping probability of the trial, (3) Average number of efficacy events, (4) Average number of toxicity events, and (5) Delta.

Examples

library(mvtnorm)
##True toxicity probability
PT=c(.05,.10,.15,.20,.30)
##True Efficacy Probability
PE=c(.2,.4,.6,.65,.7)
#True Correlation
corET=.5
##Number of simulations
NSims=1 ##Increase this when using
##Hypermeans and hypervariances
HypermeansE=c(-1.189, -0.357,  0.360,  0.546,  0.743)
HypermeansT=c(-2.325, -1.811, -1.464, -1.189, -0.740)
Hypervars=c(1,16,1)
##Trial Parameters
##Cohort Size, N^F and N_ET
cohort=3
##Starting Dose
DoseStart=1
Nmax=30 ##Max Sample Size
#Acceptability Criterion
CutE=.3
CutT=.4
##Limits on acceptability
AcceptE=.1
AcceptT=.1
##Contour vector
Contour = c(.35, .75,.7,.4)
RESULTS=SimSpsoContour(NSims, PE, PT, corET, Nmax, cohort, Contour,
CutE, CutT, AcceptE, AcceptT,HypermeansE, HypermeansT, Hypervars)
RESULTS

Simulates trial replications from the SPSO model with desirability optimality function.

Description

Simulates replications from a Bayesian adaptive phase 12 clinical trial design using the SPSO model and a optimality function based on the desirability tradeoff contour.

Usage

SimSpsoUt(
  NSims,
  PE,
  PT,
  corET,
  Nmax,
  cohort,
  UT,
  CutE,
  CutT,
  AcceptE,
  AcceptT,
  HypermeansE,
  HypermeansT,
  Hypervars
)

Arguments

NSims

Number of trial simulations to run.

PE

True efficacy probability for each dose.

PT

True toxicity probaiblity for each dose.

corET

Correlation parameter between efficacy and toxicity probability.

Nmax

Maximum trial sample size.

cohort

Patient cohort size.

UT

Utility matrix for the four bivariate (efficacy, toxicity) events.

CutE

Cutoff for efficacy probability acceptability. Dose-efficacy probabilities must be larger than this for patient assignment.

CutT

Cutoff for toxicity probability acceptability. Dose-toxicity probabilities must be smaller than this for patient assignment.

AcceptE

Posterior probability threshold for efficacy acceptability.

AcceptT

Posterior probability threshold for toxicity acceptability.

HypermeansE

Hypermeans for dose-specific efficacy parameters.

HypermeansT

Hypermeans for dose-specific toxcity parameters.

Hypervars

Hypervariances needed for the SPSO model. Contains, in order (sigma_0^2, sigma_mu^2,tau).

Value

A list with the first entry corresponding to a matrix with: (1) True toxicity probabilities at each dose, (2) True efficacy probabilities at each dose, (3) True mean utility of each dose, (4) Optimal dose selection probability, (5) Average sample size of patients treated at each dose. The second entry of the list contains a vector with rows corresponding to (1) the true binary bivariate correlation between efficacy and toxicity, (2) Stopping probability of the trial, (3) Average number of efficacy events, (4) Average number of toxicity events, and (5) Delta.

Examples

library(mvtnorm)
##True toxicity probability
PT=c(.05,.10,.15,.20,.30)
##True Efficacy Probability
PE=c(.2,.4,.6,.65,.7)
#True Correlation
corET=.5
##Number of simulations
NSims=1 ##Increase this when using
##Hypermeans and hypervariances
HypermeansE=c(-1.189, -0.357,  0.360,  0.546,  0.743)
HypermeansT=c(-2.325, -1.811, -1.464, -1.189, -0.740)
Hypervars=c(1,16,1)
##Trial Parameters
##Cohort Size, N^F and N_ET
cohort=3
##Starting Dose
DoseStart=1
Nmax=30 ##Max Sample Size
#Acceptability Criterion
CutE=.3
CutT=.4
##Limits on acceptability
AcceptE=.1
AcceptT=.1
##UTILITY Matrix
UT = matrix(c(38.23529,100,0,61.76471),nrow=2,byrow=TRUE)
RESULTS=SimSpsoUt(NSims, PE, PT, corET, Nmax, cohort, UT,
CutE, CutT, AcceptE, AcceptT,HypermeansE, HypermeansT, Hypervars)
RESULTS

Samples from the posterior of the utility based phase12 model.

Description

Takes arguments of data, hypermens and hypervariance vectors and returns a list of posterior samples from the Utility based phase12 model decribed by Chapple and Thall (2019).

Usage

UTEFFTOX(YE, YT, Doses, HypermeansEFF, HypermeansTOX, Hypervars, B)

Arguments

YE

Binary indicator vector of efficacy status.

YT

Binary indicator vector of toxicity status.

Doses

Vector of integer Doses given to patients.

HypermeansEFF

Vector of length nDose for dose prior means for efficacy.

HypermeansTOX

Vector of length nDose for dose prior means for toxicity

Hypervars

Length 3 vector of hypervariances.Hypervars(1) contains sigma_0^2, Hypervars(2) contains sigma_mu, Hypervars(3) contains tau - the frailty variance.

B

Number of iterations to run for the MCMC.

Value

A list of posterior samples after burnin in order: Posterior efficacy dose-vector, Posterior toxicity dose-vector, Posterior correlation.

Examples

n=100  #Generate Data
YE=rbinom(n,1,.6)
YT=rbinom(n,1,.2)
nDose=5
Doses=sample(1:nDose,n,replace=TRUE)
##Hyperparameters
HypermeansEFF=c(-1,-.5,0,.5,1,2)
HypermeansTOX=HypermeansEFF
Hypervars=c(1,16,1)
B=100
UTEFFTOX(YE, YT,Doses,HypermeansEFF,HypermeansTOX, Hypervars, B)