2 Arm Binary Outcome Patient Simulation
J. Kyle Wathen
September 26, 2024
2ArmBinaryOutcomePatientSimulation.Rmd
Two Arm, Binary Outcome - Patient Outcome Simulation Examples
The following examples demonstrate how to add new patient outcome simulation capabilities into East using an R function in the context of a two-arm trial with a binary patient outcome. For all examples, we assume the trial design consists of standard of care and an experimental treatment and the trial design assumes patient outcomes binary.
Once CyneRgy is installed, you can load this example in R Studio with the following commands:
CyneRgy::RunExample( "2ArmBinaryOutcomePatientSimulation" )
Running the command above will load the R Studio project in R Studio.
East Workbook: 2ArmBinaryOutcomePatientSimulation.cywx
R Studio Project File: 2ArmBinaryOutcomePatientSimulation.Rproj.
In the RCode directory of this example you will find the following R files:
SimulatePatientOutcomePercentAtZero.Binary.R - This file provides an example R function to simulate patient data from a mixture distribution where a proportion of patients do not respond to treatment. The code in Example 1 can be used when the proportion of patients that don’t respond to treatment is a fixed value.
SimulatePatientOutcomePercentAtZeroBetaDist.Binary.R - This file provides an example R function to simulate patient data from a mixture distribution where a proportion of patients do not respond to treatment. This approach assumes that the percentage of patients that do not respond to treatment is unknown and must first be drawn from a Beta distribution.
Example 1 - Simulate Binary Data from a Mixture Distribution
In this example, the patient outcome is binary where a value of 0 represent a treatment failure, eg non-response, and a value of 1 is a response. However, there is an unknown proportion of patients that are treatment resistant and will not respond to treatment, and thus, have an outcome of 0. Using historical data, it is estimated that the proportion of patients that will not respond to treatment is between 20% and 40%. In this example, an R function is provided to help explore the proportion of patients that are treatment resistant and the impact on expected study power. The function used for this example is SimulatePatientOutcomePercentAtZero.Binary and can be found in RCode/SimulatePatientOutcomePercentAtZero.Binary.R. The required User Specified parameters are the probability a patient is a non-responder for each arm, specifically, dProbOfTreatmentReistantCtrl and dProbOfTreatmentReistantExp.
For these examples, a binomial distribution is utilized to simulate if the patient is treatment resistant. If the patient is not treatment resistant, then their outcome is simulated from a binomial distribution with the response in East and sent to R. In the East workbook - Example 1
Prob(0) = 0, Assume that no patients are treatment resistant.
Prob(0) = 0.2, assumes 20% of patients are treatment resistant.
Prob(0) = 0.4, assumes 40% of patients are treatment resistant.
Example 2 - Simulation of Patient Data from a Mixture Distribution with Mixture Percent Sampled from a Beta Distribution
Similar to example 1, in this function, the patient outcome is binary where a value of 0 represent a treatment failure, eg non-response, and a value of 1 is a response. However, there is an unknown proportion of patients that are treatment resistant and will not respond to treatment, and thus, have an outcome of 0.This function assumes that the probability that a patient is treatment resistant is random and follows a Beta distribution. The intent of this option is to incorporate the variability in the unknown probability that a patient is treatment resistant. In addition, the provided function allows for a different Beta distribution for each treatment, which may be used to understand how a treatment that reduces the likelihood of a treatment failure would perform in the trial. The function used for this example is SimulatePatientOutcomePercentAtZeroBetaDist.Binary and can be found in RCode/SimulatePatientOutcomePercentAtZeroBetaDist.Binary.R. The required user Specified parameters are the prior parameters for each treatment, specifically, 1) dCtrlBetaParam1, 2) dCtrlBetaParam2, 3) dExpBetaParam1, 4) dExpBetaParam2.
For these examples, a beta distribution is utilized to simulate if the patient is treatment resistant. If the patient is not treatment resistant, then their outcome is simulated from a binomial distribution with the response in East and sent to R.
Example 2.1 For this example, independent Beta( 23.1, 55.2 ) are utilized, which have a 95% credible interval of (0.2, 0.4). This function first simulates the probability of no response from the Beta distribution for control and experimental arms, then uses the simulated probability to simulate the proportion of patients with a null response. In this example, it is assumed that the two probabilities are sampled from the same distribution but are not identical in a given simulation. The R code could easily be adapted to accomplish this. In East, you will need to add variables that are sent to R.
Example 2.2 - For this example, the treatment reduces the probability of null response by 10%, on average, when compared to control. In particular, assume the probability of null response follows a Beta( 23.1, 55.2 ) which has a 95% credible interval of (0.2, 0.4). For experimental treatment assume the probability of treatment failure follows a Beta ( 10.8, 46.3 ) which has a 95% credible interval of (0.1, 0.3). In East, you will need to add variables that are sent to R.