View source: R/plot_diagnostics.R
| plot_rhat | R Documentation |
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.
plot_rhat(fit, threshold = 1.01, pars = NULL)
fit |
A |
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). |
Color coding:
Green: Rhat < 1.01 (converged)
Yellow: 1.01 <= Rhat < 1.05 (borderline)
Red: Rhat >= 1.05 (not converged)
A ggplot object (if ggplot2 available) or base R plot (invisible).
plot_ess(), diagnostic_summary(), diagnostics()
# Diagnostic plots require a fitted tulpa model
# See tulpa() examples for fitting models
set.seed(123)
df <- data.frame(x = rnorm(60))
df$y <- rpois(60, exp(0.5 + 0.3 * df$x))
fit <- tulpa(y ~ x, data = df, family = "poisson", mode = "hmc",
control = list(n_iter = 500L, warmup = 250L, n_chains = 2L,
seed = 1L))
plot_rhat(fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.