MCMC Diagnostics Plots for one Model Parameter

Share:

Description

Creates a graph window containing three different plots—a trace plot, a density plot, and an autocorrelation plot—for one parameter in an MCMC run. This function is used by mcmcplot to construct an html file of MCMC diagnostics. This function is intended for internal use only.

Usage

1
2
mcmcplot1(x, col = mcmcplotsPalette(n), lty = 1, xlim = NULL, ylim =
NULL, style = c("gray", "plain"), greek = FALSE)

Arguments

x

an mcmc object with a single variable.

col

colors for plotting each parallel chain. The default is seq(nchains)+1 where nchains is the number of parallel chains in mcmcout. If there is only one parallel chain, then the default is 1.

lty

line types for plotting each parallel chain. The default is 1 for all parallel chains.

xlim

limits for the x axis of the density plot.

ylim

limits for the y axis of the density plot.

style

if "gray", then the plotting region is printed with a gray background, otherwise the default plotting region is used.

greek

if TRUE, the names of greek letters in the labels will be displayed as greek characters on the plot.

Value

Creates a plot.

Note

Only the first parallel chain is used to create the autocorrelation plot. This function is used by mcmcplot to create html output for all the parameters of an MCMC simulation.

Author(s)

S. McKay Curtis

References

No references.

See Also

mcmcplot

Examples

1
2
3
4
5
6
## Create fake MCMC output
fakemcmc <- coda::as.mcmc.list(coda::mcmc(sapply(1:5, function(dum) rnorm(1000))))
coda::varnames(fakemcmc) <- c("gamma[1,1]", "gamma[1,2]", "gamma[1,3]", "sigma[1]", "sigma[2]")

mcmcplot1(fakemcmc[, "sigma[1]", drop=FALSE])
mcmcplot1(fakemcmc[, "gamma[1,3]", drop=FALSE], style="plain")