Description Usage Arguments Details Value Author(s) References See Also Examples
Plots univariate density with highest density regions displayed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
x |
Numeric vector containing data. If |
prob |
Probability coverage required for HDRs |
den |
Density of data as list with components |
h |
Optional bandwidth for calculation of density. |
lambda |
Box-Cox transformation parameter where |
xlab |
Label for x-axis. |
ylab |
Label for y-axis. |
ylim |
Limits for y-axis. |
plot.lines |
If |
col |
Colours for regions. |
bgcol |
Colours for the background behind the boxes. Default |
legend |
If |
... |
Other arguments passed to plot. |
Either x
or den
must be provided. When x
is provided,
the density is estimated using kernel density estimation. A Box-Cox
transformation is used if lambda!=1
, as described in Wand, Marron and
Ruppert (1991). This allows the density estimate to be non-zero only on the
positive real line. The default kernel bandwidth h
is selected using
the algorithm of Samworth and Wand (2010).
Hyndman's (1996) density quantile algorithm is used for calculation.
a list of three components:
hdr |
The endpoints of each interval in each HDR |
mode |
The estimated mode of the density. |
falpha |
The value of the density at the boundaries of each HDR. |
Rob J Hyndman
Hyndman, R.J. (1996) Computing and graphing highest density regions. American Statistician, 50, 120-126.
Samworth, R.J. and Wand, M.P. (2010). Asymptotics and optimal bandwidth selection for highest density region estimation. The Annals of Statistics, 38, 1767-1792.
Wand, M.P., Marron, J S., Ruppert, D. (1991) Transformations in density estimation. Journal of the American Statistical Association, 86, 343-353.
1 2 3 4 5 6 |
This is hdrcde 3.3
$hdr
[,1] [,2] [,3] [,4]
99% 1.323538 2.819354 3.152597 5.282233
95% 1.500589 2.520929 3.500000 5.091820
50% 1.923764 2.024871 3.941025 4.772941
$mode
[1] 4.378855
$falpha
1% 5% 50%
0.06778909 0.15321941 0.36037111
$hdr
[,1] [,2] [,3] [,4]
99% -2.0481413 7.226990 NA NA
95% -1.5438449 2.257851 2.925022 6.711026
50% -0.5778713 1.023053 4.350023 5.630416
$mode
[1] 0.2293077
$falpha
1% 5% 50%
0.03890428 0.06715987 0.12715639
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.