File: autocorr.Rd

package info (click to toggle)
r-cran-coda 0.13-2-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 456 kB
  • sloc: makefile: 2
file content (38 lines) | stat: -rw-r--r-- 1,194 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
\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 thinning
interval of the chain, or FALSE if they are absolute difference in iteration
numbers}
}

\description{
\code{autocorr} calculates the autocorrelation function for the
Markov chain \code{mcmc.obj} at the lags given by \code{lags}.
The lag values are taken to be relative to the thinning interval
if \code{relative=TRUE}.

High autocorrelations within chains indicate slow mixing and, usually,
slow convergence. It may be useful to thin out a chain with high
autocorrelations before calculating summary statistics: a thinned
chain may contain most of the information, but take up less space in
memory. Re-running the MCMC sampler with a different parameterization
may 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}