hdr.boxplot.2d {hdrcde} | R Documentation |
Calculates and plots highest density regions in two dimensions, including the bivariate HDR boxplot.
hdr.boxplot.2d(x, y, prob=c(0.01,0.50), h, show.points = FALSE, xlab="", ylab="", kde.package=c("ash","ks"), ...)
x |
Numeric vector |
y |
Numeric vector of same length as x . |
prob |
Probability coverage required for HDRs |
h |
Pair of bandwidths passed to either ash2 or kde . If missing,
a reasonable default is used. |
show.points |
If TRUE, will plot points over the top of contours. |
xlab |
Label for x-axis. |
ylab |
Label for y-axis. |
kde.package |
Package to be used in calculating the kernel density estimate. |
... |
Other arguments to be passed to plot. |
The density is estimated using kernel density estimation. Either ash2
or kde
is used to
do the calculations. Then Hyndman's (1996) density quantile algorithm is used to compute
the HDRs.
Some information about the HDRs is returned. See code for details.
Rob Hyndman
Hyndman, R.J. (1996) Computing and graphing highest density regions American Statistician, 50, 120-126.
x <- c(rnorm(200,0,1),rnorm(200,4,1)) y <- c(rnorm(200,0,1),rnorm(200,4,1)) par(mfrow=c(1,2)) plot(x,y) hdr.boxplot.2d(x,y)