GibbsMH.WBorrow {BayesFBHborrow} | R Documentation |

## GibbsMH sampler, with Bayesian Borrowing

### 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

```
## S3 method for class 'WBorrow'
GibbsMH(
Y,
I,
X,
Y_0,
I_0,
X_0,
tuning_parameters = NULL,
hyperparameters = list(a_tau = 1, b_tau = 0.001, c_tau = 1, d_tau = 1, type = "mix",
p_0 = 0.8, a_sigma = 1, b_sigma = 1, phi = 3, clam_smooth = 0.8),
lambda_hyperparameters = list(a_lambda = 0.01, b_lambda = 0.01),
iter = 150L,
warmup_iter = 10L,
refresh = 0,
max_grid = 2000L
)
```

### Arguments

`Y` |
data |

`I` |
event indicator |

`X` |
design matrix |

`Y_0` |
historical data |

`I_0` |
historical event indicator |

`X_0` |
historical design matrix |

`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. Default is c(0.01, 0.01) |

`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

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 = tuning_parameters,
hyperparameters = hyper, iter = 5, warmup_iter = 1)
```

*BayesFBHborrow*version 2.0.1 Index]