Algorithm Search⌘K

Definitioncore

Highest posterior density region

Also called HPD interval, highest density interval.

The smallest region with a given posterior probability, made of the points where the posterior density exceeds a level.

The 1−α1 - \alpha highest posterior density (HPD) region is the set of parameter values where the posterior density is at least some level kk, with kk chosen so that the set has posterior probability 1−α1 - \alpha. Among all sets with that posterior probability it has the smallest length, area or volume. For a unimodal posterior on the line it is an interval whose two ends have the same density; for a posterior with two modes it can be two separate intervals. Unlike the equal-tailed credible interval, it changes when the parameter is transformed, because a density changes with the Jacobian of the transformation.

Definition

Let the posterior of θ∈Θ⊆Rd\theta \in \Theta \subseteq \mathbb{R}^d given data xx have a density p(θ∣x)p(\theta \mid x) with respect to Lebesgue measure λ\lambda, as in Bayesian inference. For k≥0k \ge 0 let Rk={θ:p(θ∣x)≥k}R_k = \{\theta : p(\theta \mid x) \ge k\}, and let

kα=sup⁡{k:P(θ∈Rk∣x)≥1−α}.k_\alpha = \sup\{k : P(\theta \in R_k \mid x) \ge 1 - \alpha\}.

The 1−α1 - \alpha HPD region is R=RkαR = R_{k_\alpha}. If no level set {θ:p(θ∣x)=k}\{\theta : p(\theta \mid x) = k\} has positive Lebesgue measure (the density has no flat parts), then P(θ∈R∣x)=1−αP(\theta \in R \mid x) = 1 - \alpha exactly. When RR is an interval it is called the HPD interval.

It is the smallest credible set. Let AA be any set with P(θ∈A∣x)≥1−α=P(θ∈R∣x)P(\theta \in A \mid x) \ge 1 - \alpha = P(\theta \in R \mid x). Then P(A∖R∣x)≥P(R∖A∣x)P(A \setminus R \mid x) \ge P(R \setminus A \mid x). On R∖AR \setminus A the density is at least k=kαk = k_\alpha, and on A∖RA \setminus R it is less than kk. So

k λ(R∖A)≤P(R∖A∣x)≤P(A∖R∣x)≤k λ(A∖R),k\, \lambda(R \setminus A) \le P(R \setminus A \mid x) \le P(A \setminus R \mid x) \le k\, \lambda(A \setminus R),

and λ(R)≤λ(A)\lambda(R) \le \lambda(A) (for k>0k > 0). The last inequality is strict if λ(A∖R)>0\lambda(A \setminus R) > 0, so when the density has no flat parts the HPD region is the only shortest credible set, up to sets of measure zero.

The equal-density rule. For a continuous unimodal posterior on the line, the HPD interval [a,b][a, b] solves P(a≤θ≤b∣x)=1−αP(a \le \theta \le b \mid x) = 1 - \alpha and p(a∣x)=p(b∣x)p(a \mid x) = p(b \mid x), unless an end of Θ\Theta is reached first. If the density decreases on all of Θ=[0,1]\Theta = [0, 1], the interval starts at 0. If the posterior is symmetric and unimodal, the HPD and equal-tailed intervals agree.

It is not invariant. Let ϕ=g(θ)\phi = g(\theta) with gg smooth and strictly monotone. The density of ϕ\phi is p(g−1(ϕ)∣x) ∣(g−1)′(ϕ)∣p(g^{-1}(\phi) \mid x)\, |(g^{-1})'(\phi)|. The Jacobian factor changes which points have high density, so the HPD region for ϕ\phi is in general not g(R)g(R). The equal-tailed interval is invariant under every strictly monotone gg; the HPD region is invariant only under affine maps, which have constant Jacobian.

It contains the mode. Every HPD region contains each point where the posterior density is largest, the maximum a posteriori estimate. With a flat prior the posterior density is proportional to the likelihood, and the HPD region is a likelihood region {θ:L(θ)≥c}\{\theta : L(\theta) \ge c\}, the same shape of set that a likelihood ratio test inverts.

Examples and non-examples

A skewed beta posterior. With n=10n = 10 trials, x=3x = 3 successes and the uniform prior, the posterior is Beta(4,8)(4, 8). The 95% HPD interval is [0.0934,0.5880][0.0934, 0.5880], of length 0.4946, and the density at both ends is 0.5410. The equal-tailed interval is [0.1093,0.6097][0.1093, 0.6097], of length 0.5005: it moves to the right, toward the long tail. A search over all intervals of posterior mass 0.95 with ends on a grid of 200000 equal cells of [0,1][0, 1] gives the same shortest length to within 10−510^{-5}; the ends it finds differ by up to 5×10−45 \times 10^{-4}, because the length is flat near its minimum. Under the Jeffreys prior the posterior is Beta(3.5,7.5)(3.5, 7.5), with 95% HPD interval [0.0745,0.5795][0.0745, 0.5795] (length 0.5049) against the equal-tailed [0.0927,0.6058][0.0927, 0.6058] (length 0.5131).

