Title: | Bayesian Adaptive Trial |
---|---|
Description: | Bayesian adaptive trial algorithm implements multiple-stage interim analysis. Package includes data generating function, and Bayesian hypothesis testing function. |
Authors: | Yuan Zhong [aut, cre], Zeynep Baskurt [aut], Wei Xu [aut] |
Maintainer: | Yuan Zhong <[email protected]> |
License: | GPL-3 |
Version: | 0.1.0 |
Built: | 2025-02-06 06:05:30 UTC |
Source: | https://github.com/cran/BayesAT |
Bayes_test
conduct hypothesis test through Bayesian survival model
Bayes_test(data, alpha, beta, test, threshold, type, pred, diagnosis = FALSE)
Bayes_test(data, alpha, beta, test, threshold, type, pred, diagnosis = FALSE)
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 |
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,
where is the estimated posterior mean of hazard rate, and
is the predicted survival probability. Both
and
are threshold used for test against hypothesis or evidence.
prob
Posterior probability: if
test
is "greater", if
test
is "less", and if
test
is "two-sided".
bf
Bayes Factor is calculated if diagnosis = TRUE
, and the comparison model is non-informative prior, Jeffreys prior, .
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.
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)
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)
BayesAT
conducts Bayesian adaptive trials through multiple-stage interim analysis.
BayesAT( data, D, stage, threshold, start, objective, alpha, beta, boundary = NULL )
BayesAT( data, D, stage, threshold, start, objective, alpha, beta, boundary = NULL )
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 |
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:
with predicted mean survival rate and test evidence or threshold
.
Efficacy Prob
and Futility Prob
Predictive probability measures the efficacy or futility, such as and
.
Efficacy
and Futility
indicate the interim analysis results: +
means the trial reach the stopping criterion, otherwise it is -
.
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)
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)
Simulate_Enroll
generates multiple streams of data sets with survival time, censoring status, and enrollment time.
Simulate_Enroll( n, lambda, event, M, group, maxt, accrual, censor, followup, partition = "Even" )
Simulate_Enroll( n, lambda, event, M, group, maxt, accrual, censor, followup, partition = "Even" )
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 |
Simulated survival data contain both survival time, censoring status, and enrollment time.
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]])
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]])