Learn R Programming

hdrcde (version 3.5.0)

hdrconf: HDRs with confidence intervals

Description

Calculates Highest Density Regions with confidence intervals.

Usage

hdrconf(x, den, prob = 0.9, conf = 0.95)

Value

hdrconf returns list containing the following components:

hdr

Highest density regions

hdr.lo

Highest density regions corresponding to lower confidence limit.

hdr.hi

Highest density regions corresponding to upper confidence limit.

falpha

Values of \(f_\alpha\) corresponding to HDRs.

falpha.ci

Values of \(f_\alpha\) corresponding to lower and upper limits.

Arguments

x

Numeric vector containing data.

den

Density of data as list with components x and y.

prob

Probability coverage for for HDRs.

conf

Confidence for limits on HDR.

Author

Rob J Hyndman

References

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

See Also

hdr(), plot.hdrconf()

Examples

Run this code
x <- c(rnorm(100, 0, 1), rnorm(100, 4, 1))
den <- density(x, bw = hdrbw(x, 50))
hdr_conf <- hdrconf(x, den)
plot(hdr_conf, den, main = "50% HDR with 95% CI")

Run the code above in your browser using DataLab