Statistics · hard

Explain confidence intervals vs credible intervals.

Asked in Data Scientist interviews, in the Statistics round.

Short answer

A confidence interval is frequentist coverage over repeated samples, a credible interval is Bayesian probability given the data.

Confidence intervalCredible interval
FrameworkFrequentistBayesian
What is randomThe intervalThe parameter
95% means95% of such intervals cover the truth95% probability the value is in this one
Needs a priorNoYes
The tempting wrong readingTreating it as the credible oneNone, it reads as people expect
The interval you can state a probability about is the Bayesian one.

How to answer it

Definition

Both give a range for a parameter. They differ in what is treated as random, which is why only one of them supports the sentence everybody wants to say. The table above compares them.

The awkward part

A 95% confidence interval does NOT mean there is a 95% probability the true value is inside it. In the frequentist frame the true value is fixed; the interval is what varies from sample to sample. The 95% describes the procedure: repeat the experiment many times and 95% of the intervals it produces contain the truth.

A credible interval does support that sentence. Given the prior and the data, there is a 95% probability the parameter lies in the interval. That is what most people mean, which is why the confidence interval is so persistently misread.

Example

Frequentist:  95% CI for the lift is [0.2%, 1.4%]
  "95% of intervals built this way contain the true lift."

Bayesian:     95% credible interval is [0.3%, 1.3%]
  "Given the prior and this data, 95% probability the lift is in here."
  and also: "P(lift > 0) = 0.98", which a CI cannot give you.

Key points

FAQ

The 30-second answer

Both are ranges for a parameter, and the difference is what is treated as random. In the frequentist view the parameter is fixed and the interval varies from sample to sample, so ninety-five percent confidence describes the procedure: repeat it many times and that share of the intervals cover the truth.
A credible interval is Bayesian, where the parameter has a distribution, so you genuinely can say there is a ninety-five percent probability the value is in this range, given the prior and the data.
That matters because the sentence everybody wants to say about a confidence interval is only true of the credible one. In practice, with plenty of data and a weak prior the two nearly coincide, and I would often report the Bayesian version to stakeholders because it says what they already think it says.

In the interview

Practice this for real