Course contentsShow
← Data Science
Lesson 1576 of 2,14538. Bayesian Data AnalysisFree lesson

Highest Density Intervals (HDI)

Construct HDIs as the shortest credible intervals containing the specified probability mass.

Highest Density Intervals (HDI)

You'll learn how to construct the shortest credible interval that captures a specified probability mass from a posterior distribution.

What Makes HDI Different?

You've already learned about equal-tailed credible intervals, which chop off equal probability from both tails of your posterior distribution. But what if your posterior is skewed or oddly shaped? The Highest Density Interval (HDI) takes a smarter approach: it finds the shortest possible interval that still contains your desired probability mass (say, 95%).

The Core Idea

Think of HDI like this: imagine you're trying to fence off 95% of a herd of sheep scattered across a hilly field. An equal-tailed approach would mark boundaries at the 2.5th and 97.5th percentiles—simple, but potentially wasteful. The HDI instead asks: "What's the smallest fence that encloses 95% of the sheep?"

The HDI consists of all parameter values where the posterior density is above some threshold. This means every point inside the HDI has higher probability density than any point outside it.

Why HDI Matters

For symmetric distributions (like a normal posterior), HDI and equal-tailed intervals are identical. But for skewed posteriors—common when estimating proportions near 0 or 1, or rates with Gamma priors—the HDI is tighter and more informative. It concentrates on the region where the parameter is most likely to be, rather than mechanically splitting tails.

The trade-off? HDI requires more computation: you need to find the density threshold that captures exactly your target probability mass, which usually means numerical methods rather than simple percentile lookups.

Key Takeaway: The Highest Density Interval is the shortest credible interval for a given probability mass, containing all and only the most plausible parameter values—especially useful for skewed posterior distributions.