ess: Univariate effective sample size (ESS) as described in Gong...

Description Usage Arguments Details Value References See Also

View source: R/mcmcse.R

Description

Estimate the effective sample size (ESS) of a Markov chain as described in Gong and Flegal (2015).

Usage

1
ess(x, g = NULL, ...)

Arguments

x

a matrix or data frame of Markov chain output. Number of rows is the Monte Carlo sample size.

g

a function that represents features of interest. g is applied to each row of x and thus g should take a vector input only. Ifcodeg is NULL, g is set to be identity, which is estimation of the mean of the target density.

...

arguments passed on to the mcse.mat function. For example method = “tukey” and size = “cuberoot” can be used.

Details

ESS is the size of an iid sample with the same variance as the current sample for estimating the expectation of g. ESS is given by

ESS = n \frac{λ^{2}}{σ^{2}}

where λ^{2} is the sample variance and σ^{2} is an estimate of the variance in the Markov chain central limit theorem. The denominator by default is a batch means estimator, but the default can be changed with the 'method' argument.

Value

The function returns the estimated effective sample size for each component of g.

References

Gong, L. and Flegal, J. M. (2015) A practical sequential stopping rule for high-dimensional Markov chain Monte Carlo, Journal of Computational and Graphical Statistics, 25, 684—700.

See Also

minESS, which calculates the minimum effective samples required for the problem. multiESS, which calculates multivariate effective sample size using a Markov chain and a function g.


mcmcse documentation built on Sept. 9, 2021, 9:06 a.m.