Learn R Programming

mcmcplots (version 0.2)

autplot1: Autocorrelation Plot of MCMC Output

Description

Creates an autocorrelation or partial autocorrelation plot of MCMC output. The code for autplot1 is modified from the autocorr.plot function in the coda package.

Usage

autplot1(x, chain = 1, lag.max = NULL, partial = FALSE, col = mcmcplotsPalette(1), style = c("gray", "plain"), ...)

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.
...
further arguments passed to the plotting function.

Value

  • Creates a plot.

Details

None.

References

None.

See Also

acf, autocorr.plot

Examples

Run this code
## 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 <- as.mcmc.list(lapply(1:3, function(i) 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")

Run the code above in your browser using DataLab