
Bayesian Assurance of Consecutive Studies
J. Kyle Wathen and Laurent Spiess
January 16, 2025
AssuranceConsecutiveStudies.Rmd
Introduction
The intent of this example is to demonstrate the computation of Bayesian assurance, or probability of success, through the integration of R with Cytel products using a series of examples. These examples begin with a 2-arm, normal outcome, fixed sample trial assuming a non-standard prior for computation of assurance. The examples progress to a more complex setting of computing assurance for a sequence of a phase 2 trial with normal outcomes followed by a phase 3 trial where the outcome is time-to-event.
Once CyneRgy is installed, you can load this example in RStudio with the following commands:
CyneRgy::RunExample( "AssuranceConsecutiveStudies" )
Running the command above will load the RStudio project in RStudio.
East Workbook: AssuranceConsecutiveStudies.cywx
RStudio Project File: AssuranceConsecutiveStudies.Rproj
In the R directory of this example you will find the R files used in the examples.
The examples will all contain two treatments, Standard of Care (S) and Experimental (E) and are follows:
- Fixed sample design using a mixture of normal distributions for computation of assurance
- Expand example 1 to a group sequential design with an interim for futility based on a Bayesian predictive probability
- Fixed design with a time-event-event outcome, this example provides the basis and a comparison for the phase 2 followed by a phase 3 example considered last
- Two consecutive studies, phase 2 with a normal endpoint followed by a phase 3 with a normal endpoint
- Two consecutive studies, phase 2 with a normal endpoint followed by a phase 3 with a time-to-event outcome
Example 1
Study Design
Fixed sample, with normally distributed outcomes Y.
- Sample size: 80 patients per arm
- Assume standard deviation is known:
Denote the minimum acceptable value by MAV. For patients receiving treatment = S or E, we assume the outcomes Y where, for simplicity, is unknown and is the known, fixed quantity. We assume a priori Normal( , = ), for S or E. At the end of the study the following is computed:
For decision making we assume . For assurance, a mixture of normal distributions is assumed. The assurance prior is specified in terms of the prior weight, mean, and variance for each component of the mixture. For simplicity, we assume mixture of two normal distributions as follows:
- Weight: 25% on
- Weight: 75% on
R Integration
In order to evaluate the design above, one can develop an R function for analysis that can be called from East during simulation. By replacing only the analysis function with an R function, one can obtain the frequentist operating characteristics of the Bayesian design using East. In addition, by replacing how the patient data is simulated one can obtain the Bayesian assurance. Specifically, in the simulation when the patient data is simulated an R function will first sample the assurance prior then sample the patient data. The resulting power of this simulation will be the Bayesian assurance assuming the 2 component prior given above.
There is often a need for examination of posterior distribution of both observed and true treatment differences given a Go decision. These posterior distributions can be useful for planning the next phase of study and understanding potential risks. Obtaining the posterior distributions is described in the next section and they are applied to the phase 2 followed by phase 3 in later sections.
Required R Functions
The two functions that are needed to evaluate this design and obtain the Bayesian assurance are the analysis function, AnayzeUsingBayesianNormals, and patient simulation function, SimulatePatientOutcomeNormalAssurance.
To help understand the AnayzeUsingBayesianNormals one must first derive the posterior distributions.
After observing patients on treatment S or E, the posterior distribution of is:
where
Integration with East
Using the East workbook named Assurance.cywx with East version 6.5.4 the Example 1 simulation can be used to obtain the results found in the next section. After editing the simulation, on the User Define R Functions the Generate Response and Compute Test Statistic are both replaced with R code. The Generate Response utilizes the SimulatePatientOutcomeNormalAssurance found in the file named R/SimulatePatientOutcomeNormalAssurance.R and has variables as shown below. For the Compute Test Statistic the function name AnalyzeUsingBayesianNormals found in R/AnalyzeUsingBayesianNormals.R with input shown below.


Integration with East Horizon Explore
The setup in East Horizon Explore is very similar to East. East Horizon Explore utilizes the same R functions. In the Responses tab, the Generate Response utilizes the SimulatePatientOutcomeNormalAssurance found in the file named R/SimulatePatientOutcomeNormalAssurance.R and has variables as shown below. For the Compute Test Statistic the function name AnalyzeUsingBayesianNormals found in R/AnalyzeUsingBayesianNormals.R with input shown below.


