R: Estimate effective sample size (ESS) as described in Kass et...
ess
R Documentation
Estimate effective sample size (ESS) as described in Kass et al. (1998) and Robert and Casella (2004; p. 500).
Description
Estimate effective sample size (ESS) as described in Kass
et al. (1998) and Robert and Casella (2004; p. 500).
Usage
ess(x, imse = TRUE, verbose = FALSE)
Arguments
x
a vector of values from a Markov chain.
imse
logical. If TRUE, use an approach that
is analogous to Geyer's initial monotone positive
sequence estimator (IMSE), where correlations beyond a
certain lag are removed to reduce noise.
verbose
logical. If TRUE and imse =
TRUE, inform about the lag at which truncation occurs,
and warn if the lag is probably too small.
Details
ESS is the size of an iid sample with the same variance
as the current sample. ESS is given by
ESS = T / η,
where
η
= 1 + 2 ∑ all lag autocorrelations.
Value
The function returns the estimated effective sample size.
References
Kass, R. E., Carlin, B. P., Gelman, A., and Neal, R.
(1998) Markov chain Monte Carlo in practice: A roundtable
discussion. The American Statistician, 52,
93–100.
Robert, C. P. and Casella, G. (2004) Monte Carlo
Statistical Methods. New York: Springer.
Geyer, C. J. (1992) Practical Markov chain Monte Carlo.
Statistical Science, 7, 473–483.