ess_tail#
- cultivars.bayes.chains.ess_tail(*chains)[source]#
Tail effective sample size, for credible-interval endpoints.
A sampler that mixes well in the centre of a posterior can still mix poorly in its tails, and the bulk size cannot see it. The tail size is the smaller of the effective sample sizes of the two indicators
\[\mathbb{1}\{x_s \le q_{0.05}\}, \qquad \mathbb{1}\{x_s \le q_{0.95}\},\]where \(q_{0.05}\) and \(q_{0.95}\) are the quantiles of the pooled draws, each computed on the split chains by the same Geyer estimator as
ess_bulk(). The Monte Carlo error of a quantile is governed by the effective size of its indicator, so this is the size that says how well the endpoints of a 90% interval are determined.- Parameters:
*chains (
ArrayLike) – One or more(S,)or(S, d)chains of the same shape, withSat least eight and finite throughout.- Return type:
- Returns:
A float for
(S,)chains, else(d,); the total across chains.nanfor a quantity that never moved.- Raises:
SpecificationError – If no chain is given, or a chain is shorter than eight draws.
DimensionError – If a chain is not one- or two-dimensional, or the chains differ in shape.
NumericalError – If any draw is not finite.
See also
ess_bulk(): The size for means and medians.References
- Vehtari, A., Gelman, A., Simpson, D., Carpenter, B., & Bürkner,
P.-C. (2021). Rank-normalization, folding, and localization: An improved \(\widehat{R}\) for assessing convergence of MCMC. Bayesian Analysis, 16(2), 667-718.
Example
>>> import numpy as np >>> rng = np.random.default_rng(3) >>> float(ess_tail(rng.standard_normal(2000))) > 800 True