What Is a Credible Interval?
Where θ is the unknown parameter, D is the observed data, a and b are the interval bounds, and α is the exclusion probability (0.05 for a 95% interval). The posterior probability statement is direct and literal: conditional on the data and prior, there is exactly a (1 − α) probability that θ falls between a and b.
That directness is what separates a credible interval from a frequentist confidence interval. A confidence interval makes a statement about the long-run behavior of a repeated procedure — not about any single computed interval. A credible interval makes a statement about the parameter given the data in hand. Most people want the Bayesian statement; many mistakenly believe that is what a confidence interval provides.
The term "credible interval" appears throughout Bayesian statistics texts. It is also called a Bayesian interval, a posterior interval, or (less precisely) a Bayesian confidence interval. The mathematics trace back to Pierre-Simon Laplace in the late 18th century, though the modern computational machinery — particularly Markov Chain Monte Carlo (MCMC) — made them practical for complex models only in the 1990s.
- Framework: Bayesian inference — treats θ as a random variable with a probability distribution
- Input required: A prior distribution P(θ) plus data D to form the posterior P(θ|D)
- Probability statement: "Given the data and prior, there is X% probability that θ lies in [a, b]"
- Two main types: Equal-tailed interval (cuts equal mass from each tail) and HPD interval (shortest interval with the required coverage)
- Notation: CIcred, posterior interval, or [Qα/2, Q1−α/2] for equal-tailed
- Software: R packages:
HDInterval,brms,rstan. Python:PyMC,ArviZ
The Credible Interval Formula
Every credible interval starts from Bayes' theorem, which converts a prior belief about θ and the observed likelihood of the data into a posterior distribution:
P(θ|D) = posterior distribution
P(D|θ) = likelihood function
P(θ) = prior distribution
P(D) = marginal likelihood (normalizing constant)
Once the posterior P(θ|D) is available — either analytically from a conjugate model or numerically from MCMC — the credible interval is extracted by finding bounds that capture the required posterior mass.
Equal-Tailed Credible Interval Formula
An equal-tailed (1−α)% credible interval cuts equal probability mass from both tails of the posterior. The bounds are the α/2 and 1−α/2 quantiles of the posterior distribution:
F⁻¹ = inverse CDF of the posterior
α/2 = lower tail probability (e.g. 0.025 for 95%)
1−α/2 = upper quantile (e.g. 0.975 for 95%)
For a 95% equal-tailed interval, α = 0.05, so you extract the 2.5th and 97.5th percentiles of the posterior. When the posterior is symmetric (as with a Normal posterior), this is also the HPD interval. When the posterior is skewed, the equal-tailed interval is wider than necessary.
Highest Posterior Density (HPD) Interval Formula
An HPD interval is the shortest continuous region that captures (1−α) of the posterior probability. Every point inside has a higher posterior density than any point outside:
C = minimum density threshold
HPD region = { θ : P(θ|D) ≥ C }
Result: shortest interval with correct coverage
For symmetric posteriors (Normal, t), HPD = equal-tailed. Use HPD when the posterior is skewed (Beta near 0 or 1, Log-Normal, Gamma) because it produces a shorter, more efficient interval. Use equal-tailed when computational simplicity matters, since it only requires two quantile function calls.
How to Calculate a Credible Interval: 5 Steps
Step 1: Choose a prior. Step 2: Write the likelihood. Step 3: Compute the posterior via Bayes' theorem. Step 4: Extract the interval bounds (quantiles for equal-tailed; optimization for HPD). Step 5: State the result as a direct posterior probability statement.
Specify the Prior Distribution P(θ)
The prior encodes what you believe about θ before seeing the data. It can be informative (based on prior studies or domain expertise), weakly informative (e.g., Beta(2,2) for a probability near 0.5), or uninformative/flat (Beta(1,1), Jeffreys prior). The choice matters most when data are sparse; with large samples, data dominate the prior. See the Bayes' theorem guide for a full treatment of prior selection.
Formulate the Likelihood Function P(D | θ)
The likelihood describes how probable the observed data is for each possible value of θ. This depends entirely on the data-generating process: Binomial likelihood for count/proportion data, Normal likelihood for continuous measurements, Poisson for event counts. The likelihood is not a probability distribution over θ — it is a function of θ given fixed observed data D.
Compute the Posterior P(θ | D)
Apply Bayes' theorem: P(θ|D) ∝ P(D|θ) × P(θ). For conjugate models, the posterior has a closed-form distribution (e.g., Beta prior + Binomial likelihood → Beta posterior; Normal prior + Normal likelihood → Normal posterior). For non-conjugate models, use MCMC via Stan, brms, or PyMC to draw samples from P(θ|D) numerically.
Extract the Interval Bounds
For an equal-tailed interval: call the quantile function of the posterior at α/2 and 1−α/2. For example, for a Beta(32, 72) posterior and α = 0.05: a = qbeta(0.025, 32, 72) and b = qbeta(0.975, 32, 72). For HPD, use the hdi() function from the HDInterval package in R or az.hdi() in ArviZ (Python).
State the Posterior Probability Interpretation
Report the result as: "Given the data and [prior description], there is a 95% posterior probability that θ lies between [a] and [b]." This is the correct interpretation — do not use frequentist language ("95% of such intervals would contain θ"). The Bayesian statement is about the actual parameter given the actual data, not about a hypothetical procedure's long-run coverage.
Credible Interval Examples — 3 Fully Worked
Each example below walks through all five steps with complete arithmetic. The models are chosen for practical relevance: conversion rates (Beta-Binomial), clinical measurement (Normal-Normal), and a regression slope estimated via MCMC.
Example 1 — Beta-Binomial: Conversion Rate
Problem: A marketing team runs a landing page and observes 30 conversions from 100 visitors. Using a weakly informative prior Beta(2, 2), compute a 95% credible interval for the true conversion rate θ.
α₀ = 2 prior successes
β₀ = 2 prior failures
y = 30 observed conversions
n = 100 total visitors
Prior: θ ~ Beta(2, 2). This is weakly informative — it places most mass near 0.5 but keeps substantial probability across the whole (0, 1) range. The prior mean is α₀/(α₀+β₀) = 2/4 = 0.50.
Likelihood: y | θ ~ Binomial(n=100, θ). We observe y = 30 successes. The maximum likelihood estimate alone would be 30/100 = 0.30.
Posterior: By conjugacy, θ | D ~ Beta(α₀ + y, β₀ + n − y) = Beta(2+30, 2+70) = Beta(32, 72). The posterior mean = 32/(32+72) = 32/104 ≈ 0.308.
95% Equal-Tailed Interval: Extract the 2.5th and 97.5th percentiles of Beta(32, 72):
Lower bound (2.5th percentile) ≈ 0.224
Upper bound (97.5th percentile) ≈ 0.399
Interpretation: Given the 100 observations and the weakly informative prior, there is a 95% posterior probability that the true conversion rate θ lies between 22.4% and 39.9%.
✅ 95% Credible Interval: [0.224, 0.399]. Posterior mean = 0.308. The data shifted our prior belief from 50% toward the observed 30%, and the interval width (17.5 percentage points) reflects the limited sample size of 100 visitors.
Example 2 — Normal-Normal: Drug Effect Size
Problem: A clinical trial measures systolic blood pressure reduction (mmHg) after treatment. Prior research suggests μ ~ Normal(5, 4²). From n = 25 patients, the observed mean reduction is x̄ = 8 mmHg with known population SD σ = 10. Compute a 95% credible interval for the true mean reduction μ.
μ₀ = 5 prior mean
τ₀ = 4 prior SD
σ = 10 known likelihood SD
n = 25 sample size
Prior: μ ~ N(5, 16). Prior precision = 1/τ₀² = 1/16 = 0.0625.
Likelihood: x̄ | μ ~ N(μ, σ²/n) = N(μ, 100/25) = N(μ, 4). Data precision = n/σ² = 25/100 = 0.25.
Posterior: μ | D ~ N(μ_n, τ_n²) where:
1/τ_n² = 1/τ₀² + n/σ² = 0.0625 + 0.25 = 0.3125 → τ_n² = 3.2 → τ_n ≈ 1.789
μ_n = (5×0.0625 + 8×0.25) / 0.3125 = (0.3125 + 2.0) / 0.3125 = 7.40
95% Equal-Tailed Interval: μ_n ± 1.96 × τ_n = 7.40 ± 1.96 × 1.789 = 7.40 ± 3.51
Lower: 7.40 − 3.51 = 3.89 mmHg
Upper: 7.40 + 3.51 = 10.91 mmHg
Interpretation: Given the 25 patient measurements and the prior from previous research, there is a 95% posterior probability that the true mean blood pressure reduction lies between 3.89 and 10.91 mmHg.
✅ 95% Credible Interval: [3.89, 10.91] mmHg. The posterior mean (7.40) was pulled from the data average (8.0) toward the prior mean (5.0) because the prior had substantial weight relative to the data. With a larger sample, the prior influence diminishes.
Example 3 — Bayesian Linear Regression via MCMC
Problem: A researcher fits a Bayesian linear regression of exam scores (y) on study hours (x). Using weakly informative priors and 10,000 MCMC samples with R-hat < 1.01 (confirming convergence), the posterior samples for slope β₁ yield the following summaries. Compute the 95% HPD interval.
Prior: β₁ ~ N(0, 10²) — weakly informative, allowing slopes from very negative to very positive.
MCMC Sampling: 4 chains × 2,500 iterations = 10,000 posterior draws for β₁. Warm-up: 1,000 per chain. R-hat = 1.002 (converged). Effective sample size = 6,847.
Posterior Summaries from Samples:
Posterior mean: β₁ = 2.45 points per study hour
Posterior median: 2.43
Posterior SD: 0.67
95% HPD Interval: Using hdi(samples, credMass = 0.95):
Lower: 1.12 Upper: 3.78
(Slightly narrower than equal-tailed [1.14, 3.76] — the small difference indicates a near-symmetric posterior for β₁)
Interpretation: Given the data and weakly informative priors, there is a 95% posterior probability that each additional hour of study increases exam scores by between 1.12 and 3.78 points.
✅ 95% HPD Credible Interval for β₁: [1.12, 3.78]. The interval excludes zero, providing posterior evidence for a positive effect of study hours on exam performance. The APA reporting template from Section 7 applies directly to this result.
Credible Intervals vs Confidence Intervals
The distinction between credible and confidence intervals is one of the most persistently misunderstood topics in applied statistics. The two intervals sometimes produce similar numbers, which masks the fact that they answer different questions and rest on different philosophies of probability.
| Feature | Credible Interval | Confidence Interval |
|---|---|---|
| Framework | Bayesian inference | Frequentist inference |
| Nature of parameter θ | Random variable with a probability distribution | Fixed, unknown constant |
| What varies? | θ varies across its posterior; bounds are fixed once data are observed | The bounds are random (vary across samples); θ is fixed |
| Probability statement | "P(θ ∈ [a,b] | D) = 0.95" — direct posterior claim | "95% of such intervals will contain θ" — long-run coverage |
| Incorporates prior? | Yes — via explicit prior P(θ) | No — relies only on the likelihood / sampling distribution |
| Interpretation of a single interval | Has 95% probability of containing θ | Either contains θ or it doesn't (no probability for a single interval) |
| Requires sample repetition? | No — meaningful from a single dataset | Conceptually requires imagining infinite repetitions |
| Common computation | Quantiles of posterior; HPD optimization | x̄ ± z*(σ/√n) or x̄ ± t*(s/√n) |
| Software | brms, PyMC, Stan, rstan, ArviZ | Base R, scipy.stats, Python statsmodels |
Saying "there is a 95% probability that the true mean lies between 3.2 and 7.8" is the credible interval interpretation — and it is what most researchers want to say. But it is wrong for a frequentist confidence interval. For a confidence interval, the correct statement is: "This procedure, repeated many times, produces intervals that contain the true mean 95% of the time." The intuitive statement is literally what a credible interval provides.
The numbers can agree when the prior is flat (uninformative) and the sampling distribution is symmetric. A 95% credible interval from a Bayesian analysis with a flat prior and a 95% confidence interval from the same data often produce the same bounds. The difference is in what those bounds mean, not necessarily their values.
For a full treatment of confidence intervals, see the confidence intervals guide, which covers z-intervals, t-intervals, and proportion intervals. The distinction also matters when choosing between a t-interval vs z-interval.
Types of Credible Intervals
Equal-Tailed Interval
The equal-tailed interval (also called the central posterior interval) cuts α/2 probability from each tail of the posterior distribution. It is easy to compute — just two quantile function calls — and is the default output of most Bayesian software. The drawback is that for strongly skewed posteriors, the equal-tailed interval includes regions of low posterior density while excluding regions of higher density near the mode.
Highest Posterior Density (HPD) Interval
The HPD interval is constructed by finding a horizontal cutoff on the density curve such that the area above the cutoff equals 1−α. This produces the shortest possible interval with the required coverage. Every point inside has higher density than every point outside. For a skewed Beta posterior like Beta(2, 10), the HPD interval can be several percentage points narrower than the equal-tailed interval.
Posterior Credible Region (Multivariate)
When estimating multiple parameters jointly — for example, both coefficients in a simple linear regression — a credible region is the multivariate extension. It is a region in parameter space (an ellipse for Normal posteriors) rather than an interval on a line. The region captures (1−α) of the joint posterior probability. This is covered in detail in advanced Bayesian texts such as Bayesian Data Analysis by Gelman et al. (2013).
| Type | Definition | Best Used For | Drawback |
|---|---|---|---|
| Equal-Tailed | Cuts α/2 mass from each tail | Symmetric or near-symmetric posteriors; computational simplicity | Wider than HPD for skewed posteriors; includes low-density regions |
| HPD Interval | Shortest interval capturing (1−α) mass; all interior points have density ≥ all exterior points | Skewed, asymmetric, or multimodal posteriors | Can become disjoint if the posterior is multimodal; slightly harder to compute |
| Credible Region | Multivariate generalization: region in θ-space with (1−α) joint posterior mass | Joint inference on multiple parameters | Harder to visualize and summarize beyond 2 dimensions |
Bayesian Credible Interval Calculator
This calculator computes a 95% or 90% equal-tailed credible interval for a proportion θ using a conjugate Beta posterior. Enter the number of observed successes and total trials, along with your prior parameters, and the posterior interval updates automatically.
🧮 Beta-Binomial Posterior Credible Interval Calculator
Computing Credible Intervals in R and Python
Both R and Python have mature Bayesian tooling. The examples below match the Beta-Binomial scenario from Example 1 (posterior Beta(32, 72)) and demonstrate both equal-tailed and HPD computation.
R Code
# Posterior parameters from Beta-Binomial update
alpha_post <- 32 # prior alpha + observed successes = 2 + 30
beta_post <- 72 # prior beta + observed failures = 2 + 70
# Posterior mean and standard deviation
post_mean <- alpha_post / (alpha_post + beta_post)
post_sd <- sqrt(alpha_post * beta_post /
((alpha_post + beta_post)^2 * (alpha_post + beta_post + 1)))
cat("Posterior mean:", round(post_mean, 4), "\n")
cat("Posterior SD: ", round(post_sd, 4), "\n")
# 95% Equal-Tailed Credible Interval
equal_tailed <- qbeta(c(0.025, 0.975), alpha_post, beta_post)
cat("95% Equal-Tailed CI: [",
round(equal_tailed[1], 4), ",",
round(equal_tailed[2], 4), "]\n")
# 95% HPD Interval using HDInterval package
# install.packages("HDInterval")
library(HDInterval)
set.seed(42)
posterior_samples <- rbeta(100000, alpha_post, beta_post)
hpd <- hdi(posterior_samples, credMass = 0.95)
cat("95% HPD Interval: [",
round(hpd["lower"], 4), ",",
round(hpd["upper"], 4), "]\n")
Python Code
import numpy as np
import scipy.stats as stats
import arviz as az
# Posterior parameters
alpha_post = 32
beta_post = 72
# Posterior mean and SD
post_mean = alpha_post / (alpha_post + beta_post)
post_var = (alpha_post * beta_post) / ((alpha_post + beta_post)**2 * (alpha_post + beta_post + 1))
print(f"Posterior mean: {post_mean:.4f}")
print(f"Posterior SD: {post_var**0.5:.4f}")
# 95% Equal-Tailed Credible Interval via SciPy
lower_q = stats.beta.ppf(0.025, alpha_post, beta_post)
upper_q = stats.beta.ppf(0.975, alpha_post, beta_post)
print(f"95% Equal-Tailed CI: [{lower_q:.4f}, {upper_q:.4f}]")
# 95% HPD Interval via ArviZ
# pip install arviz
np.random.seed(42)
samples = np.random.beta(alpha_post, beta_post, size=100_000)
hpd_interval = az.hdi(samples, hdi_prob=0.95)
print(f"95% HPD Interval: [{hpd_interval[0]:.4f}, {hpd_interval[1]:.4f}]")
Real-World Applications
Credible intervals appear wherever researchers need direct probability statements about unknown quantities — and they are replacing confidence intervals in many applied fields precisely because the Bayesian statement is what decision-makers actually need.
Clinical Trials
Bayesian clinical trials report credible intervals for treatment effects, allowing trial monitoring boards to state the probability that a drug achieves a clinically meaningful effect threshold. The FDA has published guidance on Bayesian adaptive designs that use posterior credible intervals for interim decisions.
A/B Testing
Marketing and product teams use Beta-Binomial models to state: "There is an 87% probability that the new button increases conversions by at least 2 percentage points." This beats reporting a p-value, which says nothing about the magnitude or direction of the effect.
Machine Learning
Bayesian neural networks use variational inference or Monte Carlo Dropout to produce posterior distributions over weights, from which credible intervals for predictions are extracted. This gives calibrated uncertainty estimates for safety-critical AI applications.
Econometrics
Bayesian VAR models and structural break detection use credible intervals for macroeconomic parameters. The Bank of England and Federal Reserve use Bayesian methods in some of their forecasting models, where credible intervals communicate forecast uncertainty.
Genetics
Population genetics uses Bayesian methods to estimate allele frequencies and mutation rates from sequencing data. Credible intervals on effect sizes in genome-wide association studies are preferred because they incorporate prior information from related studies.
Environmental Science
Climate models use Bayesian methods to estimate climate sensitivity — how much warming results from a doubling of CO₂. The IPCC reports Bayesian credible ranges for these estimates, incorporating physical model uncertainty with observed temperature data.
How to Report Credible Intervals in a Research Paper
Reporting conventions for Bayesian credible intervals vary slightly by field, but the core requirement is consistent: state the interval type (equal-tailed or HPD), the posterior probability level, the prior specification, and the MCMC convergence diagnostics if sampling was used.
APA / Scientific Reporting Template
Standard Academic Reporting Format for Bayesian Results
"To quantify parameter uncertainty, we conducted Bayesian estimation. [Describe model and prior: e.g., 'A Beta(2, 2) prior was placed on the conversion rate θ, reflecting weak prior knowledge centered at 0.50.'] Posterior samples were obtained [analytically via conjugate update / using MCMC with 4 chains × 2,500 post-warmup iterations (R-hat < 1.01 for all parameters)]. The posterior mean was [value], with a [90% / 95% / 99%] [equal-tailed / HPD] credible interval of [[lower], [upper]]. This indicates that, given the data and prior, there is a [90% / 95% / 99%] posterior probability that the true parameter lies within the reported bounds."
Applied to Example 1: "The posterior mean conversion rate was 0.308, with a 95% equal-tailed credible interval of [0.224, 0.399], indicating a 95% posterior probability that the true conversion rate lies between 22.4% and 39.9% given the data and the weakly informative Beta(2, 2) prior."
State: (1) prior distribution and its justification; (2) interval type (equal-tailed or HPD); (3) credibility level (90%, 95%, 99%); (4) MCMC diagnostics (R-hat, effective sample size) if sampling was used; (5) the interval bounds with appropriate precision; (6) a direct posterior probability interpretation — never a frequentist long-run coverage statement.
Frequently Asked Questions
A credible interval is a range of numbers where a parameter (like a population mean or a drug's effect size) probably lies, with "probably" meaning a specific probability — say, 95%. After collecting data, you can say "there is a 95% chance the true value is between 3 and 7." This direct probability statement is what makes it Bayesian: the parameter is treated as having a probability distribution, not as a fixed unknown constant.
Yes — that is the correct interpretation for a credible interval. It is the interpretation that most people want to use for confidence intervals, but cannot. A 95% credible interval has exactly a 95% posterior probability of containing θ, conditional on the observed data and the prior. A 95% confidence interval does not support this statement for any single computed interval; it is a statement about the long-run procedure, not the specific interval in hand.
The credible interval narrows as sample size grows, because more data reduces posterior uncertainty. Additionally, with large samples, the likelihood dominates the prior, so different reasonable priors converge to similar posteriors. In the limit of very large n, the equal-tailed Bayesian credible interval and the frequentist confidence interval are numerically equivalent (Bernstein-von Mises theorem). The conceptual interpretation remains different, but the numbers agree.
Yes, especially with small samples. A strongly informative prior can pull the posterior toward the prior mean, narrowing or shifting the interval away from the raw data estimate. With large samples, the data likelihood dominates and the prior's influence diminishes. Best practice is to report the prior specification explicitly and, for important analyses, show a sensitivity analysis with two or three alternative priors to confirm the conclusions are robust.
Neither is universally better — they answer different questions under different frameworks. Credible intervals provide the intuitive direct probability statement most researchers want and accommodate prior information. Confidence intervals require no prior and have exact frequentist coverage guarantees without prior specification. The choice depends on whether you have meaningful prior information, whether you need the direct probability statement, and which framework your field uses. Many researchers default to confidence intervals for reporting but are increasingly adopting Bayesian methods in fields like clinical trials and machine learning.
For Bayesian linear regression, specify priors on the intercept, slope(s), and error SD, then use MCMC (via Stan, brms, or PyMC) to generate posterior samples for each parameter. Extract the 2.5th and 97.5th percentiles of the slope's posterior samples for the equal-tailed interval, or use hdi(slope_samples, credMass=0.95) for the HPD interval. Both brms in R and PyMC in Python handle this automatically and include credible intervals in their default summary output. See simple linear regression for frequentist methods, and the Stan documentation for the Bayesian approach.
Credible Interval Quick Reference
| Concept | Formula / Definition | Notes |
|---|---|---|
| Bayes' Theorem | P(θ|D) = P(D|θ)P(θ) / P(D) | Foundation of all Bayesian inference |
| Equal-Tailed CI bounds | a = F⁻¹(α/2|D), b = F⁻¹(1−α/2|D) | Use for symmetric posteriors; two quantile calls |
| HPD Interval | Shortest region ∫P(θ|D)dθ = 1−α where P(θ|D) ≥ C | Use for skewed posteriors; minimize interval width |
| Beta-Binomial update | Beta(α₀+y, β₀+n−y) | Conjugate model for proportions / conversion rates |
| Normal-Normal update | N(μ_n, τ_n²) — precision-weighted average | Conjugate model for means with known variance |
| Interpretation | P(θ ∈ [a,b] | D) = 1−α | Direct posterior probability — not long-run coverage |
| R equal-tailed | qbeta(c(0.025, 0.975), a, b) | Replace qbeta with qnorm, qt, etc. for other posteriors |
| R HPD | hdi(samples, credMass=0.95) | From the HDInterval package |
| Python equal-tailed | stats.beta.ppf([0.025, 0.975], a, b) | scipy.stats |
| Python HPD | az.hdi(samples, hdi_prob=0.95) | ArviZ library |
| MCMC convergence | R-hat < 1.01; ESS > 400 per parameter | Check before using MCMC-based intervals |
Related Topics on Statistics Fundamentals
Credible intervals sit within a broader framework of Bayesian inference and interval estimation. The guides below from Statistics Fundamentals cover the prerequisite and adjacent concepts:
Confidence Intervals
The frequentist counterpart to credible intervals. Covers z-intervals and t-intervals for means, proportions, and differences.
CI for the Mean
Step-by-step guide to computing confidence intervals for population means using the t-distribution.
Bayes' Theorem
The mathematical foundation underlying all Bayesian inference, with worked examples from medical testing and classification.
Hypothesis Testing
The frequentist framework for decision-making from data, covering p-values, significance levels, and test statistics.
Margin of Error
How the half-width of an interval relates to sample size, variability, and confidence level.
t-Interval vs z-Interval
When to use the t-distribution versus the standard normal distribution for computing frequentist confidence intervals.