Title: | Properties of Bayesian Early Gating Designs |
---|---|
Description: | Computes the most important properties of four 'Bayesian' early gating designs (two single arm and two randomized controlled designs), such as minimum required number of successes in the experimental group to make a GO decision, operating characteristics and average operating characteristics with respect to the sample size. These might aid in deciding what design to use for the early phase trial. |
Authors: | Elias Laurin Meyer [aut, cre] |
Maintainer: | Elias Laurin Meyer <[email protected]> |
License: | GPL-3 |
Version: | 1.1 |
Built: | 2025-02-12 04:25:34 UTC |
Source: | https://github.com/el-meyer/earlygating |
Function for calculating the average operating characteristics of two single arm bayesian designs for early gating with respect to the sample size in the experimental group and possible historical data.
avg_oc_wr_ne( N_e, true_RR_c = NULL, delta, delta_power, confidence, e_a = 0.5, e_b = 0.5, h_a = 0.5, h_b = 0.5, RR_h = NULL, N_h = NULL, hist_RR_c = NULL, alpha_c, beta_c, trues = seq(0, 1, 0.001), adapt = 1, plot = T, coresnum = NULL, legend = T, legend.pos = "topleft" )
avg_oc_wr_ne( N_e, true_RR_c = NULL, delta, delta_power, confidence, e_a = 0.5, e_b = 0.5, h_a = 0.5, h_b = 0.5, RR_h = NULL, N_h = NULL, hist_RR_c = NULL, alpha_c, beta_c, trues = seq(0, 1, 0.001), adapt = 1, plot = T, coresnum = NULL, legend = T, legend.pos = "topleft" )
N_e |
Sample Size in the experimental group. Can be either a single value or a vector. |
true_RR_c |
Default value is NULL. If specified, will be used in the generated plots, indicating the true achieved decision power and decision type 1 error. If not specified, will be set to either RR_h or hist_RR_c, depending on which was specified by the user. |
delta |
Required superiority to make a "GO" decision. Corresponds to |
delta_power |
Superiority, at which decision power will be evaluated.
Corresponds to |
confidence |
Required confidence to make "GO" decision. Corresponds to |
e_a |
Alpha parameter of Beta Prior Distribution for the experimental response rate.
Corresponds to |
e_b |
Beta parameter of Beta Prior Distribution for the experimental response rate.
Corresponds to |
h_a |
Alpha parameter of Beta Prior Distribution for the historical control response rate.
Corresponds to |
h_b |
Beta parameter of Beta Prior Distribution for the historical control response rate.
Corresponds to |
RR_h |
Historical control response rate. Corresponds to |
N_h |
Historical control sample size. Corresponds to |
hist_RR_c |
Point estimate of historical control repsonse rate. Corresponds to |
alpha_c |
Alpha parameter of Beta Distribution for the control response rate used to
calculate average operating characteristics. Corresponds to |
beta_c |
Beta parameter of Beta Distribution for the control response rate used to calculate
average operating characteristics. Corresponds to |
trues |
Sequence of true control response rates and experimental response rates, at which the Probability to Go will be computed. Default is seq(0,1,0.01) to ensure continuous plots and accurate results. |
adapt |
Level of adapting of experimental control rate to account for patient selection bias
from phase II to phase III. Corresponds to |
plot |
Plots yes or no. Default is TRUE. |
coresnum |
Number of cores used for parallel computing, in case N_e is a vector. Default is the number of total cores - 1. |
legend |
Logical; whether or not to include legend in plot. Default is TRUE. |
legend.pos |
Position of legend. Default is "topleft". |
Either a vector containing the average decision power and average alpha (if N_e has length 1), or a matrix containing the average decision power and average decision alpha (if N_e has length > 1), where every row corresponds to one value of N_e.
# Setting 1 avg_oc_wr_ne( N_e = 50, delta = 0.08, delta_power = 0.13, confidence = 0.6, hist_RR_c = 0.5, alpha_c = 15, beta_c = 13 ) # Setting 2 avg_oc_wr_ne( N_e = 50, delta = 0.08, delta_power = 0.13, confidence = 0.6, RR_h = 0.5, N_h = 50, alpha_c = 15, beta_c = 13 )
# Setting 1 avg_oc_wr_ne( N_e = 50, delta = 0.08, delta_power = 0.13, confidence = 0.6, hist_RR_c = 0.5, alpha_c = 15, beta_c = 13 ) # Setting 2 avg_oc_wr_ne( N_e = 50, delta = 0.08, delta_power = 0.13, confidence = 0.6, RR_h = 0.5, N_h = 50, alpha_c = 15, beta_c = 13 )
Function for calculating the average operating characteristics of two RCT bayesian designs for early gating with respect to the sample size in the experimental group, the sample size in the control group and possible historical data.
avg_oc_wr_ne_rct( N_c, N_e, delta, delta_power, confidence, e_a = 0.5, e_b = 0.5, c_a = 0.5, c_b = 0.5, h_a = 0.5, h_b = 0.5, N_h = NULL, RR_h = NULL, w = NULL, alpha_c, beta_c, trues = seq(0, 1, 0.01), plot = T, coresnum = NULL, legend = T, legend.pos = "topleft" )
avg_oc_wr_ne_rct( N_c, N_e, delta, delta_power, confidence, e_a = 0.5, e_b = 0.5, c_a = 0.5, c_b = 0.5, h_a = 0.5, h_b = 0.5, N_h = NULL, RR_h = NULL, w = NULL, alpha_c, beta_c, trues = seq(0, 1, 0.01), plot = T, coresnum = NULL, legend = T, legend.pos = "topleft" )
N_c |
Sample Size in the control group. Can be either a single value or a vector, but needs to be the same length as N_e. |
N_e |
Sample Size in the experimental group. Can be either a single value or a vector, but needs to be the same length as N_c. |
delta |
Required superiority to make a "GO" decision. Corresponds to |
delta_power |
Superiority, at which decision power will be evaluated.
Corresponds to |
confidence |
Required confidence to make "GO" decision. Corresponds to |
e_a |
Alpha parameter of Beta Prior Distribution for the experimental response rate.
Corresponds to |
e_b |
Beta parameter of Beta Prior Distribution for the experimental response rate.
Corresponds to |
c_a |
Alpha parameter of Beta Prior Distribution for the control response rate.
Corresponds to |
c_b |
Beta parameter of Beta Prior Distribution for the control response rate.
Corresponds to |
h_a |
Alpha parameter of Beta Prior Distribution for the historical control response rate.
Corresponds to |
h_b |
Beta parameter of Beta Prior Distribution for the historical control response rate.
Corresponds to |
N_h |
Historical control sample size. Corresponds to |
RR_h |
Historical control response rate. Corresponds to |
w |
Level of dynmaic borrowing. Corresponds to |
alpha_c |
Alpha parameter of Beta Distribution for the control response rate used to
calculate average operating characteristics. Corresponds to |
beta_c |
Beta parameter of Beta Distribution for the control response rate used to calculate
average operating characteristics. Corresponds to |
trues |
Sequence of true control response rates and experimental response rates, at which the Probability to Go will be computed. Default is seq(0,1,0.01) to ensure continuous plots and accurate results. |
plot |
Plots yes or no. Default is TRUE. |
coresnum |
Number of cores used for parallel computing, in case N_e is a vector. Default is the number of total cores - 1. |
legend |
Logical; whether or not to include legend in plot. Default is TRUE. |
legend.pos |
Position of legend. Default is "topleft". |
Either a vector containing the average decision power and average alpha (if N_e has length 1) or a matrix containing the average decision power and average decision alpha (if N_e has length > 1), where every row corresponds to one value of N_e.
# Setting 3 avg_oc_wr_ne_rct( N_c = 25, N_e = 25, delta = 0.08, delta_power = 0.13, confidence = 0.6, alpha_c = 15, beta_c = 13 ) # Setting 4 avg_oc_wr_ne_rct( N_c = 25, N_e = 25, delta = 0.08, delta_power = 0.13, confidence = 0.6, alpha_c = 15, beta_c = 13, RR_h = 0.5, N_h = 100, w = 0.3 )
# Setting 3 avg_oc_wr_ne_rct( N_c = 25, N_e = 25, delta = 0.08, delta_power = 0.13, confidence = 0.6, alpha_c = 15, beta_c = 13 ) # Setting 4 avg_oc_wr_ne_rct( N_c = 25, N_e = 25, delta = 0.08, delta_power = 0.13, confidence = 0.6, alpha_c = 15, beta_c = 13, RR_h = 0.5, N_h = 100, w = 0.3 )
Function for calculating the average operating characteristics of a single arm Bayesian designs for early gating with respect to the historic target.
avg_oc_wr_ph( N_e, delta, delta_power, confidence, e_a = 0.5, e_b = 0.5, alpha_c, beta_c, trues = seq(0, 1, 0.01), adapt = 1, plot = T, legend = T, legend.pos = "topleft" )
avg_oc_wr_ph( N_e, delta, delta_power, confidence, e_a = 0.5, e_b = 0.5, alpha_c, beta_c, trues = seq(0, 1, 0.01), adapt = 1, plot = T, legend = T, legend.pos = "topleft" )
N_e |
Sample Size in the experimental group. Can be either a single value or a vector. |
delta |
Required superiority to make a "GO" decision. Corresponds to |
delta_power |
Superiority, at which decision power will be evaluated.
Corresponds to |
confidence |
Required confidence to make "GO" decision. Corresponds to |
e_a |
Alpha parameter of Beta Prior Distribution for the experimental response rate.
Corresponds to |
e_b |
Beta parameter of Beta Prior Distribution for the experimental response rate.
Corresponds to |
alpha_c |
Alpha parameter of Beta Distribution for the control response rate used to
calculate average operating characteristics. Corresponds to |
beta_c |
Beta parameter of Beta Distribution for the control response rate used to calculate
average operating characteristics. Corresponds to |
trues |
Sequence of true control response rates and experimental response rates, at which the Probability to Go will be computed. Default is seq(0,1,0.01) to ensure continuous plots and accurate results. |
adapt |
Level of adapting of experimental control rate to account for patient selection bias
from phase II to phase III. Corresponds to |
plot |
Plots yes or no. Default is TRUE. |
legend |
Logical; whether or not to include legend in plot. Default is TRUE. |
legend.pos |
Position of legend. Default is "topleft". |
A matrix containing information about the decision power and the decision alpha with respect to p_h.
avg_oc_wr_ph( N_e = 50, delta = 0.08, delta_power = 0.13, confidence = 0.6, alpha_c = 15, beta_c = 13 )
avg_oc_wr_ph( N_e = 50, delta = 0.08, delta_power = 0.13, confidence = 0.6, alpha_c = 15, beta_c = 13 )
Function for calculating the parameters of the beta distribution used to average the operating characteristics, given historical data.
beta_par( mu_cov, phi_cov = NULL, orr, data, newdata, link = NULL, weights = NULL, plot = T )
beta_par( mu_cov, phi_cov = NULL, orr, data, newdata, link = NULL, weights = NULL, plot = T )
mu_cov |
A character vector containing the names of covariates in data
that should be used to model the parameter |
phi_cov |
A character vector containing the names of covariates in data that
should be used to model the parameter |
orr |
Character containing the name of the variable in data that represents the objective response rate. |
data |
Data frame containing all the covariates and the ORR. |
newdata |
Data frame containing a single value for each of the specified covariates that will be used to estimate the parameters of the Beta distribution. |
link |
Link function for |
weights |
Weights that should be used for regression. Default is NULL, so no weights. |
plot |
Plots yes or no. Default is TRUE. |
mu_cov <- c("date", "Phase") orr <- "ORR" newdata <- data.frame( "date" = 2017, "Phase" = factor(3) ) studs <- data.frame( "ORR"= c(0.693, 0.580, 0.693, 0.477, 0.609, 0.727, 0.727, 0.591, 0.362, 0.593, 0.792, 0.620, 0.550, 0.690, 0.776), "date" = c(2011, 2008.5, 2009, 1996, 2001, 2003.5, 2002.5, 2008, 2000, 2006, 2005, 2007.5, 2009.5, 2010.5, 2010), "Phase" = factor(c(3, 2, 3, 3, 2, 2, 3, 3, 3, 3, 2, 3, 3, 3, 2)), "N" = c(293, 69, 336, 235, 92, 110, 131, 208, 94, 123, 53, 182, 267, 239, 237) ) beta_par( mu_cov = mu_cov, orr = orr, data = studs, newdata = newdata, weights = studs$N/mean(studs$N) )
mu_cov <- c("date", "Phase") orr <- "ORR" newdata <- data.frame( "date" = 2017, "Phase" = factor(3) ) studs <- data.frame( "ORR"= c(0.693, 0.580, 0.693, 0.477, 0.609, 0.727, 0.727, 0.591, 0.362, 0.593, 0.792, 0.620, 0.550, 0.690, 0.776), "date" = c(2011, 2008.5, 2009, 1996, 2001, 2003.5, 2002.5, 2008, 2000, 2006, 2005, 2007.5, 2009.5, 2010.5, 2010), "Phase" = factor(c(3, 2, 3, 3, 2, 2, 3, 3, 3, 3, 2, 3, 3, 3, 2)), "N" = c(293, 69, 336, 235, 92, 110, 131, 208, 94, 123, 53, 182, 267, 239, 237) ) beta_par( mu_cov = mu_cov, orr = orr, data = studs, newdata = newdata, weights = studs$N/mean(studs$N) )
Function for calculating the operating characteristics of the single arm Bayesian designs in setting 1 and 2 for early gating.
oc( N_e, delta, delta_power, confidence, e_a = 0.5, e_b = 0.5, h_a = 0.5, h_b = 0.5, RR_h = NULL, N_h = NULL, hist_RR_c = NULL, trues = seq(0, 1, 0.01), adapt = 1, plot = T, legend = T, legend.pos = "topleft" )
oc( N_e, delta, delta_power, confidence, e_a = 0.5, e_b = 0.5, h_a = 0.5, h_b = 0.5, RR_h = NULL, N_h = NULL, hist_RR_c = NULL, trues = seq(0, 1, 0.01), adapt = 1, plot = T, legend = T, legend.pos = "topleft" )
N_e |
Sample Size in the experimental group. Can be either a single value or a vector. |
delta |
Required superiority to make a "GO" decision. Corresponds to |
delta_power |
Superiority, at which decision power will be evaluated.
Corresponds to |
confidence |
Required confidence to make "GO" decision. Corresponds to |
e_a |
Alpha parameter of Beta Prior Distribution for the experimental response rate.
Corresponds to |
e_b |
Beta parameter of Beta Prior Distribution for the experimental response rate.
Corresponds to |
h_a |
Alpha parameter of Beta Prior Distribution for the historical control response rate.
Corresponds to |
h_b |
Beta parameter of Beta Prior Distribution for the historical control response rate.
Corresponds to |
RR_h |
Historical control response rate. Corresponds to |
N_h |
Historical control sample size. Corresponds to |
hist_RR_c |
Point estimate of historical control repsonse rate. Corresponds to |
trues |
Sequence of true control response rates and experimental response rates, at which the Probability to Go will be computed. Default is seq(0,1,0.01) to ensure continuous plots and accurate results. |
adapt |
Level of adapting of experimental control rate to account for patient selection bias
from phase II to phase III. Corresponds to |
plot |
Plots yes or no. Default is TRUE. |
legend |
Logical; whether or not to include legend in plot. Default is TRUE. |
legend.pos |
Position of legend. Default is "topleft". |
A matrix containing the decision power and decision alpha with respect to the true control response rate.
# Setting 1 oc( N_e = 50, delta = 0.08, delta_power = 0.13, confidence = 0.6, hist_RR_c = 0.5 ) # Setting 2 oc( N_e = 50, delta = 0.08, delta_power = 0.13, confidence = 0.6, RR_h = 0.5, N_h = 50 )
# Setting 1 oc( N_e = 50, delta = 0.08, delta_power = 0.13, confidence = 0.6, hist_RR_c = 0.5 ) # Setting 2 oc( N_e = 50, delta = 0.08, delta_power = 0.13, confidence = 0.6, RR_h = 0.5, N_h = 50 )
Function for calculating the operating characteristics of the RCT Bayesian designs in setting 3 and 4 for early gating.
oc_rct( N_c, N_e, delta, delta_power, confidence, e_a = 0.5, e_b = 0.5, c_a = 0.5, c_b = 0.5, h_a = 0.5, h_b = 0.5, RR_h = NULL, N_h = NULL, w = NULL, trues = seq(0, 1, 0.01), plot = T, legend = T, legend.pos = "topleft" )
oc_rct( N_c, N_e, delta, delta_power, confidence, e_a = 0.5, e_b = 0.5, c_a = 0.5, c_b = 0.5, h_a = 0.5, h_b = 0.5, RR_h = NULL, N_h = NULL, w = NULL, trues = seq(0, 1, 0.01), plot = T, legend = T, legend.pos = "topleft" )
N_c |
Sample Size in the control group. Can be either a single value or a vector, but needs to be the same length as N_e. |
N_e |
Sample Size in the experimental group. Can be either a single value or a vector, but needs to be the same length as N_c. |
delta |
Required superiority to make a "GO" decision. Corresponds to |
delta_power |
Superiority, at which decision power will be evaluated.
Corresponds to |
confidence |
Required confidence to make "GO" decision. Corresponds to |
e_a |
Alpha parameter of Beta Prior Distribution for the experimental response rate.
Corresponds to |
e_b |
Beta parameter of Beta Prior Distribution for the experimental response rate.
Corresponds to |
c_a |
Alpha parameter of Beta Prior Distribution for the control response rate.
Corresponds to |
c_b |
Beta parameter of Beta Prior Distribution for the control response rate.
Corresponds to |
h_a |
Alpha parameter of Beta Prior Distribution for the historical control response rate.
Corresponds to |
h_b |
Beta parameter of Beta Prior Distribution for the historical control response rate.
Corresponds to |
RR_h |
Historical control response rate. Corresponds to |
N_h |
Historical control sample size. Corresponds to |
w |
Level of dynmaic borrowing. Corresponds to |
trues |
Sequence of true control response rates and experimental response rates, at which the Probability to Go will be computed. Default is seq(0,1,0.01) to ensure continuous plots and accurate results. |
plot |
Plots yes or no. Default is TRUE. |
legend |
Logical; whether or not to include legend in plot. Default is TRUE. |
legend.pos |
Position of legend. Default is "topleft". |
A matrix containing the decision power and decision alpha with respect to the true control response rate.
# Setting 3 oc_rct( N_c = 25, N_e = 25, delta = 0.08, delta_power = 0.13, confidence = 0.6 ) # Setting 4 oc_rct( N_c = 25, N_e = 25, delta = 0.08, delta_power = 0.13, confidence = 0.6, RR_h = 0.5, N_h = 50, w = 0.3 )
# Setting 3 oc_rct( N_c = 25, N_e = 25, delta = 0.08, delta_power = 0.13, confidence = 0.6 ) # Setting 4 oc_rct( N_c = 25, N_e = 25, delta = 0.08, delta_power = 0.13, confidence = 0.6, RR_h = 0.5, N_h = 50, w = 0.3 )
Function for calculating the minimum required number of responders in the experimental group to make a GO decision in Settings 1 and 2.
req_resp( N_e, delta, confidence, e_a = 0.5, e_b = 0.5, h_a = 0.5, h_b = 0.5, RR_h = NULL, N_h = NULL, hist_RR_c = NULL, adapt = 1 )
req_resp( N_e, delta, confidence, e_a = 0.5, e_b = 0.5, h_a = 0.5, h_b = 0.5, RR_h = NULL, N_h = NULL, hist_RR_c = NULL, adapt = 1 )
N_e |
Sample Size in the experimental group. |
delta |
Required superiority to make a "GO" decision. Corresponds to |
confidence |
Required confidence to make "GO" decision. Corresponds to |
e_a |
Alpha parameter of Beta Prior Distribution for the experimental response rate.
Corresponds to |
e_b |
Beta parameter of Beta Prior Distribution for the experimental response rate.
Corresponds to |
h_a |
Alpha parameter of Beta Prior Distribution for the historical control response rate.
Corresponds to |
h_b |
Beta parameter of Beta Prior Distribution for the historical control response rate.
Corresponds to |
RR_h |
Historical control response rate. Corresponds to |
N_h |
Historical control sample size. Corresponds to |
hist_RR_c |
Point estimate of historical control repsonse rate. Corresponds to |
adapt |
Level of adapting of experimental control rate to account for patient selection bias
from phase II to phase III. Corresponds to |
Integer.
# Setting 1 req_resp( N_e = 50, delta = 0.08, confidence = 0.6, hist_RR_c = 0.5 ) # Setting 2 req_resp( N_e = 50, delta = 0.08, confidence = 0.6, RR_h = 0.5, N_h = 50 )
# Setting 1 req_resp( N_e = 50, delta = 0.08, confidence = 0.6, hist_RR_c = 0.5 ) # Setting 2 req_resp( N_e = 50, delta = 0.08, confidence = 0.6, RR_h = 0.5, N_h = 50 )
Function for calculating the minimum required number of responders in the experimental group to make a GO decision in Settings 3 and 4.
req_resp_rct( N_c, N_e, delta, confidence, e_a = 0.5, e_b = 0.5, c_a = 0.5, c_b = 0.5, h_a = 0.5, h_b = 0.5, RR_h = NULL, N_h = NULL, w = NULL, plot = T )
req_resp_rct( N_c, N_e, delta, confidence, e_a = 0.5, e_b = 0.5, c_a = 0.5, c_b = 0.5, h_a = 0.5, h_b = 0.5, RR_h = NULL, N_h = NULL, w = NULL, plot = T )
N_c |
Sample Size in the control group. |
N_e |
Sample Size in the experimental group. |
delta |
Required superiority to make a "GO" decision. Corresponds to |
confidence |
Required confidence to make "GO" decision. Corresponds to |
e_a |
Alpha parameter of Beta Prior Distribution for the experimental response rate.
Corresponds to |
e_b |
Beta parameter of Beta Prior Distribution for the experimental response rate.
Corresponds to |
c_a |
Alpha parameter of Beta Prior Distribution for the control response rate.
Corresponds to |
c_b |
Beta parameter of Beta Prior Distribution for the control response rate.
Corresponds to |
h_a |
Alpha parameter of Beta Prior Distribution for the historical control response rate.
Corresponds to |
h_b |
Beta parameter of Beta Prior Distribution for the historical control response rate.
Corresponds to |
RR_h |
Historical control response rate. Corresponds to |
N_h |
Historical control sample size. Corresponds to |
w |
Level of dynmaic borrowing. Corresponds to |
plot |
Plots yes or no. Default is TRUE. |
Matrix containing pairs of successes in control group and respective required successes in experimental group.
# Setting 3 req_resp_rct( N_c = 25, N_e = 25, delta = 0.08, confidence = 0.6 ) # Setting 4 req_resp_rct( N_c = 25, N_e = 25, delta = 0.08, confidence = 0.6, RR_h = 0.5, N_h = 50, w = 0.3 )
# Setting 3 req_resp_rct( N_c = 25, N_e = 25, delta = 0.08, confidence = 0.6 ) # Setting 4 req_resp_rct( N_c = 25, N_e = 25, delta = 0.08, confidence = 0.6, RR_h = 0.5, N_h = 50, w = 0.3 )