plot_ess: Plot effective sample size diagnostic

View source: R/plot_diagnostics.R

plot_essR Documentation

Plot effective sample size diagnostic

Description

Creates a visual display of effective sample size (ESS) for all parameters, expressed as a ratio of ESS to total samples. Low ESS indicates high autocorrelation.

Usage

plot_ess(fit, type = c("bulk", "tail"), threshold = 400, pars = NULL)

Arguments

fit

A tulpa_fit object.

type

Type of ESS: "bulk" (default) or "tail".

threshold

Minimum acceptable ESS (default: 400).

pars

Character vector of parameter names to include.

Details

ESS/iter ratio interpretation:

  • Green: ESS >= threshold

  • Yellow: threshold/2 <= ESS < threshold

  • Red: ESS < threshold/2

Value

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

See Also

plot_rhat(), diagnostic_summary(), diagnostics()

Examples


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_ess(fit)
plot_ess(fit, type = "tail")



tulpa documentation built on Oct. 19, 2026, 5:09 p.m.