Skip to contents

Plot posterior draws, analytical prior distributions, and (optionally) true values of hyperparameters in a fitted salmonIPM model.

Usage

plot_prior_posterior(object, pars = NULL, include = TRUE, true = NULL)

Arguments

object

An object of class salmonIPMfit with prior information stored in prior.info.

pars

Character vector specifying hyperparameters to plot. The default is all top-level hyperparameters, i.e. those parameters that are given priors.

include

Logical scalar defaulting to TRUE indicating whether to include or exclude the parameters given by pars. If FALSE, only entire multidimensional parameters can be excluded, rather than particular elements of them. This is most likely to be useful for excluding large correlation matrices from the plot.

true

Named list containing true hyperparameter values used to generate the pseudo-data to which object was fitted. See the pars argument to simIPM() for the structure of this list.

Value

A ggplot object. If the result is not assigned to an object, it will be automatically plotted.

Details

For each hyperparameter in pars, the posterior draws are plotted as a density histogram with the prior PDF overlaid. If true is provided, the known parameter value used to simulate the pseudo-data for the model fit is shown as a vertical line.