plotMCMC (version 2.0-0)

plotTrace: 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.axis=0.8, cex.strip=0.8, col.strip="gray95",
          las=0, tck=0.5, tick.number=5, lty.trace=1, lwd.trace=1,
          col.trace="gray", 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.axis

size of tick labels.

cex.strip

size of strip labels.

col.strip

color of strip 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

color of trace.

lty.median

line type of median.

lwd.median

line width of median.

col.median

color of median.

lty.loess

line type of loess.

lwd.loess

line width of loess.

col.loess

color 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.

See Also

xyplot and panel.loess are the underlying drawing functions, and traceplot is a similar non-trellis plot.

plotTrace, plotAuto, plotCumu, and plotSplom are diagnostic plots.

plotDens and plotQuant are posterior plots.

plotMCMC-package gives an overview of the package.

Examples

Run this code
# NOT RUN {
plotTrace(xpar, xlab="Iterations", ylab="Parameter value",
          layout=c(2,4))
plotTrace(xpar$R0, axes=TRUE, div=1000)
# }

Run the code above in your browser using DataCamp Workspace