Package overview

bayesplot-package bayesplot

bayesplot: Plotting for Bayesian Models


Functions for setting the color scheme and ggplot theme used by bayesplot. (Also see the separate ggplot helpers section below.)

color_scheme_set() color_scheme_get() color_scheme_view()

Set, get, or view bayesplot color schemes

bayesplot_theme_get() bayesplot_theme_set() bayesplot_theme_update() bayesplot_theme_replace()

Get, set, and modify the active bayesplot theme


Default bayesplot plotting theme


Functions for carrying out a wide variety of graphical model checks based on comparing observed data to draws from the posterior or prior predictive distribution.

PPC-overview PPC

Graphical posterior predictive checking

ppc_km_overlay() ppc_km_overlay_grouped()

PPC censoring

ppc_bars() ppc_bars_grouped() ppc_rootogram() ppc_bars_data()

PPCs for discrete outcomes

ppc_data() ppc_dens_overlay() ppc_dens_overlay_grouped() ppc_ecdf_overlay() ppc_ecdf_overlay_grouped() ppc_dens() ppc_hist() ppc_freqpoly() ppc_freqpoly_grouped() ppc_boxplot() ppc_violin_grouped() ppc_pit_ecdf() ppc_pit_ecdf_grouped()

PPC distributions

ppc_error_hist() ppc_error_hist_grouped() ppc_error_scatter() ppc_error_scatter_avg() ppc_error_scatter_avg_grouped() ppc_error_scatter_avg_vs_x() ppc_error_binned() ppc_error_data()

PPC errors

ppc_intervals() ppc_intervals_grouped() ppc_ribbon() ppc_ribbon_grouped() ppc_intervals_data() ppc_ribbon_data()

PPC intervals

ppc_loo_pit_overlay() ppc_loo_pit_data() ppc_loo_pit_qq() ppc_loo_pit() ppc_loo_intervals() ppc_loo_ribbon()

LOO predictive checks

ppc_scatter() ppc_scatter_avg() ppc_scatter_avg_grouped() ppc_scatter_data() ppc_scatter_avg_data()

PPC scatterplots

ppc_stat() ppc_stat_grouped() ppc_stat_freqpoly() ppc_stat_freqpoly_grouped() ppc_stat_2d() ppc_stat_data()

PPC test statistics


Posterior (or prior) predictive checks (S3 generic and default method)


Functions for creating graphical displays of simulated data from the posterior or prior predictive distribution (PPD). These plots are essentially the same as the corresponding PPC plots but without comparing to any observed data.

PPD-overview PPD

Plots of posterior or prior predictive distributions

ppd_data() ppd_dens_overlay() ppd_ecdf_overlay() ppd_dens() ppd_hist() ppd_freqpoly() ppd_freqpoly_grouped() ppd_boxplot()

PPD distributions

ppd_intervals() ppd_intervals_grouped() ppd_ribbon() ppd_ribbon_grouped() ppd_intervals_data() ppd_ribbon_data()

PPD intervals

ppd_stat() ppd_stat_grouped() ppd_stat_freqpoly() ppd_stat_freqpoly_grouped() ppd_stat_2d() ppd_stat_data()

PPD test statistics


Functions for creating plots of MCMC draws of model parameters and general MCMC diagnostics.

MCMC-overview MCMC

Plots for Markov chain Monte Carlo simulations

mcmc_rhat() mcmc_rhat_hist() mcmc_rhat_data() mcmc_neff() mcmc_neff_hist() mcmc_neff_data() mcmc_acf() mcmc_acf_bar()

General MCMC diagnostics

mcmc_hist() mcmc_dens() mcmc_hist_by_chain() mcmc_dens_overlay() mcmc_dens_chains() mcmc_dens_chains_data() mcmc_violin()

Histograms and kernel density plots of MCMC draws

mcmc_intervals() mcmc_areas() mcmc_areas_ridges() mcmc_intervals_data() mcmc_areas_data() mcmc_areas_ridges_data()

Plot interval estimates from MCMC draws

mcmc_recover_intervals() mcmc_recover_scatter() mcmc_recover_hist()

Compare MCMC estimates to "true" parameter values

mcmc_scatter() mcmc_hex() mcmc_pairs() scatter_style_np() pairs_style_np() pairs_condition()

Scatterplots of MCMC draws

mcmc_parcoord() mcmc_parcoord_data() parcoord_style_np()

Parallel coordinates plot of MCMC draws

mcmc_trace() mcmc_trace_highlight() trace_style_np() mcmc_rank_overlay() mcmc_rank_hist() mcmc_rank_ecdf() mcmc_trace_data()

Trace and rank plots of MCMC draws


Combination plots

HMC/NUTS diagnostics

Functions for plotting diagnostics specific to Hamiltonian Monte Carlo (HMC) and the No-U-Turn Sampler (NUTS). Some of the general MCMC plotting functions (mcmc_parcoord(), mcmc_pairs(), mcmc_scatter(), mcmc_trace()) can also show HMC/NUTS diagnostic information if optional arguments are specified, but the special functions below are only intended for use with HMC/NUTS.

mcmc_nuts_acceptance() mcmc_nuts_divergence() mcmc_nuts_stepsize() mcmc_nuts_treedepth() mcmc_nuts_energy()

Diagnostic plots for the No-U-Turn-Sampler (NUTS)

Tidy parameter selection for MCMC plots

Helper functions for tidy parameter selection and examples of using bayesplot with dplyr.

param_range() param_glue()

Tidy parameter selection

ggplot helpers

Convenience functions for arranging multiple plots, adding features to plots, and shortcuts for modifying individual ggplot theme elements.


Arrange plots in a grid

vline_at() hline_at() vline_0() hline_0() abline_01() lbub() legend_move() legend_none() legend_text() xaxis_title() xaxis_text() xaxis_ticks() yaxis_title() yaxis_text() yaxis_ticks() facet_text() facet_bg() panel_bg() plot_bg() grid_lines() overlay_function()

Convenience functions for adding or changing plot details


Functions extracting various quantities needed for plotting from different types of fitted model objects.

log_posterior() nuts_params() rhat() neff_ratio()

Extract quantities needed for plotting from model objects


Functions for generating data for examples and listing available plotting functions.

example_mcmc_draws() example_yrep_draws() example_y_data() example_x_data() example_group_data()

Example draws to use in demonstrations and tests

available_ppc() available_ppd() available_mcmc()

Get or view the names of available plotting or data functions