Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

densplot

Probability density function estimate from MCMC output


Description

Displays a plot of the density estimate for each variable in x, calculated by the density function. For discrete-valued variables, a histogram is produced.

Usage

densplot(x, show.obs = TRUE, bwf, 
                ylim, xlab, ylab = "", type="l", main, right=TRUE, ...)

Arguments

x

An mcmc or mcmc.list object

show.obs

Show observations along the x-axis

bwf

Function for calculating the bandwidth. If omitted, the bandwidth is calculate by 1.06 times the minimum of the standard deviation and the interquartile range divided by 1.34 times the sample size to the negative one fifth power

ylim

Limits on y axis. See plot.window

xlab

X-axis label. By default this will show the sample size and the bandwidth used for smoothing. See plot

ylab

Y-axis label. By default, this is blank. See plot

type

Plot type. See plot

main

An overall title for the plot. See title

right

Logical flag for discrete-valued distributions passed to the hist function. See Details

.

...

Further graphical parameters

Details

For discrete-valued distributions, a histogram is produced and values are aggregated using the pretty() function. By default, tick marks appear to the right of the corresponding bar in the histogram and give the inclusive upper limit of the hist (right=TRUE). This can be modified by specifying right=FALSE. In this case tick marks appear on the left and specify the inclusive lower limit of the bar.

For continous distributions, if a variable is bounded below at 0, or bounded in the interval [0,1], then the data are reflected at the boundary before being passed to the density() function. This allows correct estimation of a non-zero density at the boundary.

Note

You can call this function directly, but it is more usually called by the plot.mcmc function.

See Also


coda

Output Analysis and Diagnostics for MCMC

v0.19-4
GPL (>= 2)
Authors
Martyn Plummer [aut, cre, trl], Nicky Best [aut], Kate Cowles [aut], Karen Vines [aut], Deepayan Sarkar [aut], Douglas Bates [aut], Russell Almond [aut], Arni Magnusson [aut]
Initial release
2020-09-30

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.