Skip to contents

\(ESS = mn / (1 + 2\sum_k \rho_k)\) with Geyer's initial positive sequence truncation.

Usage

morie_effective_sample_size_bayes(chain)

Arguments

chain

matrix of draws (rows are chains) or a single vector.

Value

list with ess, efficiency, mcse, rhat, autocorr_time.

Details

Monte Carlo standard error follows the ESS, not the number of draws: a million draws with an ESS of 40 carries the precision of 40 independent ones. ESS above the draw count is legitimate and means the chain is antithetic; ESS below 100 means the summaries are dominated by Monte Carlo error.

References

Geyer, C. J. (1992). Practical Markov chain Monte Carlo. Statistical Science, 7(4), 473-483. Vehtari, A. et al. (2021). Rank-normalization, folding, and localization. Bayesian Analysis, 16(2), 667-718.

Examples

set.seed(1)
round(morie_effective_sample_size_bayes(matrix(rnorm(2000),
                                               nrow = 4))$efficiency, 2)
#> [1] 1