Learn R Programming

truelies (version 0.2.0)

dist_hdr: Compute highest density region for a density function

Description

This is a wrapper for hdrcde::hdr. The highest density region is the interval that covers conf_level of the data and has the highest average density. See:

Usage

dist_hdr(dist, conf_level, bounds = attr(dist, "limits"))

Arguments

dist

A one-argument function

conf_level

A scalar between 0 and 1

bounds

A length 2 vector of the bounds of the distribution's support

Value

A length 2 vector of region endpoints

Details

Rob J Hyndman (1996) <U+201C>Computing and graphing highest density regions<U+201D>. American Statistician, 50, 120-126.

Examples

Run this code
# NOT RUN {
d1 <- update_prior(33, 50, P = 0.5, prior = stats::dunif)
dist_hdr(d1, 0.95)

# }

Run the code above in your browser using DataLab