plotTrace {scapeMCMC}R Documentation

Plot MCMC Traces

Description

Plot Markov-chain Monte Carlo traces. This is a diagnostic plot for deciding whether a chain shows unwanted trends.

Usage

plotTrace(mcmc, axes=FALSE, same.limits=FALSE,
          between=list(x=axes,y=axes), div=1, span=1/4, log=FALSE,
          base=10, main=NULL, xlab=NULL, ylab=NULL, cex.main=1.2,
          cex.lab=1, cex.strip=0.8, cex.axis=0.8, las=0, tck=0.5,
          tick.number=5, lty.trace=1, lwd.trace=1, col.trace="grey",
          lty.median=1, lwd.median=1, col.median="black", lty.loess=2,
          lwd.loess=1, col.loess="black", plot=TRUE, ...)

Arguments

mcmc MCMC chain(s) as a vector, data frame or mcmc object.
axes whether axis values should be plotted.
same.limits whether panels should have same x-axis limits.
between list with x and y indicating panel spacing.
div denominator to shorten values on the y axis.
span smoothness parameter, passed to panel.loess
log whether values should be log-transformed.
base logarithm base.
main main title.
xlab x-axis title.
ylab y-axis title.
cex.main size of main title.
cex.lab size of axis labels.
cex.strip size of strip labels.
cex.axis size of tick labels.
las orientation of tick labels: 0=parallel, 1=horizontal, 2=perpendicular, 3=vertical.
tck tick mark length.
tick.number number of tick marks.
lty.trace line type of trace.
lwd.trace line width of trace.
col.trace colour of trace.
lty.median line type of median.
lwd.median line width of median.
col.median colour of median.
lty.loess line type of loess.
lwd.loess line width of loess.
col.loess colour of loess.
plot whether to draw plot.
... passed to xyplot and panel.loess.

Value

When plot=TRUE, a trellis plot is drawn and a data frame is returned, containing the data used for plotting. When plot=FALSE, a trellis object is returned.

Note

This function tries to draw the plot on a trellis device with a white background.

The Args function from the gdata package is recommended for reviewing the arguments, instead of args.

Author(s)

Arni Magnusson arnima@u.washington.edu.

See Also

Lattice, panel.loess, traceplot, quantile.

scapeMCMC-package gives an overview of the package.

Examples

plotTrace(xmcmc$P, xlab="Iterations", ylab="Parameter value",
          layout=c(2,4))
plotTrace(xmcmc$P$R0, axes=TRUE, div=1000)

[Package scapeMCMC version 1.0-3 Index]