Title: | Simulating and Conducting Phase 123 Trials |
---|---|
Description: | Contains three simulation functions for implementing the entire Phase 123 trial and the separate Eff-Tox and Phase 3 portions of the trial, which may be beneficial for use on clusters. The functions AssignEffTox() and RandomizeEffTox() assign doses to patient cohorts during phase 12 and Reoptimize() determines the optimal dose to continue with during Phase 3. The functions ReturnMeansAgent() and ReturnMeanControl() gives the true mean survival for the agent doses and control and ReturnOCS() gives the operating characteristics of the design. |
Authors: | Andrew G Chapple |
Maintainer: | Andrew G Chapple <[email protected]> |
License: | GPL-2 |
Version: | 2.1 |
Built: | 2024-10-31 19:50:39 UTC |
Source: | CRAN |
This function returns the optimal acceptable dose number to assign the next patient cohort or stops the trial if no dose is deemed acceptable.
AssignEffTox(YE, YT, Doses, Dose, DosesTried, Hypermeans, Hypervars, Contour, PiLim, ProbLim, B)
AssignEffTox(YE, YT, Doses, Dose, DosesTried, Hypermeans, Hypervars, Contour, PiLim, ProbLim, B)
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. |
The optimal dose level to administer the next patient cohort.
##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 )
##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 )
This function is used in Reoptimize, SimPhase123 and SimPhase3, here we estimate the mixture probabilities over the four outcomes for efficacy and toxicity.
EFFTOX(YE, YT, Doses, Dose, Hypermeans, Hypervars, B)
EFFTOX(YE, YT, Doses, Dose, Hypermeans, Hypervars, B)
YE |
Vector containing observed efficacy indicators. |
YT |
Vector containing observed toxicity indicators. |
Doses |
Vector containing Standardized doses of patients in trial. |
Dose |
Vector containing the standardized doses considered. |
Hypermeans |
Vector containing prior hypermeans of length 6 for Eff-Tox parameters. |
Hypervars |
Vector containing prior hypervariances of length 6 for Eff-Tox parameters. |
B |
Number of iterations to perform in the MCMC. |
The posterior probability matrix for the events (YE,YT) in each row corresponding to a dose level.
##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) Doses=Dose[Doses] ##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 ##Number of iterations B=2000 EFFTOX(YE,YT, Doses, Dose, Hypermeans, Hypervars, B )
##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) Doses=Dose[Doses] ##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 ##Number of iterations B=2000 EFFTOX(YE,YT, Doses, Dose, Hypermeans, Hypervars, B )
This function performs MCMC with Metropolis-Hastings-Green steps for the baseline hazard function and is used in the functions Reoptimize, SimPhase123 and SimPhase3.
PieceMCMC(Y, I, YE, YT, Doses, Dose, B, prob, MaxObs)
PieceMCMC(Y, I, YE, YT, Doses, Dose, B, prob, MaxObs)
Y |
Patient survival or followup times. |
I |
Patient event indicators. |
YE |
Vector of indicators for patient efficacy. |
YT |
Vector of indicators for patient toxicity. |
Doses |
Vector of standardized doses given to patients. |
Dose |
Vector of standardized doses considered in trial. |
B |
Number of iterations to perform in MCMC. |
prob |
length(Doses) X 4 matrix containing the estimated posterior probabilities for each dose and each (Efficacy, Toxicity) outcomes. |
MaxObs |
length(Doses) X 4 matrix containing the maximum observed survival time we want to evaluate the means to. |
Returns a list containing a matrix of posterior means for each dose, regression coefficients in the cox models, locations of the split points, log hazard heights on each interval, and the number of intervals in the baseline hazard.
n=100 Y=rexp(n,1) I = rbinom(n,1,.9) YE = rbinom(n,1,.5) YT = rbinom(n,1,.5) Dose = c(1,2,3,3.5,5) Dose=(Dose-mean(Dose))/sd(Dose) Doses = sample(1:5,n,replace=TRUE) Doses=Dose[Doses] B=2000 MaxObs = matrix(rep(0,length(Dose)*4),nrow=4) prob=matrix(rep(0,length(Dose)*4),ncol=4) prob=prob+1/4 MaxObs=MaxObs+max(Y) G=PieceMCMC(Y,I,YE,YT,Doses,Dose,B,prob,MaxObs)
n=100 Y=rexp(n,1) I = rbinom(n,1,.9) YE = rbinom(n,1,.5) YT = rbinom(n,1,.5) Dose = c(1,2,3,3.5,5) Dose=(Dose-mean(Dose))/sd(Dose) Doses = sample(1:5,n,replace=TRUE) Doses=Dose[Doses] B=2000 MaxObs = matrix(rep(0,length(Dose)*4),nrow=4) prob=matrix(rep(0,length(Dose)*4),ncol=4) prob=prob+1/4 MaxObs=MaxObs+max(Y) G=PieceMCMC(Y,I,YE,YT,Doses,Dose,B,prob,MaxObs)
This function returns a random acceptable dose number to assign the next patient cohort or stops the trial if no dose is deemed acceptable.
RandomEffTox(YE, YT, Doses, Dose, DosesTried, Hypermeans, Hypervars, Contour, PiLim, ProbLim, B)
RandomEffTox(YE, YT, Doses, Dose, DosesTried, Hypermeans, Hypervars, Contour, PiLim, ProbLim, B)
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. |
A random dose level to administer the next patient cohort.
##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 RandomEffTox(YE,YT, Doses, Dose, DosesTried, Hypermeans, Hypervars, Contour, PiLim, ProbLim, B )
##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 RandomEffTox(YE,YT, Doses, Dose, DosesTried, Hypermeans, Hypervars, Contour, PiLim, ProbLim, B )
This function returns the optimal dose number to assign the next patient cohort or stops the trial if no dose is deemed acceptable.
Reoptimize(Y, I, YE, YT, Doses, Dose, Hypermeans, Hypervars, B)
Reoptimize(Y, I, YE, YT, Doses, Dose, Hypermeans, Hypervars, B)
Y |
Vector containing observed patient survival or follow up times. |
I |
Vector indicating whether each patient experienced an exent. |
YE |
Vector containing observed efficacy indicators. |
YT |
Vector containing observed toxicity indicators. |
Doses |
Vector containing standardized doses of patients in trial. |
Dose |
Vector containing the standardized doses considered. |
Hypermeans |
Vector containing prior hypermeans of length 6 for Eff-Tox parameters. |
Hypervars |
Vector containing prior hypervariances of length 6 for Eff-Tox parameters. |
B |
Number of iterations to perform in the MCMC. |
[1] Chapple and Thall (2018).A Hybrid Phase I-II/III Clinical Trial Design Allowing Dose Re-Optimization in Phase III. Biometrics. In Press,
##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) Y=rexp(length(YE)) I=rbinom(length(YE),1,.9) ##Vector of Numerical Doses Dose = c(1,2,3,3.5,5) Dose=(Dose-mean(Dose))/sd(Dose) ##Hypermeans for Eff-Tox 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 ###Number of iterations B=20000 Reoptimize(Y,I,YE,YT, Doses, Dose, Hypermeans, Hypervars,B)
##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) Y=rexp(length(YE)) I=rbinom(length(YE),1,.9) ##Vector of Numerical Doses Dose = c(1,2,3,3.5,5) Dose=(Dose-mean(Dose))/sd(Dose) ##Hypermeans for Eff-Tox 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 ###Number of iterations B=20000 Reoptimize(Y,I,YE,YT, Doses, Dose, Hypermeans, Hypervars,B)
This function returns the optimal dose number to assign the next patient cohort or stops the trial if no dose is deemed acceptable.
Reoptimize1(Y, I, YE, YT, Doses, Dose, Hypermeans, Hypervars, B)
Reoptimize1(Y, I, YE, YT, Doses, Dose, Hypermeans, Hypervars, B)
Y |
Vector containing observed patient survival or follow up times. |
I |
Vector indicating whether each patient experienced an exent. |
YE |
Vector containing observed efficacy indicators. |
YT |
Vector containing observed toxicity indicators. |
Doses |
Vector containing standardized doses of patients in trial. |
Dose |
Vector containing the standardized doses considered. |
Hypermeans |
Vector containing prior hypermeans of length 6 for Eff-Tox parameters. |
Hypervars |
Vector containing prior hypervariances of length 6 for Eff-Tox parameters. |
B |
Number of iterations to perform in the MCMC. |
[1] Chapple and Thall (2018).A Hybrid Phase I-II/III Clinical Trial Design Allowing Dose Re-Optimization in Phase III. Biometrics. In Press,
##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) Y=rexp(length(YE)) I=rbinom(length(YE),1,.9) ##Vector of Numerical Doses Dose = c(1,2,3,3.5,5) Dose=(Dose-mean(Dose))/sd(Dose) ##Hypermeans for Eff-Tox 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 ###Number of iterations B=20000 Reoptimize1(Y,I,YE,YT, Doses, Dose, Hypermeans, Hypervars,B)
##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) Y=rexp(length(YE)) I=rbinom(length(YE),1,.9) ##Vector of Numerical Doses Dose = c(1,2,3,3.5,5) Dose=(Dose-mean(Dose))/sd(Dose) ##Hypermeans for Eff-Tox 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 ###Number of iterations B=20000 Reoptimize1(Y,I,YE,YT, Doses, Dose, Hypermeans, Hypervars,B)
Returns the mean survival times for the control given efficacy and toxicity dose probability vector, distribution family and linear relationship, effiacy, toxicity and survival.
ReturnMeanControl(ProbC, betaC, Family, alpha)
ReturnMeanControl(ProbC, betaC, Family, alpha)
ProbC |
Probability of efficacy and toxicity for the control therapy. |
betaC |
Linear term for efficacy, toxicity and beta_0 for the control groupar term for efficacy, toxicity and beta_0 for the control group. |
Family |
Time to event distribution. Options include: Exponential, Gamma, Weibull, Lognormal. |
alpha |
Shape parameter or standard deviation of a lognormal distribution. |
[1] Chapple and Thall (2018).A Hybrid Phase I-II/III Clinical Trial Design Allowing Dose Re-Optimization in Phase III. Biometrics. In Press,
###Family of Distributions Family="Gamma" ###Shape parameter alpha=2 ##True beta vector for efficacy, toxicity and intercept of the control treatment betaC=c(.3,-.25,2.389) ##True efficacy and toxicity probability for control group ProbC = c(.4,.15) ReturnMeanControl(ProbC,betaC,Family,alpha)
###Family of Distributions Family="Gamma" ###Shape parameter alpha=2 ##True beta vector for efficacy, toxicity and intercept of the control treatment betaC=c(.3,-.25,2.389) ##True efficacy and toxicity probability for control group ProbC = c(.4,.15) ReturnMeanControl(ProbC,betaC,Family,alpha)
Returns the dose specific mean survival times for given efficacy and toxicity dose probability vector, distribution family and linear relationship between dose, effiacy, toxicity and survival.
ReturnMeansAgent(PE, PT, beta, Dose, Family, alpha)
ReturnMeansAgent(PE, PT, beta, Dose, Family, alpha)
PE |
True efficacy dose-toxicity vector. |
PT |
True toxicity dose-toxicity vector. |
beta |
True linear term for the rate or mean parameter |
Dose |
Vector of standardized doses considered in the trial. |
Family |
Time to event distribution. Options include: Exponential, Gamma, Weibull, Lognormal. |
alpha |
Shape parameter or standard deviation of a lognormal distribution. |
[1] Chapple and Thall (2018). A Hybrid Phase 12/3 Clinical Trial Design Allowing Dose Re-Optimization in Phase 3 Biometrics. Under Review.
##True Efficacy and Toxicity Probabilities PT = c(.1,.15,.25,.35,.5) PE=c(.2,.4,.6,.65,.7) ##Dose Levels considered Dose = c(1,2,3,3.5,5) Dose=(Dose-mean(Dose))/sd(Dose) ###Family of Distributions Family="Gamma" ###Shape parameter ## Doesn't matter for exponential distribution alpha=2 ###True Beta vector beta = c(.75,-.5, .3, -.25,2.143) ReturnMeansAgent(PE,PT,beta,Dose,Family,alpha)
##True Efficacy and Toxicity Probabilities PT = c(.1,.15,.25,.35,.5) PE=c(.2,.4,.6,.65,.7) ##Dose Levels considered Dose = c(1,2,3,3.5,5) Dose=(Dose-mean(Dose))/sd(Dose) ###Family of Distributions Family="Gamma" ###Shape parameter ## Doesn't matter for exponential distribution alpha=2 ###True Beta vector beta = c(.75,-.5, .3, -.25,2.143) ReturnMeansAgent(PE,PT,beta,Dose,Family,alpha)
Returns the probability of selecting the optimal dose, type I error, generalized power, probability of making the best decision, average number of patients treated and average trial duration.
ReturnOCS(Results, Means, CMu, Delta, Hyp)
ReturnOCS(Results, Means, CMu, Delta, Hyp)
Results |
List containing phase 123 and conventional design results. |
Means |
True mean survival times for experimental agents at each dose. |
CMu |
Mean survival time for the control therapy. |
Delta |
Desired improvement in survival. |
Hyp |
Null=0 or alternative=1 hypthesis |
[1] Chapple and Thall (2018). A Hybrid Phase 12/3 Clinical Trial Design Allowing Dose-Re-Optimization in Phase 3 Biometrics. Under Review.
##True Mean Control CMu=24 ##True Means Agent Means = c(27,32,38,42,28) ##Desired improvement in mean survival Delta=12 ##Random Trial results Results=as.list(c(0,0)) nSims=5 X=matrix(rep(NA,nSims*4),nrow=nSims) ##DoseSelected X[,1]=c(2,3,4,4,3) X[,2]=c(0,1,1,1,1) X[,3]=c(270,500,500,420,400) X[,4]=c(70,85,88,70,88) Results[[1]]=X X[,1]=c(2,3,5,4,2) X[,2]=c(0,1,0,1,0) X[,3]=c(270,500,450,420,415) X[,4]=c(70,82,80,70,79) Results[[2]]=X Hyp=1 ReturnOCS(Results,Means,CMu,Delta,Hyp)
##True Mean Control CMu=24 ##True Means Agent Means = c(27,32,38,42,28) ##Desired improvement in mean survival Delta=12 ##Random Trial results Results=as.list(c(0,0)) nSims=5 X=matrix(rep(NA,nSims*4),nrow=nSims) ##DoseSelected X[,1]=c(2,3,4,4,3) X[,2]=c(0,1,1,1,1) X[,3]=c(270,500,500,420,400) X[,4]=c(70,85,88,70,88) Results[[1]]=X X[,1]=c(2,3,5,4,2) X[,2]=c(0,1,0,1,0) X[,3]=c(270,500,450,420,415) X[,4]=c(70,82,80,70,79) Results[[2]]=X Hyp=1 ReturnOCS(Results,Means,CMu,Delta,Hyp)
This function simulates repititions of an adaptive Eff-Tox Trial and returns a list containing the optimal dose chosen
RunAdaptiveEffToxTrial(DoseStart, Dose, Hypermeans, Hypervars, Contour, PiLim, ProbLim, cohort, NET, NF, B, nSims, PETrue, PTTrue)
RunAdaptiveEffToxTrial(DoseStart, Dose, Hypermeans, Hypervars, Contour, PiLim, ProbLim, cohort, NET, NF, B, nSims, PETrue, PTTrue)
DoseStart |
Dose to start enrolling cohorts of patients at. |
Dose |
Vector containing the standardized doses considered. |
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. |
cohort |
Size of each patient cohort. |
NET |
Maximum sample size for phase I/II. |
NF |
Number of patients to assign optimal doses prior to adaptive randomization. |
B |
Number of iterations to perform in the MCMC. |
nSims |
Number of simulated trials to run. |
PETrue |
True vector of efficacy probabilities for each dose. |
PTTrue |
True vector of toxicity probabilities for each dose. |
List containing the vector of optimal doses chosen, a matrix of posterior desireability scores for each trial, and a matrix consisting of patient dose assignments and Toxicity and Efficacy indicators, with each Nmax rows corresponding to a separate trial. Trials that are stopped due to excessive toxicity probabilty or small efficacy probabilities are not included in the final results.
##Doses, YE,YT ##Starting Dose DoseStart=1 ##Vector of Numerical Doses Dose = c(1,2,3,3.5,5) Dose=(Dose-mean(Dose))/sd(Dose) ## 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) ##Cohort Size, N^F and N_ET cohort=3 NF=15 NET=30 PTTrue = c(.1,.15,.25,.35,.5) PETrue=c(.2,.4,.6,.65,.7) ##Number of iterations for MCMC B=2000 ### Number of Simulations nSims=1 RunAdaptiveEffToxTrial(DoseStart,Dose, Hypermeans, Hypervars, Contour, PiLim, ProbLim, cohort, NET, NF, B, nSims, PETrue, PTTrue )
##Doses, YE,YT ##Starting Dose DoseStart=1 ##Vector of Numerical Doses Dose = c(1,2,3,3.5,5) Dose=(Dose-mean(Dose))/sd(Dose) ## 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) ##Cohort Size, N^F and N_ET cohort=3 NF=15 NET=30 PTTrue = c(.1,.15,.25,.35,.5) PETrue=c(.2,.4,.6,.65,.7) ##Number of iterations for MCMC B=2000 ### Number of Simulations nSims=1 RunAdaptiveEffToxTrial(DoseStart,Dose, Hypermeans, Hypervars, Contour, PiLim, ProbLim, cohort, NET, NF, B, nSims, PETrue, PTTrue )
This function simulates replications of the phase123 and phase 12-3 trials and returns a list containing the doses chosen, decisions made (1=A(x) better, 0= futility, -1=C better)
SimPhase123(DoseStart, Dose, PE, PT, Hypermeans, Hypervars, Contour, PiLim, ProbLim, NET, NF, Accrue12, Time12, cohort, betaA, ProbC, betaC, Family, alpha, Nmax, Accrue, Twait, NLookSwitch, NLook, Sup, Fut, nSims)
SimPhase123(DoseStart, Dose, PE, PT, Hypermeans, Hypervars, Contour, PiLim, ProbLim, NET, NF, Accrue12, Time12, cohort, betaA, ProbC, betaC, Family, alpha, Nmax, Accrue, Twait, NLookSwitch, NLook, Sup, Fut, nSims)
DoseStart |
Starting dose of the phase 12 trial. |
Dose |
Vector of standardized doses considered in the trial. |
PE |
True efficacy dose-toxicity vector. |
PT |
True toxicity dose-toxicity vector. |
Hypermeans |
Prior Means for the Eff-Tox design of length 6. |
Hypervars |
Prior Variances for the Eff-Tox design of length 6. |
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. |
NET |
Maximum sample size of the phase 12 trial. |
NF |
Number of patients to assign deterministic doses prior to adaptive randomization. |
Accrue12 |
Accrual rate for patients in the phase 12 portion of the trial. |
Time12 |
Time window for phase 12. |
cohort |
Size of each patient cohort. |
betaA |
True linear term for the rate or mean parameter (beta_1,exp(beta_E),-exp(beta_T),beta_2,beta_0) for agent A. |
ProbC |
Probability of efficacy and toxicity for the control therapy. |
betaC |
Linear term for efficacy, toxicity and beta_0 for the control groupar term for efficacy, toxicity and beta_0 for the control group. |
Family |
Time to event distribution. Options include: Exponential, Gamma, Weibull, Lognormal. |
alpha |
Shape parameter or standard deviation of a lognormal distribution. |
Nmax |
Maximum number of patients to enroll in phase 3. |
Accrue |
Accrual rate for patients in the phase 3 portion of the trial. |
Twait |
Waiting time in between phase 12 and phase 3. |
NLookSwitch |
Number of patient events to determine if we re-optimize doses for A. |
NLook |
Vector of information criteria for making interim looks. |
Sup |
Vector of superiority boundaries. |
Fut |
Vector of futility boundaries. |
nSims |
Number of simulations to run for the phase 123 and conventional design. |
[1] Chapple and Thall (2018).A Hybrid Phase I-II/III Clinical Trial Design Allowing Dose Re-Optimization in Phase III. Biometrics. In Press,
##We need to specify Phase 12, ###Phase 3 trial paramters, ##the additional phase 123 parameters and simulation parameters #This is scenario 3 for the exponetial case ##the additional phase 123 parameters and simulation parameters ###########PHASE12 Parameters ################## DoseStart=1 ##True Efficacy and Toxicity Probabilities PT = c(.05,.08,.1,.15,.2) PE=c(.2,.25,.35,.4,.55) ##Raw Dose Levels considered Dose = c(1,2,3,3.5,5) #Max Sample Size NET=30 ##Number of patients before randomization NF=15 ##Cohort size cohort=3 ##Hypermeans for Eff-Tox 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 ##Contour Vector Contour = c(.35, .75,.7,.4) ##Acceptability Criteria PiLim = c(.3,.4) ProbLim=c(.1,.1) ##Phase 12 accrual rate Accrue12=5 ###How long is the time window in phase 12? Time12=1 ##########PHASE3 Parameters#################### Nmax=500 ##Number of patient events for interim looks NLook = c(200,300,400) ##Superiority Boundaries Sup = c(2.96, 2.53,1.99) ##Futility Boundaries (0 means no futility decision) Fut = c(0,1.001,0) ##Average accrual rate for phase III Accrue = 10 ###########Phase123 Parameters########### ###Number of patient events to re-optimize doses NLookSwitch=50 ##Time in between phase 12 and phase 3 Twait=1 #########Simulation Parameters###### ###Family of Distributions Family="Gamma" ###Shape parameter, Not needed for Exponential alpha=1 ###True Beta vector (beta_1,exp(beta_E),-exp(beta_T),beta_2,beta_0) betaA = c(.1, .3, -1,-1,3.6) ##True beta vector for (exp(beta_E),-exp(beta_T),beta_C) of the control treatment betaC=c(.3,-1,log(24/1.035111)) ##True efficacy and toxicity probability for control group ProbC = c(.3,.1) ##Number of simulations to run nSims=1 ##Run Simulations Results=SimPhase123(DoseStart,Dose,PE,PT,Hypermeans,Hypervars,Contour, PiLim,ProbLim,NET,NF,Accrue12,Time12,cohort,betaA,ProbC,betaC, Family,alpha,Nmax,Accrue,Twait,NLookSwitch,NLook,Sup,Fut,nSims)
##We need to specify Phase 12, ###Phase 3 trial paramters, ##the additional phase 123 parameters and simulation parameters #This is scenario 3 for the exponetial case ##the additional phase 123 parameters and simulation parameters ###########PHASE12 Parameters ################## DoseStart=1 ##True Efficacy and Toxicity Probabilities PT = c(.05,.08,.1,.15,.2) PE=c(.2,.25,.35,.4,.55) ##Raw Dose Levels considered Dose = c(1,2,3,3.5,5) #Max Sample Size NET=30 ##Number of patients before randomization NF=15 ##Cohort size cohort=3 ##Hypermeans for Eff-Tox 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 ##Contour Vector Contour = c(.35, .75,.7,.4) ##Acceptability Criteria PiLim = c(.3,.4) ProbLim=c(.1,.1) ##Phase 12 accrual rate Accrue12=5 ###How long is the time window in phase 12? Time12=1 ##########PHASE3 Parameters#################### Nmax=500 ##Number of patient events for interim looks NLook = c(200,300,400) ##Superiority Boundaries Sup = c(2.96, 2.53,1.99) ##Futility Boundaries (0 means no futility decision) Fut = c(0,1.001,0) ##Average accrual rate for phase III Accrue = 10 ###########Phase123 Parameters########### ###Number of patient events to re-optimize doses NLookSwitch=50 ##Time in between phase 12 and phase 3 Twait=1 #########Simulation Parameters###### ###Family of Distributions Family="Gamma" ###Shape parameter, Not needed for Exponential alpha=1 ###True Beta vector (beta_1,exp(beta_E),-exp(beta_T),beta_2,beta_0) betaA = c(.1, .3, -1,-1,3.6) ##True beta vector for (exp(beta_E),-exp(beta_T),beta_C) of the control treatment betaC=c(.3,-1,log(24/1.035111)) ##True efficacy and toxicity probability for control group ProbC = c(.3,.1) ##Number of simulations to run nSims=1 ##Run Simulations Results=SimPhase123(DoseStart,Dose,PE,PT,Hypermeans,Hypervars,Contour, PiLim,ProbLim,NET,NF,Accrue12,Time12,cohort,betaA,ProbC,betaC, Family,alpha,Nmax,Accrue,Twait,NLookSwitch,NLook,Sup,Fut,nSims)
This function simulates the phase 3 potion of the phase 123 trial, given phase 12 outcomes.
SimPhase3(Dose, Phase12, PE, PT, Hypermeans, Hypervars, betaA, ProbC, betaC, Family, alpha, Nmax, Opt, Accrue, Time12, Twait, NLookSwitch, NLook, Sup, Fut)
SimPhase3(Dose, Phase12, PE, PT, Hypermeans, Hypervars, betaA, ProbC, betaC, Family, alpha, Nmax, Opt, Accrue, Time12, Twait, NLookSwitch, NLook, Sup, Fut)
Dose |
Vector of standardized doses considered in the trial. |
Phase12 |
Matrix Consisting of patient data from a phase 12 trial. The columns are in order: Doses given, YE, YT, Accrual Times |
PE |
True efficacy dose-toxicity vector. |
PT |
True toxicity dose-toxicity vector. |
Hypermeans |
Prior Means for the Eff-Tox design of length 6. |
Hypervars |
Prior Variances for the Eff-Tox design of length 6. |
betaA |
True linear term for the rate or mean parameter (beta_1,exp(beta_E),-exp(beta_T),beta_2,beta_0) for agent A. |
ProbC |
Probability of efficacy and toxicity for the control therapy. |
betaC |
Linear term for efficacy, toxicity and beta_0 for the control group. |
Family |
Time to event distribution. Options include: Exponential, Gamma, Weibull, Lognormal. |
alpha |
Shape parameter or standard deviation of a lognormal distribution. |
Nmax |
Maximum number of patients to enroll in phase 3. |
Opt |
Dose used for A to begin randomization in phase 3. |
Accrue |
Accrual rate for patients in phase 3. |
Time12 |
Time window for phase 12. |
Twait |
Waiting time in between phase 12 and phase 3. |
NLookSwitch |
Number of patient events to determine if we re-optimize doses for A. |
NLook |
Vector of information criteria for making interim looks. |
Sup |
Vector of superiority boundaries. |
Fut |
Vector of futility boundaries. |
[1] Chapple and Thall (2018).A Hybrid Phase I-II/III Clinical Trial Design Allowing Dose Re-Optimization in Phase III. Biometrics. In Press,
library(survival) ##True Efficacy and Toxicity Probabilities PT = c(.1,.15,.25,.35,.5) PE=c(.2,.4,.6,.65,.7) ##Dose Levels considered Dose = c(1,2,3,3.5,5) Dose=(Dose-mean(Dose))/sd(Dose) ##Average accrual rate for phase III Accrue = 10 #'##Hypermeans for Eff-Tox 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 Contour = c(.35, .75,.7,.4) PiLim = c(.3,.4) ProbLim=c(.1,.1) ###Family of Distributions Family="Exponential" ###Shape parameter ## Doesn't matter for exponential distribution alpha=1 ###True Beta vector betaA = c(.75,-.5, .3, -.25,2.143) ##True beta vector for efficacy, toxicity and intercept of the control treatment betaC=c(.3,-.25,2.389) ##True efficacy and toxicity probability for control group ProbC = c(.4,.15) ##Waiting time in between Twait=1 ###How long is the time window in phase 12? Time12=1 ##Dose to start phase 3 with Opt=3 ##Make matrix with old phase 12 data 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) ##Accrual Times for old data Accrue12=2 ##Size of phase 12 cohort cohort=3 ACC1=cumsum(rexp(length(YT),Accrue12)) ##Accrual times are the same for each cohort in phase 12 Grab = rep(NA,length(YT)/cohort) for(m in 1:length(Grab)){Grab[m]=ACC1[m*3]} for(m in 1:length(Grab)){ACC1[((m-1)*cohort+1):((m-1)*cohort+cohort)]=rep(Grab[m],cohort)} Phase12 = cbind(Doses,YE,YT,ACC1) betaC=c(.3,-.25,2.389) ##True efficacy and toxicity probability for control group ProbC = c(.4,.15) ##Max Sample Size Nmax=500 ###Number of patient events to Re-optimize doses NLookSwitch = 50 ##Number of patient events for interim looks NLook = c(200,300,400) ##Superiority Boundaries Sup = c(2.96, 2.53,1.99) ##Futility Boundaries (0 means no futility decision) Fut = c(0,1.001,0) ##Starting Dose, hat(x)_ET Opt=3 ##Number of simulations to run nSims=10 SimPhase3(Dose,Phase12,PE,PT,Hypermeans,Hypervars,betaA, ProbC,betaC,Family,alpha,Nmax,Opt,Accrue, Time12,Twait,NLookSwitch,NLook,Sup,Fut)
library(survival) ##True Efficacy and Toxicity Probabilities PT = c(.1,.15,.25,.35,.5) PE=c(.2,.4,.6,.65,.7) ##Dose Levels considered Dose = c(1,2,3,3.5,5) Dose=(Dose-mean(Dose))/sd(Dose) ##Average accrual rate for phase III Accrue = 10 #'##Hypermeans for Eff-Tox 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 Contour = c(.35, .75,.7,.4) PiLim = c(.3,.4) ProbLim=c(.1,.1) ###Family of Distributions Family="Exponential" ###Shape parameter ## Doesn't matter for exponential distribution alpha=1 ###True Beta vector betaA = c(.75,-.5, .3, -.25,2.143) ##True beta vector for efficacy, toxicity and intercept of the control treatment betaC=c(.3,-.25,2.389) ##True efficacy and toxicity probability for control group ProbC = c(.4,.15) ##Waiting time in between Twait=1 ###How long is the time window in phase 12? Time12=1 ##Dose to start phase 3 with Opt=3 ##Make matrix with old phase 12 data 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) ##Accrual Times for old data Accrue12=2 ##Size of phase 12 cohort cohort=3 ACC1=cumsum(rexp(length(YT),Accrue12)) ##Accrual times are the same for each cohort in phase 12 Grab = rep(NA,length(YT)/cohort) for(m in 1:length(Grab)){Grab[m]=ACC1[m*3]} for(m in 1:length(Grab)){ACC1[((m-1)*cohort+1):((m-1)*cohort+cohort)]=rep(Grab[m],cohort)} Phase12 = cbind(Doses,YE,YT,ACC1) betaC=c(.3,-.25,2.389) ##True efficacy and toxicity probability for control group ProbC = c(.4,.15) ##Max Sample Size Nmax=500 ###Number of patient events to Re-optimize doses NLookSwitch = 50 ##Number of patient events for interim looks NLook = c(200,300,400) ##Superiority Boundaries Sup = c(2.96, 2.53,1.99) ##Futility Boundaries (0 means no futility decision) Fut = c(0,1.001,0) ##Starting Dose, hat(x)_ET Opt=3 ##Number of simulations to run nSims=10 SimPhase3(Dose,Phase12,PE,PT,Hypermeans,Hypervars,betaA, ProbC,betaC,Family,alpha,Nmax,Opt,Accrue, Time12,Twait,NLookSwitch,NLook,Sup,Fut)