skip to content

How does an equal-tailed credible interval differ from a highest posterior density interval?

level: middleimportance: must knowfreq 61%

answer

  1. same mass, different slice
  2. one rule cuts equal tails
  3. the other minimises interval length
  4. think about a skewed posterior
  5. density threshold versus percentile cut

basics

~20 s

An equal-tailed interval cuts equal posterior probability off each tail: at 95% it runs from the 2.5th to the 97.5th percentile. A highest posterior density interval is the shortest range holding 95%, so on a skewed posterior it is shorter.

solid answer

~50 s

Both hold 95% of the posterior; they differ in which 95% they take. The equal-tailed interval runs between the 2.5th and 97.5th posterior percentiles, discarding equal probability on each side. The highest posterior density interval takes the shortest range containing 95%, which is equivalent to including every value whose posterior density is above some threshold. On a symmetric unimodal posterior the two nearly coincide. On a skewed one they separate: for a Beta(3, 99) posterior - two conversions in a hundred trials under a uniform prior - the equal-tailed interval runs about 0.61% to 6.96% while the density interval runs about 0.31% to 6.21%, shorter and pulled toward the mode. The tradeoff: equal-tailed is easy to compute from quantiles and survives monotone reparameterisation unchanged; the density version is shorter but changes under reparameterisation and need not be a single interval.

code

python · 19 lines
python
import random

random.seed(0)
# Posterior after 2 conversions in 100 trials with a uniform prior: Beta(3, 99)
draws = sorted(random.betavariate(3, 99) for _ in range(200000))
n = len(draws)

# Equal-tailed: 2.5th and 97.5th posterior percentiles
lo, hi = draws[int(0.025 * n)], draws[int(0.975 * n)]
print("equal-tailed", round(lo, 4), round(hi, 4), "width", round(hi - lo, 4))

# Highest posterior density: narrowest window holding 95% of the draws
span = int(0.95 * n)
start = min(range(n - span), key=lambda i: draws[i + span] - draws[i])
print("hpd         ", round(draws[start], 4), round(draws[start + span], 4),
      "width", round(draws[start + span] - draws[start], 4))

# equal-tailed 0.0061 0.0696 width 0.0635
# hpd          0.0031 0.0621 width 0.059

go deeper

for a junior

Recall the two definitions: one cuts 2.5% off each tail, the other takes the shortest range holding 95%. Knowing that both contain the same posterior probability is the core point.

for a middle

Explain the mechanics on a skewed posterior - why the shortest interval slides toward the mode and comes out narrower - and be able to compute either one from posterior draws.

for a senior

Demonstrate judgment about which to publish: flag boundary-hugging and multimodal posteriors where the equal-tailed rule reports implausible values or excludes zero by construction.

for a principal

Own the consistency problem. Mixed use of the two rules across scales and teams makes intervals non-comparable, so the reparameterisation-invariance argument is a governance argument, not a mathematical curiosity.

