Plot the posterior density.

plotPosteriorDensity(trace, prior = NULL, colour = NULL, plot = TRUE)

Arguments

trace

either a data.frame or a list of data.frame with all variables in column, as returned by mcmcMh. Accept also an mcmc, a mcmc.list object or a list of mcmc.list .

prior

a data.frame containing the prior density. It must have the three following columns:

  • theta names of the parameters

  • x value of the parameters

  • density density of the prior at x

colour

named vector of two characters and containing colour names for posterior and prior distributions. Vector names must be posterior and prior.

plot

if TRUE the plot is displayed, and returned otherwise.

See also

burnAndThin

Examples

data(mcmcEpi)
plotPosteriorDensity(mcmcEpi1)
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.