Learn R Programming

hdrcde (version 2.13)

hdr.boxplot.2d: Bivariate Highest Density Regions

Description

Calculates and plots highest density regions in two dimensions, including the bivariate HDR boxplot.

Usage

hdr.boxplot.2d(x, y, prob=c(0.01,0.50), h, show.points = FALSE, 
    xlab="", ylab="",  kde.package=c("ash","ks"), shadecols, pointcol, ...)

Arguments

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.
shadecols
Colors for shaded regions
pointcol
Color for outliers and mode
...
Other arguments to be passed to plot.

Value

  • Some information about the HDRs is returned. See code for details.

Details

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.

References

Hyndman, R.J. (1996) Computing and graphing highest density regions American Statistician, 50, 120-126.

See Also

hdr.boxplot

Examples

Run this code
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)

Run the code above in your browser using DataLab