Bayes_test {BayesAT} | R Documentation |
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)