Type: | Package |
Title: | Bayesian Adaptive Trial |
Version: | 0.1.0 |
Maintainer: | Yuan Zhong <aqua.zhong@gmail.com> |
Description: | Bayesian adaptive trial algorithm implements multiple-stage interim analysis. Package includes data generating function, and Bayesian hypothesis testing function. |
License: | GPL-3 |
Encoding: | UTF-8 |
RoxygenNote: | 7.2.3 |
Suggests: | knitr, rmarkdown |
VignetteBuilder: | knitr |
NeedsCompilation: | no |
Packaged: | 2025-02-04 20:11:36 UTC; adamzhong |
Author: | Yuan Zhong [aut, cre], Zeynep Baskurt [aut], Wei Xu [aut] |
Repository: | CRAN |
Date/Publication: | 2025-02-05 18:20:09 UTC |
Bayesian adaptive trial interim analysis
Description
BayesAT
conducts Bayesian adaptive trials through multiple-stage interim analysis.
Usage
BayesAT(
data,
D,
stage,
threshold,
start,
objective,
alpha,
beta,
boundary = NULL
)
Arguments
data |
Matrix. The data contains both survival time and event status. |
D |
Numerical. The duration of interim analysis, matching the length of enrollment time. |
stage |
Integer. Numbers of interim analysis stages. |
threshold |
Numerical. The value tested against hypothesis or evidence. |
start |
Numerical. The time point when the interim analysis starts. |
objective |
Numerical. The time point for predicted survival rate, for example, 2 years, or 5 years survival probability. |
alpha |
Numerical. Gamma distribution alpha parameter. |
beta |
Numerical. Gamma distribution beta parameter (rate = 1/scale). |
boundary |
The stopping criterion for interim analysis, and the default sets at 5% significance level and calculate quantiles by |
Value
Interim analysis reporting Bayesian adaptive trial results.
If there is one data set applied to BayesAT
, the result will provide a table containing:
Upper bound
can be used as stopping criterion for efficacy;
Lower bound
can be used as stopping criterion for futility;
Z score
Z statistic is calculated based on the predicted survival probability:
\frac{\hat{S} - S_0}{SD( \hat{S} )}
with predicted mean survival rate \hat{S}
and test evidence or threshold S_0
.
Efficacy Prob
and Futility Prob
Predictive probability measures the efficacy or futility, such as P(\hat{S} > \text{Efficacy})
and P(\hat{S} < \text{Futility})
.
Efficacy
and Futility
indicate the interim analysis results: +
means the trial reach the stopping criterion, otherwise it is -
.
Examples
data <- Simulate_Enroll(n = c(30,20,20,15,30), lambda = 0.03,
event = 0.1, M = 3, group = 5, maxt = 5,
accrual = 3, censor = 0.9, followup = 2,
partition = "Uneven")
## assign patients in each group analyzed at each stage of time points
IA <- BayesAT(data,D = 3,stage = 5,threshold = 0.9, start = 1.5,
objective = 2, alpha = 3, beta = 82)
summary(IA)
plot(IA)
Bayesian inference for survival analysis
Description
Bayes_test
conduct hypothesis test through Bayesian survival model
Usage
Bayes_test(data, alpha, beta, test, threshold, type, pred, diagnosis = FALSE)
Arguments
data |
Matrix. The data contains both survival time and event status. |
alpha |
Numerical. Gamma distribution alpha parameter. |
beta |
Numerical. Gamma distribution beta parameter (rate = 1/scale). |
test |
Categorical. Three types of hypothesis includes "greater", "less", or "two_sided". |
threshold |
Numerical. The value tested against hypothesis or evidence. |
type |
Categorical. The types of Bayesian inference include "Posterior" for estimation of parameters or "Predictive" for predicted survival rate. |
pred |
Numerical. The time point for predicted survival rate, for example, 2 years, or 5 years survival probability. |
diagnosis |
Logical. If |
Value
Bayesian test provide mean
, sd
, CI
, z_score
, prob
, and bf
.
mean
Posterior mean is estimated by calculating the mean of MCMC outputs.
sd
Posterior standard deviation is estimated as the standard deviation of MCMC outputs.
CI
Summary statistics provides the credible intervals and specific quantile.
z_score
Standardized test of statistics is calculated based on MCMC outputs. For example,
\frac{\hat{\lambda} - \lambda_0}{SD( \hat{\lambda} )} \text{ or } \frac{ \hat{S} - S_0}{SD( \hat{S} )},
where \hat{\lambda}
is the estimated posterior mean of hazard rate, and \hat{S}
is the predicted survival probability. Both \lambda_0
and S_0
are threshold used for test against hypothesis or evidence.
prob
Posterior probability: P(\hat{\lambda} > \lambda_0)
if test
is "greater", P(\hat{\lambda} \le \lambda_0)
if test
is "less", and 2 min( P(\hat{\lambda} > \lambda_0),P(\hat{\lambda} \le \lambda_0))
if test
is "two-sided".
bf
Bayes Factor is calculated if diagnosis = TRUE
, and the comparison model is non-informative prior, Jeffreys prior, \pi \propto 1/\lambda
.
References
Jeffreys, H. (1946). An invariant form for the prior probability in estimation problems. Proceedings of the Royal Society of London. Series A. Mathematical and Physical Sciences, 186(1007), 453-461.
Kass, R. E., & Raftery, A. E. (1995). Bayes factors. Journal of the american statistical association, 90(430), 773-795.
Examples
data <- Simulate_Enroll(n = c(50,20,20), lambda = 0.03,
event = 0.1, M = 1, group = 3,
maxt = 5, accrual = 3, censor = 0.9,
followup = 2,partition = "Uneven")
test <- Bayes_test(data, alpha = 3, beta = 82, test = "greater",
pred = 2, threshold = 0.9, type = "Predictive",
diagnosis = TRUE)
print(test)
Survival data simulation
Description
Simulate_Enroll
generates multiple streams of data sets with survival time, censoring status, and enrollment time.
Usage
Simulate_Enroll(
n,
lambda,
event,
M,
group,
maxt,
accrual,
censor,
followup,
partition = "Even"
)
Arguments
n |
Integer. Sample size of patients |
lambda |
Numerical range 0 and 1. Hazard rate of expoential distribution |
event |
Numerical range 0 and 1. Event rate |
M |
Integer. Number of trials generated for multiple streams of MCMC |
group |
Integer. Number of subgroup for patient enrollment |
maxt |
Numerical. The maximum time length of entire trial |
accrual |
Numerical. The duration of patient enrolment |
censor |
Numerical range 0 and 1. The censoring rate of patients leaving before trial ends. |
followup |
Integer. The time length of follow up. |
partition |
Logical. If |
Value
Simulated survival data contain both survival time, censoring status, and enrollment time.
Examples
data <- Simulate_Enroll(n = c(50,20,20), lambda = 0.03,
event = 0.1, M = 3, group = 3, maxt = 5,
accrual = 3, censor = 0.9, followup = 2,
partition = "Uneven")
head(data[[1]])
head(data[[2]])
head(data[[3]])