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.
Details
Color coding:
Green: Rhat < 1.01 (converged)
Yellow: 1.01 <= Rhat < 1.05 (borderline)
Red: Rhat >= 1.05 (not converged)
Examples
# Diagnostic plots require a fitted ratio model
# See tratio() examples for fitting models
# \donttest{
# Fit a model (slow, not run on CRAN)
set.seed(123)
n <- 50
df <- data.frame(
count = rpois(n, lambda = 8),
effort = rgamma(n, shape = 4, rate = 1),
depth = rnorm(n),
site = factor(rep(1:10, each = 5))
)
fit <- tratio(count | effort ~ depth + (1|site), data = df,
family = ratiod_poisson_gamma(),
control = list(iter = 200, warmup = 100, chains = 1))
#> Inference: Exact (Tier 1)
#> Backend: hmc
#> Reason: default (full MCMC)
#> Fitting ratio model...
#> Family: poisson_gamma
#> Observations: 50
#> Iterations: 200 (warmup: 100)
#> Running NUTS sampler...
#> Parameters: 16
#> Iterations: 200 (warmup: 100)
#> Chains: 1 (cores: 1)
# plot_rhat(fit)
# }