View source: R/hb_diagnostics.R
| ess | R Documentation |
Computes the rank-normalized bulk and tail effective sample size (ESS) of
Vehtari, Gelman, Simpson, Carpenter & Buerkner (2021, Bayesian
Analysis) for each column of a matrix of posterior draws. ess_bulk
measures the effective number of independent draws available for
estimating the posterior mean/median; ess_tail is the minimum of the
5th- and 95th-percentile indicator ESS, relevant for tail-quantile /
credible-interval precision. Autocovariance is computed via
fft (Geyer's initial monotone sequence estimator of
the integrated autocorrelation time).
ess(draws)
draws |
A matrix of posterior draws (rows = iterations, columns = parameters) for a single chain, or a list of such matrices (one per chain, identical dimensions). |
A numeric matrix, one row per parameter, two columns
("bulk", "tail"); NA for parameters with zero variance or a
non-finite result.
set.seed(42)
draws <- matrix(rnorm(2000), ncol = 2,
dimnames = list(NULL, c("a", "b")))
ess(draws)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.