View source: R/bayesian_cure_rate_model.R
plot.bayesCureModel | R Documentation |
Plots and computes HDIs.
## S3 method for class 'bayesCureModel'
plot(x, burn = NULL, alpha = 0.05, gamma_mix = TRUE,
K_gamma = 5, plot_graphs = TRUE, bw = "nrd0", what = NULL, predict_output = NULL,
index_of_main_mode = NULL, draw_legend = TRUE,...)
x |
An object of class |
burn |
Number of iterations to discard as burn-in period. |
alpha |
A value between 0 and 1 in order to compute the 1- |
gamma_mix |
Boolean. If TRUE, the density of the marginal posterior distribution of the |
K_gamma |
Used only when |
plot_graphs |
Boolean, if FALSE only HDIs are computed. |
bw |
bandwidth |
what |
Integer or a character string with possible values equal to |
predict_output |
Optional argument which is required only when |
index_of_main_mode |
If NULL (default), the whole MCMC output is used for plotting. Otherwise, it is a subset of the retained MCMC iterations in order to identify the main mode of the posterior distribution, as returned by the |
draw_legend |
Boolean. If TRUE (default), a legend is plotted in the case where |
... |
arguments passed by other methods. |
The function plots graphic output on the plot device if plot_graphs = TRUE
. Furthermore, a list of 100(1-\alpha)\%
Highest Density Intervals per parameter is returned.
Panagiotis Papastamoulis
# simulate toy data just for cran-check purposes
set.seed(10)
n = 4
# censoring indicators
stat = rbinom(n, size = 1, prob = 0.5)
# covariates
x <- matrix(rnorm(2*n), n, 2)
# observed response variable
y <- rexp(n)
# define a data frame with the response and the covariates
my_data_frame <- data.frame(y, stat, x1 = x[,1], x2 = x[,2])
# run a weibull model with default prior setup
# considering 2 heated chains
fit1 <- cure_rate_MC3(survival::Surv(y, stat) ~ x1 + x2, data = my_data_frame,
promotion_time = list(distribution = 'exponential'),
nChains = 2,
nCores = 1,
mcmc_cycles = 3, sweep=2)
mySummary <- summary(fit1, burn = 0)
# plot the marginal posterior distribution of the first parameter in returned mcmc output
plot(fit1, what = 1, burn = 0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.