plot_matrix {BayesFBHborrow} | R Documentation |
Plot smoothed baseline hazards
Description
Plot mean and given quantiles of a matrix. Can also be used to plot derivatives of the baseline hazard, such as estimated cumulative hazard and survival function.
Usage
plot_matrix(
x_lim,
y,
percentiles = c(0.05, 0.95),
title = "",
xlab = "",
ylab = "",
color = "blue",
fill = "blue",
linewidth = 1,
alpha = 0.2
)
Arguments
x_lim |
time grid |
y |
samples |
percentiles |
percentiles to include in plot, default is c(0.025, 0.975) |
title |
optional, add title to plot |
xlab |
optional, add xlabel |
ylab |
optional, add ylabel |
color |
color of the mid line, default is blue |
fill |
color of the percentiles, default is blue |
linewidth |
thickness of the plotted line, default is 1 |
alpha |
opacity of the percentiles, default is 0.2 |
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)
# Visualize the smoothed baseline hazard
time_grid <- seq(0, max(weibull_cc$tte), length.out = 2000)
gg <- plot_matrix(time_grid, out$out_slam,
title = "Example plot of smoothed baseline hazard",
xlab = "time", ylab = "baseline hazard")
[Package BayesFBHborrow version 1.0.1 Index]