dnplot: Density plot

View source: R/dnplot.r

dnplotR Documentation

Density plot

Description

Primarily intended for plotting posterior densities

Usage

dnplot(
  M,
  labs,
  pos = FALSE,
  lwd = 3,
  bty = "n",
  lty = 1,
  col = pal(p),
  ylab = "Density",
  xlab = "",
  las = 1,
  dens.par = NULL,
  ...
)

Arguments

M

A vector or matrix of values upon which the density plot is based; if a matrix, separate densities will be estimated and plotted for each column

labs

If supplied, a legend is printed; order of labs should correspond to columns of M

pos

Are the densities strictly positive? If so, a boundary correction is applied. Default: FALSE

lwd, bty, lty, col, xlab, ylab, las

Plotting options, as in par()

dens.par

Additional arguments to density()

...

Additional arguments to plot()

Examples

M <- cbind(rgamma(1000, 2, 2), rnorm(1000))
dnplot(M[,1])
dnplot(M[,1], pos=TRUE)
dnplot(M)
dnplot(M, labs=c('Gamma', 'Normal'))
dnplot(M, labs=c('Gamma', 'Normal'))

pbreheny/breheny documentation built on March 30, 2024, 7:37 p.m.