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

multiESS

Effective Sample Size of a multivariate Markov chain as described in Vats et al. (2015).


Description

Calculate the effective sample size of the Markov chain, using the multivariate dependence structure of the process.

Usage

multiESS(x, covmat = NULL, g = NULL, ...)

Arguments

x

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

covmat

optional matrix estimate obtained using mcse.multi or mcse.initseq.

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.

...

arguments for mcse.multi function. Don't use this if a suitable matrix estimate from mcse.multi or mcse.initseq is already obtained.

.

Details

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

ESS = n |Λ|^{1/p}/ |Σ|^{1/p},

where Λ is the sample covariance matrix for g and Σ is an estimate of the Monte Carlo standard error for g.

Value

The function returns the estimated effective sample size.

References

Vats, D., Flegal, J. M., and, Jones, G. L Multivariate Output Analysis for Markov chain Monte Carlo, arXiv preprint arXiv:1512.07713 (2015).

See Also

minESS, which calculates the minimum effective samples required for the problem.

ess which calculates univariate effective sample size using a Markov chain and a function g.

Examples

library(mAr)
p <- 3
n <- 1e3
omega <- 5*diag(1,p)

## Making correlation matrix var(1) model
set.seed(100)
foo <- matrix(rnorm(p^2), nrow = p)
foo <- foo %*% t(foo)
phi <- foo / (max(eigen(foo)$values) + 1)
  
out <- as.matrix(mAr.sim(rep(0,p), phi, omega, N = n))

multiESS(out)

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.