## Two rules for slicing the same posterior A credible interval is any range holding a stated share of the posterior probability. Since infinitely many ranges hold 95% of a continuous posterior, you need a rule. Two are standard. **Equal-tailed interval.** Take the value below which 2.5% of the posterior lies, and the value above which 2.5% lies. The interval between them is the 2.5th to 97.5th posterior percentile range. Equal probability is discarded on each side, hence the name. **Highest posterior density (HPD) region.** Take the shortest set holding 95% of the posterior. Equivalently, pick a horizontal cut through the posterior density and include every value whose density sits above the cut, lowering the cut until the included mass reaches 95%. Every value inside has density at least as high as every value outside - which is exactly the property the name describes. ## Where they agree and where they part If the posterior is symmetric and unimodal - a Gaussian posterior, or a Beta posterior with roughly balanced counts - the two rules give almost the same endpoints, and the choice does not matter for reporting. Skew is where they separate. Consider two conversions out of a hundred trials with a uniform prior on the rate. The posterior is Beta(3, 99): its mean is about 2.9%, its mode is 2%, and it has a long right tail. The equal-tailed 95% interval runs roughly 0.61% to 6.96%, a width of about 6.35 percentage points. The HPD interval runs roughly 0.31% to 6.21%, a width of about 5.90 percentage points. The HPD is shorter and its whole span slides toward the mode, because the density near the lower end is higher than the density in the far right tail that the equal-tailed rule insists on keeping. The general pattern: on a right-skewed posterior the equal-tailed rule buys symmetry of *probability* at the cost of carrying a stretch of thin right tail while excluding denser values on the left. ## Boundaries Suppose you observe zero events in a hundred trials with a uniform prior. The posterior is Beta(1, 101), a density that is highest at zero and decays from there. The HPD region is `[0, 2.9%]` - it runs right up to the boundary, because that is where the density is highest. The equal-tailed interval cannot do that: by construction it must leave 2.5% of the mass below its lower endpoint, so it starts at a small but strictly positive value, roughly 0.03%, and runs to about 3.6%. The equal-tailed rule therefore excludes zero purely as an artefact of the rule, not because the data disfavour zero. ## Multiple modes If the posterior has two separated peaks with a low-density valley between them, the HPD region at 95% can come out as two disjoint chunks - one around each peak - because the valley has lower density than the tails of the peaks. The equal-tailed interval always returns one contiguous range, so it bridges the valley and reports values the posterior considers relatively implausible. Neither is wrong; they answer different questions. The HPD answers "which values are most plausible"; the equal-tailed answers "between which percentiles does the middle 95% sit". ## Reparameterisation This is the property that separates the two conceptually. Equal-tailed intervals are invariant under any increasing transformation: the 2.5th percentile of the rate maps to the 2.5th percentile of the log-odds, so transforming the endpoints of an equal-tailed interval gives the equal-tailed interval on the new scale. HPD intervals are not, because a change of variable rescales the density by a Jacobian factor, which reorders which values are "highest density". The HPD interval for a probability, transformed to log-odds, is generally not the HPD interval for the log-odds. If your team reports sometimes on the rate scale and sometimes on the odds or log-odds scale, that inconsistency is real. ## Computing them from posterior draws With posterior samples, the equal-tailed interval is just two sample quantiles - stable and trivially reproducible. The HPD is usually obtained by sorting the draws and sliding a window that spans 95% of them, keeping the narrowest window found. That estimator is noisier: it depends on the extreme ordering of the draws, so it needs more samples to settle, and on a multimodal posterior the sliding-window version silently returns one chunk when the honest answer is two. ## What to say in interview Define both precisely, note that they carry the same probability but different endpoints, give the skewed case as the example where the difference bites, and finish on the tradeoff: shortest versus reproducible and reparameterisation-stable. Saying "HPD is always better because it is shorter" misses the invariance and disjointness costs.

  • When would the two intervals be practically identical?
    When the posterior is symmetric and unimodal. A Gaussian posterior, or a Beta posterior from balanced counts with a decent sample size, gives endpoints that agree to within reporting precision. The rules diverge as skew grows, as the sample shrinks, or as the posterior piles up against a boundary of the parameter space.
  • Why is a highest posterior density interval not invariant under reparameterisation?
    Because a change of variable multiplies the density by a Jacobian factor, which changes which values rank as highest density. Transforming the endpoints of an HPD interval for a rate into log-odds does not give the HPD interval for log-odds. Equal-tailed intervals do survive the transformation, since percentiles map to percentiles under any increasing function.
  • What can go wrong when estimating a highest posterior density interval from samples?
    It is noisier than a quantile, since it depends on the ordering of draws in the sparse tails, so it needs more samples to stabilise. On a multimodal posterior a narrowest-window search returns a single contiguous chunk even when the honest region is two disjoint pieces, quietly hiding the second mode.

saying these in an interview costs you the question

  • Says the two intervals hold different amounts of probability
  • Claims the shortest interval is always the better report
  • Thinks an HPD region is always one contiguous interval
  • Assumes both rules survive a change of scale unchanged
  • Defines the equal-tailed interval as centred on the mean

context