An end of the parameter space. With n=4n = 4, x=0x = 0 and the uniform prior, the posterior is Beta(1,5)(1, 5), with density 5(1−p)45(1 - p)^4, which decreases on [0,1][0, 1]. The HPD interval is [0,c][0, c] with 1−(1−c)5=0.951 - (1 - c)^5 = 0.95, so c=1−0.051/5=0.4507c = 1 - 0.05^{1/5} = 0.4507. The two ends do not have equal density. The equal-tailed interval is [0.0051,0.5218][0.0051, 0.5218], of length 0.5168, and it excludes p=0p = 0, the most probable value.

A transformation changes the region. Put the Beta(4,8)(4, 8) posterior on the log-odds scale η=log⁡(p/(1−p))\eta = \log(p/(1 - p)). The density of η\eta is proportional to p4(1−p)8p^4 (1 - p)^8, with p=1/(1+e−η)p = 1/(1 + e^{-\eta}), because dp/dη=p(1−p)dp/d\eta = p(1 - p). Its 95% HPD interval is η∈[−2.0511,0.4871]\eta \in [-2.0511, 0.4871], which maps back to p∈[0.1139,0.6194]p \in [0.1139, 0.6194]. That is a 95% credible interval for pp, but it is not the HPD interval [0.0934,0.5880][0.0934, 0.5880] for pp. The equal-tailed interval maps to the log-odds scale exactly, to [−2.0983,0.4462][-2.0983, 0.4462].

Two intervals. Let X∣θ∼N(∣θ∣,1)X \mid \theta \sim N(|\theta|, 1), observe x=3x = 3, and use the flat prior on θ∈R\theta \in \mathbb{R}. The posterior density is φ(∣θ∣−3)/(2Φ(3))\varphi(|\theta| - 3)/(2\Phi(3)), where φ\varphi and Φ\Phi are the standard normal density and distribution function; it has modes at ±3\pm 3. The 95% HPD region is {θ:1.0509≤∣θ∣≤4.9491}\{\theta : 1.0509 \le |\theta| \le 4.9491\}, two intervals of total length 7.7964, where c=1.949109c = 1.949109 solves (2Φ(c)−1)/Φ(3)=0.95(2\Phi(c) - 1)/\Phi(3) = 0.95. The equal-tailed interval is [−4.6455,4.6455][-4.6455, 4.6455], of length 9.2910. It contains θ=0\theta = 0, where the posterior density is e−4.5=0.0111e^{-4.5} = 0.0111 times its peak.

Non-example: the interval between the 2.5% and 97.5% posterior quantiles. That is the equal-tailed credible interval. It is the HPD interval only when the posterior is symmetric and unimodal.

Non-example: equal density, wrong mass. For Beta(4,8)(4, 8), the interval [0.2,0.4148][0.2, 0.4148] has density 2.2146 at both ends, but its posterior mass is 0.5764. It is the 57.64% HPD interval, not the 95% one. The equal-density rule fixes the shape of the interval; the mass condition fixes its level. Both are needed.

Non-example: a confidence region. The HPD region is a statement about θ\theta given xx, like every credible set. Its frequentist coverage at a fixed θ\theta is a separate property; see credible interval for when the two agree.

  • Credible interval. Any set of posterior probability 1−α1 - \alpha; the equal-tailed one is invariant under monotone maps, the HPD one is the shortest.
  • Maximum a posteriori estimate. The mode of the posterior; the HPD regions shrink to it as α\alpha grows to 1 when the mode is unique.
  • Highest density region of a predictive law. The same construction applied to the posterior predictive distribution gives the shortest prediction set for a new observation.
  • Likelihood region. With a flat prior, the HPD region is a set {θ:L(θ)≥c}\{\theta : L(\theta) \ge c\}; the frequentist likelihood ratio test inverts sets of this form with a different choice of cc.
  • Confidence interval. A rule with coverage at least 1−α1 - \alpha at every θ\theta over repeated samples; a different statement.

References

  1. George E. P. Box and George C. Tiao, Bayesian Inference in Statistical Analysis, Addison-Wesley, 1973; Wiley Classics Library reprint, 1992, Chapter 2 (highest posterior density intervals and regions, and their lack of invariance)
  2. Andrew Gelman, John B. Carlin, Hal S. Stern, David B. Dunson, Aki Vehtari and Donald B. Rubin, Bayesian Data Analysis, 3rd edition, CRC Press, 2013, Chapter 2 (central posterior intervals and highest posterior density regions, with a bimodal example)
  3. Christian P. Robert, The Bayesian Choice, 2nd edition, Springer, 2007, Chapter 5, Section 5.5.1 (credible intervals and HPD regions)

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/9T76SY/text.yaml