Plots highest density interval (HDI) from (MCMC) samples and prints HDI in the R console. HDI is indicated by a red line. Based on John Kruschke's codes.

plot_hdi(
  sample = NULL,
  ci_prob = 0.95,
  title = NULL,
  x_lab = "Value",
  y_lab = "Density",
  font_size = NULL,
  bin_size = 30,
  ...
)

Arguments

sample

MCMC samples

ci_prob

A scalar between 0 and 1, indicating the mass within the credible interval that is to be estimated.

title

Character value containing the main title for the plot

x_lab

Character value containing the x label

y_lab

Character value containing the y label

font_size

Integer value specifying the font size to be used for the plot labels

bin_size

Integer value specifyin ghow wide the bars on the histogram should be. Defaults to 30.

...

Arguments that can be additionally supplied to geom_histogram

Value

A vector containing the limits of the HDI