Skip to contents

Creates a density plot of the posterior distribution for a specified parameter from a fitted model within a bipod object. The plot helps visualize the distribution of the parameter values after fitting the model, indicating the uncertainty in the parameter estimate. This function is particularly useful for exploring the posterior distribution of individual model parameters in Bayesian analysis.

Usage

plot_posterior(x, x_fit, par_name, color = "black")

Arguments

x

A bipod object of class bipod. It must contain a 'fit' field, which includes the fitted model results. This object should have been fitted using model selection techniques.

x_fit

The fit object within x that contains the desired parameter. It should include the fitted parameter values and associated diagnostics.

par_name

A character string specifying the name of the parameter whose posterior distribution is to be plotted. This should match one of the parameter names available in the model fit.

color

A character string specifying the color to use for the density plot. The default is 'black'. This color will be used for filling the density plot, with a specified level of transparency.

Value

A ggplot2 object representing the density plot of the specified parameter. The plot displays the posterior distribution and helps assess the uncertainty of the parameter estimate.