ar.act: Compute the autocorrelation time of a chain

Description Usage Arguments Details Value References See Also

View source: R/act.R


Computes the autocorrelation time of an MCMC chain using an AR model with order chosen by AIC.


ar.act(Y, true.mean=NULL)



A matrix or vector containing the states of a stationary Markov chain. If a matrix, each row is a single state.


A vector containing the true mean of Y. It should be either NULL or have as many elements as Y has columns. If NULL, the sample mean of Y is used.


This function fits an AR(p) model to each component of the chain with states Y using the Yule-Walker method to estimate the coefficients and AIC to estimate p. Let pi be the vector of estimated AR coefficients for column i, and let rho be the sample autocorrelation function to lag p. Then, the autocorrelation time of the component is estimated as:

tau = (1-pi^T rho)/(1-sum(pi))^2

For more discussion of this formula and its associated confidence intervals, see Thompson (2010).

The returned autocorrelation time (and associated confidence interval) are the maxima over the columns of Y.

Callers may want to remove a burn-in period from a sample before passing it to ar.act.


A list with elements:


Thompson, M. B. (2010). Graphical comparison of MCMC performance.

See Also

compare.samplers, ar.yw, CODA::effectiveSize,

SamplerCompare documentation built on May 29, 2017, 10:14 p.m.

Search within the SamplerCompare package
Search all R packages, documentation and source code