GibbsMH {BayesFBHborrow}R Documentation

S3 generic, calls the correct GibbsMH sampler

Description

An MCMC sampler for Bayesian borrowing with time-to-event data. We obtain a flexible baseline hazard function by making the split points random within a piecewise exponential model and using a Gaussian Markov random field prior to smooth the baseline hazards. Only calls the sampler and does not run any input checks. Best practice is to call BayesFBHborrow(), if the user is not familiar with the model at hand.

Usage

GibbsMH(
  Y,
  I,
  X,
  Y_0 = NULL,
  I_0 = NULL,
  X_0 = NULL,
  tuning_parameters,
  hyperparameters,
  lambda_hyperparameters,
  iter,
  warmup_iter,
  refresh,
  max_grid
)

Arguments

Y

data

I

event indicator

X

design matrix

Y_0

historical data, default is NULL

I_0

historical event indicator, default is NULL

X_0

historical design matrix, default is NULL

tuning_parameters

list of "cprop_beta" ("cprop_beta_0" for historical data), "alpha", "Jmax", and "pi_b".

hyperparameters

list containing the hyperparameters c("a_tau", "b_tau", "c_tau", "d_tau","type", "p_0", "a_sigma", "b_sigma"). Default is list("a_tau" = 1, "b_tau" = 1,"c_tau" = 1, "d_tau" = 0.001, "type" = "mix", "p_0" = 0.5, "a_sigma" = 2, "b_sigma" = 2, "phi" = 3)

lambda_hyperparameters

contains two hyperparameters (a_lambda and b_lambda) used for the update of lambda and lambda_0

iter

number of iterations for MCMC sampler, excluding warmup, default is 2000

warmup_iter

number of warmup iterations (burn-in) for MCMC sampler, default is 2000

refresh

number of iterations between printed screen updates, default is 500

max_grid

grid size for the smoothed baseline hazard, default is 2000

Value

depending on if the user wishes to borrow; returns a list with values after each iteration for parameters: out_fixed (J, mu, sigma2, beta), lambda, lambda_0, tau, s, as well as tuning values of the total number of accepts: lambda_move, lambda_0_move and beta_move. Also included is the out_slam which contains the shrunk estimate of the baseline hazard.

Examples

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)

[Package BayesFBHborrow version 2.0.1 Index]