Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

HPDint

Highest Posterior Density Interval


Description

Adapts code from coda::HPDinterval() to compute a highest posterior density interval from posterior samples for a single parameter. Quoting from the coda help file, for each parameter the interval is constructed from the empirical cdf of the sample as the shortest interval for which the difference in the ecdf values of the endpoints is the nominal probability. Assuming that the distribution is not severely multimodal, this is the HPD interval.

Usage

HPDint(x, prob = 0.95)

Arguments

x

a vector of posterior draws

prob

desired probability coverage

Value

a 2-vector with elements Lower and Upper

Author(s)

Douglas Bates and Frank Harrell


rmsb

Bayesian Regression Modeling Strategies

v0.0.2
GPL (>= 3)
Authors
Frank Harrell [aut, cre] (<https://orcid.org/0000-0002-8271-5493>), Ben Goodrich [ctb] (contributed Stan code), Ben Bolker [ctb] (wrote original code that is folded into the pdensityContour function), Doug Bates [ctb] (write original code for highest posterior density interval that is folded into the HPDint function)
Initial release
2021-02-27

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.