Learn R Programming

CLRtools (version 0.1.0)

diagnostic_bayes: Generate MCMC Diagnostic Plots for a Bayesian Model

Description

Produces a set of standard diagnostic plots to evaluate convergence and sampling efficiency for a Bayesian model fitted using rstan.

Usage

diagnostic_bayes(model, var.param)

Value

A list of four ggplot2 objects:

plot_rhat

A histogram of Rhat values (mcmc_rhat_hist).

plot_neff

A histogram of effective sample sizes (mcmc_neff_hist).

plot_trace

Trace plots of the MCMC chains for selected parameters (mcmc_trace).

plot_trank

Rank plots of the selected parameters across chains (mcmc_rank_overlay).

Arguments

model

A fitted Bayesian model object created with rstan::stan().

var.param

A character vector specifying the names of the model parameters (e.g., slopes or coefficients) to include in the trace and rank plots.

Details

This function uses the bayesplot package to visualize diagnostics commonly used to assess convergence and sampling performance in MCMC estimation.