Rev 1938 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{autocorr}\alias{autocorr}\title{Autocorrelation function for Markov chains}\usage{autocorr(x, lags = c(0, 1, 5, 10, 50), relative=TRUE)}\arguments{\item{x}{an mcmc object}\item{lags}{a vector of lags at which to calculate the autocorrelation}\item{relative}{a logical flag. TRUE if lags are relative to the thinninginterval of the chain, or FALSE if they are absolute difference in iterationnumbers}}\description{\code{autocorr} calculates the autocorrelation function for theMarkov chain \code{mcmc.obj} at the lags given by \code{lags}.The lag values are taken to be relative to the thinning intervalif \code{relative=TRUE}.High autocorrelations within chains indicate slow mixing and, usually,slow convergence. It may be useful to thin out a chain with highautocorrelations before calculating summary statistics: a thinnedchain may contain most of the information, but take up less space inmemory. Re-running the MCMC sampler with a different parameterizationmay help to reduce autocorrelation.}\value{A vector or array containing the autocorrelations.}\author{Martyn Plummer}\seealso{\code{\link{acf}}, \code{\link{autocorr.plot}}.}\keyword{ts}