plot_trace {BayesFBHborrow} | R Documentation |
Plot MCMC trace
Description
Creates a trace plot of given MCMC samples.
Usage
plot_trace(
x_lim,
samples,
title = "",
xlab = "",
ylab = "",
color = "black",
linewidth = 1
)
Arguments
x_lim |
x-axis of the plot |
samples |
samples from MCMC |
title |
optional, add title to plot |
xlab |
optional, add xlabel |
ylab |
optional, add ylabel |
color |
color of the mid line, default is black |
linewidth |
thickness of the plotted line, default is 1 |
Value
a ggplot2 object
Examples
data(weibull_cc, package = "BayesFBHborrow")
# Set your tuning parameters
tuning_parameters <- list("Jmax" = 5,
"pi_b" = 0.5,
"cprop_beta" = 0.5)
# run the MCMC sampler
out <- BayesFBHborrow(weibull_cc, NULL, tuning_parameters,
initial_values = NULL,
iter = 10, warmup_iter = 1)
# Create a tarce plot of the treatment effect, beta_1
time_grid <- seq(0, max(weibull_cc$tte), length.out = 2000)
gg <- plot_trace(1:10, out$out_fixed$beta_1,
title = "Example trace plot",
xlab = "iterations", ylab = "beta_1 (treatment effect)")
[Package BayesFBHborrow version 1.0.1 Index]