Skip to contents

This function creates posterior density plots for the hierarchical Bayesian model parameters aggregated by species complex. It uses the stanfit object and associated data generated by `run_stan()`. The plot can optionally be saved to a specified directory.

Usage

plot_density(stan_results, unlabel = FALSE, path = NULL, complex_names = NULL)

Arguments

stan_results

Named list output from `run_stan()` containing the fitted model and related data.

unlabel

Logical. If TRUE, removes labels from the plot. Default is FALSE.

complex_names

Optional character vector. Names of species complexes to include in the plot. If NULL, all are included.

plot_dir

Optional character. Directory path to save the plot image. If NULL, the plot is not saved.