plotDens {scapeMCMC}R Documentation

Plot MCMC Density

Description

Plot Markov-chain Monte Carlo density. This is an approximation of the posterior probability density function.

Usage

plotDens(mcmc, probs=c(0.025,0.975), points=FALSE, axes=TRUE,
         same.limits=FALSE, between=list(x=axes,y=axes), div=1,
         log=FALSE, base=10, main=NULL, xlab=NULL, ylab=NULL,
         cex.main=1.2, cex.lab=1, cex.strip=0.8, cex.axis=0.7, las=0,
         tck=0.5, tick.number=5, lty.density=1, lwd.density=3,
         col.density="black", lty.median=2, lwd.median=1,
         col.median="darkgrey", lty.outer=3, lwd.outer=1,
         col.outer="darkgrey", pch="|", cex.points=1,
         col.points="black", plot=TRUE, ...)

Arguments

mcmc MCMC chain(s) as a vector, data frame or mcmc object.
probs vector of outer quantiles to draw, besides the median.
points whether data points should be plotted along the x axis.
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 x axis.
log whether values should be log-transformed.
base logarithm base.
main main title.
xlab x-axis label.
ylab y-axis label.
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.density line type of density curve.
lwd.density line width of density curve.
col.density colour of density curve.
lty.median line type of median.
lwd.median line width of median.
col.median colour of median.
lty.outer line type of outer quantiles.
lwd.outer line width of outer quantiles.
col.outer colour of outer quantiles.
pch symbol for data points.
cex.points size of data points.
col.points colour of data points.
plot whether to draw plot.
... passed to densityplot and panel.densityplot.

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.densityplot, densplot, quantile.

scapeMCMC-package gives an overview of the package.

Examples

plotDens(xmcmc$B$"2004", points=TRUE, div=1000, main="2004\n",
         xlab="Biomass age 4+ (1000 t)", tick.number=6, strip=FALSE)
plotDens(xmcmc$P, xlab="Parameter value", ylab="Posterior density\n")

[Package scapeMCMC version 1.0-3 Index]