Skip to contents

Creates a visual display of Rhat values for all parameters, with color-coding to highlight convergence issues. Rhat values > 1.01 indicate potential convergence problems.

Usage

plot_rhat(fit, threshold = 1.01, pars = NULL)

Arguments

fit

A ratiod_fit object.

threshold

Rhat threshold for warnings (default: 1.01).

pars

Character vector of parameter names to include. If NULL (default), includes all main parameters (excludes high-dimensional RE/spatial).

Value

A ggplot object (if ggplot2 available) or base R plot (invisible).

Details

Color coding:

  • Green: Rhat < 1.01 (converged)

  • Yellow: 1.01 <= Rhat < 1.05 (borderline)

  • Red: Rhat >= 1.05 (not converged)

Examples

# \donttest{
sim <- sim_ratiod(n = 100, family = ratiod_poisson_gamma(), seed = 1)
fit <- tratio(y_num | y_denom ~ x1 + (1 | group), data = sim$data,
              family = ratiod_poisson_gamma(),
              control = list(iter = 1000, chains = 2, seed = 1))
plot_rhat(fit)

# }