plotDens: Plot MCMC Density

Description Usage Arguments Value Note See Also Examples

View source: R/plotDens.R

Description

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

Usage

1
2
3
4
5
6
7
8
9
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.axis=0.8, cex.strip=0.8,
         col.strip="gray95", 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="darkgray", lty.outer=3,
         lwd.outer=1, col.outer="darkgray", 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 individual 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.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.density

line type of density curve.

lwd.density

line width of density curve.

col.density

color of density curve.

lty.median

line type of median.

lwd.median

line width of median.

col.median

color of median.

lty.outer

line type of outer quantiles.

lwd.outer

line width of outer quantiles.

col.outer

color of outer quantiles.

pch

symbol for points.

cex.points

size of points.

col.points

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

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

See Also

xyplot and panel.densityplot are the underlying drawing functions, and link[coda]{densplot} 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

1
2
3
plotDens(xbio$"2004", points=TRUE, div=1000, main="2004\n",
         xlab="Biomass age 4+ (kt)", tick.number=6, strip=FALSE)
plotDens(xpar, xlab="Parameter value", ylab="Posterior density\n")

Example output



plotMCMC documentation built on Nov. 23, 2020, 5:08 p.m.