Example 2
Study Design
Same study design as previous example, however, this design includes an interim analysis to check for futility when 50% of the patients have their outcome observed. The futility rule is based on a Bayesian predictive probability of a No-Go at the end of the study. That is, at the interim analysis if it is likely that the study will make a No-Go decision at the final analysis, then the study is stopped early for futility.
Denote the data at the interim analysis by and data for patients enrolled after the IA by . If the predictive probability of a No-Go at the final analysis is greater than % then the trial is stopped for futility. Specifically, if then the trial is stopped for futility. The prediction formula becomes:
R Integration
In order to evaluate the design above, one can develop an R function for analysis that can be called from East during simulation. By replacing only the analysis function with an R function, one can obtain the frequentist operating characteristics of the Bayesian design using East that includes the interim analysis and futility check based on a Bayesian predictive probability. In addition, by replacing how the patient data is simulated one can obtain the Bayesian assurance. Specifically, in the simulation when the patient data is simulated an R function will first sample the assurance prior then sample the patient data. The resulting power of this simulation will be the Bayesian assurance assuming the 2 component prior given in Example 1 and including the futility check.
Results
The results of the design are as follows:
- The probability of an end of study Go is: 0.1478
- The probability of an end of study No-Go (Stop) is: 0.2656
- The probability of futility at the interim: 0.5866
- The probability of a Go conditional on not stopping at the interim: 0.357523
- The probability of a No-Go conditional on not stopping at the interim: 0.642477
The posterior mean of the true delta, , given a Go decision is: 0.992
The summary of the true delta given a Go decision is:
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.023 0.823 0.990 0.992 1.151 2.009
The scaled posterior distribution of the true delta given a Go decision is:
Example 3
Study Design
This study is a two-arm fixed sample size design with a time-to-event endpoint. Total sample size is 600 patients with 300 patients per arm. There is a single analysis when 50% of the patients have had their event observed. A hazard ratio (HR) below 1 is considered to favor the experimental arm. The analysis is assumed to be a cox proportional hazard model where a Go decision is made if the p-value 0.025.
For assurance, a bi-modal prior on the Log(HR) is used. The components of the prior are:
- Weight: 25% on
- Weight: 75% on , rescaled between -0.4 and 0.
R Integration
Required R Functions
This are 3 required R files and functions needed to evaluate this design. The first file is used to initialize the R environment and load the survival package. The second file is used to perform the analysis using a Cox model. The third required file is used to first simulate the true HR from the prior and then simulate the patient data using the sampled HR.
The initialize function InitializeSurvival is found in the file R/SimulatePatientOutcomeNormalAssurance.R. The function used for analysis is AnalyzeSurivalDataUsingCoxPH, is found in the file R/AnalyzeSurvivalDataUsingCoxPH.R The function used for simulating patient data is SimulatePatientOutcomeNormalAssurance and is found in the file R/SimulatePatientOutcomeNormalAssurance.R
Example 4 - Two Consecutive Studies and De-risking
In this section we explore computing assurance and conditional assurance for two consecutive studies. A phase 2 with normal endpoints (similar setup to Example 1) followed by a Phase 3 with a normal endpoint.
The goal is to understand how much the phase 3 trial can be de-risked by first running a phase 2 study to gather additional information. De-risking is determined by comparing the probability of a No-Go in a phase 3 if the phase 2 was skipped versus the probability of a No-Go in phase 3 if the phase 2 was first conducted and successful. Specifically, we compute the assurance of the phase 3 conditional on a Go decision in phase 2.
Study Design - Phase 2
Same priors as Example 1.
Fixed sample, with normally distributed outcomes Y.
- Sample size: 80 patients per arm
- Assume standard deviation is known:
- MAV = 0.6
Study Design - Phase 3
Fixed sample, with normally distributed outcomes Y.
- Sample size: 200 patients per arm
- Assume standard deviation is known:
- MAV = 0.6
With MAV = 0.6 and this design is equivalent to using a t-test because the critical value would be 0.6 and having a posterior probability greater than 0.5 would indicate that the estimated treatment difference is above the critical value.
Phase 2 followed by Phase 3
Using a Phase 2 design like above.
Phase 2
Fixed sample, with normally distributed outcomes Y.
- Sample size: 80 patients per arm
- Assume standard deviation is known:
- MAV = 0.6
If the Phase 2 makes a Go decision then the Phase 3 is conducted as follows:
Fixed sample, with normally distributed outcomes Y.
- Sample size: 200 patients per arm
- Assume standard deviation is known:
- MAV = 0.6
Example 5 - Two Consecutive Studies and De-risking
In this section we explore computing assurance and conditional assurance for two consecutive studies. A phase 2 with normal endpoints (similar setup to Example 1) followed by a Phase 3 with a time-to-event endpoint.
Study Design Phase 2
Same priors as Example 1.
Fixed sample, with normally distributed outcomes Y.
- Sample size: 80 patients per arm
- Assume standard deviation is known:
- MAV = 0.6
Study Design Phase 3
This study is a two-arm fixed sample size design with a time-to-event endpoint. Total sample size is 600 patients with 300 patients per arm. There is a single analysis when 50% of the patients have had their event observed. A hazard ratio (HR) below 1 is considered to favor the experimental arm. The analysis is assumed to be a cox proportional hazard model where a Go decision is made if the p-value 0.025.
The relationship between the continuous endpoint in phase 2 and the time-to-event endpoint in phase 3 is assumed to follow a linear function:
Note that the relationship is established on the true treatment effects. Since the phase 2 provides a prior on the true treatment different and we have the linear link function between the true treatment difference and the true HR, we do not need to specify the prior on the true HR like in Example 3.
East-R Integration
For this example, in the East workbook Example 5 - Phase 2 is used to simulate the phase 2 and Example 5 - Phase 3 is used to simulate the phase 3 for both the conditional and unconditional assurance calculations. When the phase 2 is simulated, the true treatment different is sampled from the prior is saved in the output file from phase 2. Both the conditional and unconditional phase 3 use an R initialize function to read in the output from the phase 2 and obtain the true treatment difference which is then converted to the log of the true HR given the link function above. Note, for the unconditional assurance an alternative approach would be to sample the phase 2 prior directly rather then read the output from phase 2. However, reading the true values in from the phase 2 creates a more consistent comparison between the conditional and unconditional assurance calculations and a more accurate estimate of the benefit of running the phase 2 prior to the phase 3.
Required R Function
For the phase 2, the same functions are needed as Example 2.
The two functions that are needed to evaluate this design and obtain the Bayesian assurance are the analysis function, AnayzeUsingBayesianNormals, and patient simulation function, SimulatePatientOutcomeNormalAssurance.
For the phase 3, three functions are needed: 1) ReadExample5Phase2Output, 2) AnalyzeSurvivalDataUsingCoxPh, and 3) SimulatePatientSurvivalAssuranceUsingPh2Pior and the functions are located in the R directory in the file with the matching file name. The ReadExample5Phase2Output is called from the Initialize R Environment in East and loads the survival package as it is needed for the coxph function and also reads in the true treatment difference from phase 2. Note the use of the <<- operator to create a global variables vPrior, the vector with the treatment difference, and nSimIndex to keep track of which simulation index or replication the simulation is executing when the call to SimulatePatientSurvivalAssuranceUsingPh2Pior is executed. Both vPrior and nSimIndex are utilized in the function SimulatePatientSurvivalAssuranceUsingPh2Pior and the nSimIndex variable is updated with each call.
The function ReadExample5Phase2Output utilizes the UserParam variables from East and if UserParam$bConditionalOnGo is 1, then only the true treatment effects that resulted in a Go decision in Phase 2 are retained allowing the simulation to compute the conditional assurance. Note that the number of replications used in simulating the phase 3 for conditional assurance must be less than or equal to the number of simulated phase 2 trials that were successful. If UserParam$bConditionalOnGo is 0 then all true treatment effects sampled in the Phase 2 are retained allowing the simulation to compute the unconditional assurance.
Results Phase 3, No Phase 2 Conducted
For Phase 3, the unconditional probability of a Go decision is 29% and the unconditional probability of a No-Go Decision is 71%. The 95% posterior credible for the Log( True HR ) is (-, 0.12 ). The posterior distribution of the true Log( HR ) given a Go decision is:
Results Phase 3, Conditional on Phase 2 Go Decision
For Phase 3, conditional on the phase 2 making a go decision, the probability of a Go decision is 60% and the unconditional probability of a No-Go Decision is 40%. The 95% posterior credible for the Log( True HR ) is (-0.46, -0.08). The posterior distribution of the true Log( HR ) given a Phase 3 Go decision is: