Last data update: 2014.03.03
|
R: Autocorrelation Plot of MCMC Output
Autocorrelation Plot of MCMC Output
Description
Creates an autocorrelation or partial autocorrelation plot of MCMC output.
Usage
autplot1(x, chain = 1, lag.max = NULL, partial = FALSE,
col = mcmcplotsPalette(1), style = c("gray", "plain"),
ylim = NULL, ...)
Arguments
x |
an mcmc.list object with a single variable.
|
chain |
the number of the parallel chain for plotting. The default is to use the first parallel chain.
|
lag.max |
passed as an argument to the autocorrelation function acf .
|
partial |
logical indicating whether paritial autocorrelation should be plotted.
|
col |
color of the bars in the plot.
|
style |
if "gray", then the plotting region is printed with a gray background, otherwise the default plotting region is used.
|
ylim |
limits for the y-axis.
|
... |
further arguments passed to the plotting function.
|
Details
None.
Value
Creates a plot.
Author(s)
S. McKay Curtis (adapted from Martyn Plummer's autcorr.plot code in the coda package)
References
None.
See Also
acf , autocorr.plot
Examples
## Create fake MCMC output
nc <- 10; nr <- 1000
pnames <- c(paste("alpha[", 1:5, "]", sep=""), paste("gamma[", 1:5, "]", sep=""))
means <- rpois(10, 20)
fakemcmc <-
coda::as.mcmc.list(
lapply(1:3,
function(i)
coda::mcmc(matrix(rnorm(nc*nr, rep(means,each=nr)),
nrow=nr, dimnames=list(NULL,pnames)))))
autplot1(fakemcmc[, "alpha[1]", drop=FALSE])
autplot1(fakemcmc[, "alpha[1]", drop=FALSE], chain=2, style="plain")
autplot1(fakemcmc[, "alpha[1]", drop=FALSE], partial=TRUE)
Results
|