set.seed(123)
# Load example data and set your initial values and hyper parameters
data(weibull_cc, package = "BayesFBHborrow")
data(weibull_hist, package = "BayesFBHborrow")
# The datasets consists of 3 (2) columns named "tte", "event" and "X"
# (only for concurrent). To explicitly run the sampler, extract the samples as
# following
Y <- weibull_cc$tte
I <- weibull_cc$event
X <- matrix(weibull_cc$X_trt)
Y_0 <- weibull_hist$tte
I_0 <- weibull_hist$event
X_0 <- NULL
# Specify hyperparameters and tuning parameters
hyper <- list("a_tau" = 1,
"b_tau" = 0.001,
"c_tau" = 1,
"d_tau" = 1,
"type" = 'all',
"p_0" = 0.5,
"a_sigma" = 2,
"b_sigma" = 2,
"clam_smooth" = 0.5,
"phi" = 3)
tuning_parameters <- list("Jmax" = 5,
"pi_b" = 0.5,
"cprop_beta" = 0.5,
"alpha" = 0.4)
output <- GibbsMH(Y, I, X, Y_0, I_0, X_0,
tuning_parameters, hyper,
iter = 5, warmup_iter = 1)
Run the code above in your browser using DataLab