Statistics · hard

Explain confidence intervals vs credible intervals.

Asked in Data Scientist interviews, in the Statistics round.

Short answer

CI is frequentist coverage over repeated samples; credible is Bayesian probability given data.

How to answer it

They answer different questions, and the wording is the whole distinction.

A 95% confidence interval is frequentist: if you repeated the experiment many times and built an interval each time, 95% of those intervals would contain the true value. The true value is fixed; the interval is the random thing. A given interval either contains it or not, and you do not get to say "95% probability it is in here".

A 95% credible interval is Bayesian: given the data and a prior, there is a 95% probability the parameter lies in this range. The parameter is the random thing, and the sentence everyone wants to say is now the correct one.

# Beta-Binomial credible interval for a conversion rate: 1,600 of 50,000
from scipy import stats
post = stats.beta(1 + 1600, 1 + 50_000 - 1600)      # uniform prior
lo, hi = post.ppf([0.025, 0.975])

With flat priors and plenty of data the two intervals are numerically almost the same, which is why the distinction is about interpretation and about what you can do next. A credible interval lets you say "there is a 92% chance B beats A" and "the expected loss of shipping B is 0.01 points", which is what a product decision actually needs. A confidence interval does not license either statement.

Related questions

Practice this for real