Learn R Programming

hdrcde (version 2.13)

hdrbw: Highest Density Region Bandwidth

Description

Calculates optimal bandwidth for 1-dimensional highest density regions

Usage

hdrbw(x, HDRlevel, gridsize = 801, nMChdr = 1e+06, graphProgress = FALSE)

Arguments

x
Numerical vector containing data.
HDRlevel
HDR-level as defined in Hyndman (1996). Setting `HDRlevel' equal to p (0
gridsize
the number of equally spaced points used for binned kernel density estimation.
nMChdr
the size of the Monte Carlo sample used for density quantile approximation of the highest density region, as described in Hyndman (1996).
graphProgress
logical flag: if `TRUE' then plots showing the progress of the bandwidth selection algorithm are produced.

Value

  • A numerical vector of length 1.

Details

This is a plug-in rule for bandwidth selection tailored to highest density region estimation

References

Hyndman, R.J. (1996). Computing and graphing highest density regions. The American Statistician, 50, 120-126. Samworth, R.J., and Wand, M.P. (2009). Asymptotics and optimal bandwidth selection for highest density region estimation. Working paper. http://www.uow.edu.au/~mwand/hdrpap.pdf.

Examples

Run this code
HDRlevelVal <- 0.55
x <- faithful$eruptions
hHDR <- hdrbw(x,HDRlevelVal)
HDRhat <- hdr.den(x,prob=100*(1-HDRlevelVal),h=hHDR)

Run the code above in your browser using DataLab