Skip to contents

Builds a bar plot of median R-hat by family, using the transformation median_Rhat - 1 on the y-axis. With this transformation, the usual convergence threshold rhat_threshold = 1.05 appears at 0.05 on the vertical axis.

Usage

plot_family_rhat_bar(
  samples,
  runtime_s,
  sampler_params = NULL,
  rhat_threshold = 1.05
)

Arguments

samples

An object containing MCMC draws (for example an mcmc.list, mcmc, data.frame, or matrix). It must be compatible with assess_performance() via as_mcmc_list().

runtime_s

Numeric scalar; total runtime in seconds for the MCMC run. It is passed to assess_performance() for consistency.

sampler_params

Optional character vector of parameter names to keep. If provided, only those parameters are used to compute family-level median R-hat. If NULL (default), all parameters in assess_performance(samples, runtime_s)$per_param are used.

rhat_threshold

Numeric convergence threshold for R-hat (default 1.05). A dashed horizontal line is drawn at rhat_threshold - 1 on the transformed scale.

Value

A ggplot2 object representing the bar plot, or NULL if no finite R-hat values are available.

Details

Families are defined by the prefix before the first "[" in the parameter name (for example "beta[1]" and "beta[2]" both map to the family "beta").