Skip to content
Tutorials Center
My learning

Topics

Lesson 10 of 36 ยท Bayes Theorem and Priors

Posterior Summaries and Credible Intervals

Summarize a posterior with means, medians, modes, equal-tailed credible intervals and HDIs, compute probabilities of hypotheses, and use ROPE and loss for decisions.

A posterior is a whole distribution, which is wonderfully informative and awkward to put in a table. Summaries compress it into numbers you can report: a typical value, a range, and the probabilities of the statements that matter. This lesson shows the standard summaries and how to compute each from posterior draws.

Point summaries

Three common choices for a single "best guess":

  • Posterior mean: minimizes squared error; sensitive to skewed tails.
  • Posterior median: minimizes absolute error; robust to skew.
  • Posterior mode (MAP): the most probable value; ignores the shape around it.

For symmetric posteriors they nearly coincide. For skewed ones they differ, and the best choice depends on the cost of being wrong.

Python Mean, median and mode of a skewed posterior

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The mean exceeds the median, which exceeds the mode: a right-skewed distribution.

Interval summaries

An interval says how uncertain you are. Two kinds are common, both at a chosen probability such as 94% or 95%.

Equal-tailed interval (ETI): cut equal probability from each tail, i.e. the 2.5% and 97.5% quantiles for a 95% interval.

Highest density interval (HDI): the narrowest interval containing the chosen probability. Every point inside has higher density than every point outside. For skewed posteriors it differs from the ETI and is shorter.

Python ETI vs HDI

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The HDI is narrower and slides toward the mode. For a symmetric, unimodal posterior both are almost the same. For a multimodal posterior the HDI can be a union of intervals, and the plain function above would then return a single interval covering the gap: remember it assumes one hump.

Which interval should you report?

  • The ETI is easy, works under transformations (log of the interval is the interval of the log), and is the usual default.
  • The HDI is better when the posterior is skewed and you want the most plausible values.
  • Many reports use 89% or 94% intervals to remind readers that 95% is a convention, not magic. Any consistent choice is fine; state it.

Probabilities of statements

The most direct output of a posterior: the probability that something is true. With draws, it is just the fraction of draws where the statement holds.

Python Probability of a hypothesis from draws

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Notice how easily we compare two unknowns: subtract draws. No special test is needed, and the answer is in the form decision makers want: "a 94% chance that B is better".

ROPE: what counts as no difference?

In practice, tiny differences do not matter. A region of practical equivalence (ROPE) is an interval of parameter values you consider equivalent to "no effect", such as a click-rate difference of ยฑ0.5 percentage points. Report how much posterior probability falls inside the ROPE, above it and below it.

Python Posterior mass in a ROPE

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Here most of the mass lies above the ROPE, so B is probably meaningfully better; if most mass sat inside, you would conclude the variants are practically the same.

Decisions and loss

A posterior also feeds decisions. If choosing the wrong variant costs money, compute the expected loss of each choice: the average, over the posterior, of what you lose if that choice is wrong. Pick the choice with the smaller expected loss. For example, the expected loss of shipping B is the posterior mean of max(A - B, 0).

Reporting checklist

  1. Point summary (mean or median) with the interval type and probability.
  2. Posterior probability for the decision-relevant statement.
  3. The prior and a sensitivity note.
  4. A plot of the posterior, if possible.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What is the highest density interval?

    The HDI is the shortest interval holding the specified posterior probability.
  2. 2. How do you compute P(B > A) from posterior draws of the two rates?

    Subtracting or comparing paired draws gives the posterior of the difference and any probability about it.
  3. 3. For a right-skewed posterior, the usual ordering of summaries is...

    A long right tail pulls the mean upward past the median, and both exceed the mode.
  4. 4. What is a ROPE?

    The ROPE defines differences small enough to be practically irrelevant; we report posterior mass inside and outside it.

Summary

  • Summarize posteriors with a mean, median or mode and an interval (ETI or HDI).
  • The HDI is the narrowest interval of a given mass; the ETI cuts equal tails.
  • Probabilities of statements come from counting draws, including differences between groups.
  • A ROPE separates meaningful from negligible effects.
  • Expected loss turns a posterior into a decision.

Next: The Beta-Binomial Model