Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ess

Univariate estimate effective sample size (ESS) as described in Gong and Felgal (2015).


Description

Estimate effective sample size (ESS) as described in Gong and Flegal (2015).

Usage

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

Arguments

x

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

...

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

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. If g is NULL, g is set to be identity, which is estimation of the mean of the target density.

Details

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

ESS = n λ^2/σ^2,

where λ^2 is the sample variance and σ^2 is an estimate of the variance in the CLT. This is by default the lugsail batch means estimator, but the default can be changed with the method argument.

Value

The function returns the estimated effective sample size.

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.

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

Monte Carlo Standard Errors for MCMC

v1.4-1
GPL (>= 2)
Authors
James M. Flegal <jflegal@ucr.edu>, John Hughes <j.hughes@ucdenver.edu>, Dootika Vats <dootika@iitk.ac.in>, and Ning Dai <daixx224@umn.edu>
Initial release
2020-01-29

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.