Given a sample from a multivariate posterior distribution, plot the bivariate region of highest marginal posterior density (HPD) for two variables with defined levels.

plotHPDregion2D(
  trace,
  vars,
  prob = c(0.95, 0.75, 0.5, 0.25, 0.1),
  xlab = NULL,
  ylab = NULL,
  plot = TRUE
)

Arguments

trace

either a data.frame or mcmc object.

vars

which variables to plot: numeric or character vector

prob

probability level

xlab

x axis label

ylab

y axis label

plot

if TRUE the plot is displayed, and returned otherwise.

Note

HPD levels are computed using the function HPDregionplot from the package emdbook.