Skip to contents

Creates visualizations to investigate divergent transitions. Parallel coordinates and scatter plots highlight where in parameter space divergences occur.

Usage

plot_divergences(fit, pars = NULL, type = c("parcoord", "scatter"))

Arguments

fit

A ratiod_fit object (HMC backend).

pars

Character vector of parameter names. If NULL, uses variance parameters.

type

Plot type: "parcoord" (parallel coordinates) or "scatter".

Value

A ggplot object or base R plot (invisible).

Details

Divergent transitions indicate regions of high posterior curvature that the sampler cannot efficiently explore. Common causes:

  • Very narrow funnels (hierarchical models)

  • Strong correlations

  • Multi-modality

Examples

# See plot_rhat() examples for fitting a model
# plot_divergences(fit)
# plot_divergences(fit, type = "scatter")