Bayesian Regression

Statistics
Type
Bayesian linear model

What does it do?

Bayesian regression is a probabilistic version of linear regression that treats the model parameters as uncertain quantities.

Instead of returning a single best-fit estimate, it combines prior knowledge with the observed data to produce a full posterior probability distribution for each parameter, from which credible intervals and predictions are read off.

The intuition behind the method

Start with a prior belief about the parameters — what values are plausible before seeing the data — and update that belief with the evidence in the data to obtain a posterior. The posterior is not a single number but a distribution, so the answer carries its own uncertainty: parameters that the data pin down tightly have narrow posteriors, while those the data say little about stay close to the prior.

History

Bayesian regression is a direct application of Bayes' rule to the linear model, placing priors on the coefficients and the error variance; no single originator is attributed to it here. The posterior is usually sampled with MCMC or approximated with variational inference. Gelman et al. (2013) describes the workflow of sampling, convergence checking and model comparison.

When to use it

Choose Bayesian regression when the sample is small or sparse, so that a sensible prior stabilises estimates that the data alone would leave unstable. It is also the natural choice when genuine prior information exists and should enter the analysis, or when parameter effects and predictions must be reported as full distributions rather than point estimates with standard errors. Avoid it when the sample is large and there is no prior information to encode, because ordinary frequentist regression usually gives very similar answers at lower cost. The model as specified requires a continuous outcome with a Normal likelihood; binary variables can enter only as predictors (dummy coding). For a binary outcome, use a Bernoulli (logit) Bayesian model instead of this one.

Limitations and considerations

  • When n is small the posterior is dominated by the prior and the data adds little information.
  • Results are unreliable if prior-sensitivity analysis shows the posterior shifts with the prior choice.
  • Computationally heavier than frequentist fits, since the posterior must be sampled or approximated.
  • The Normal linear model assumes a linear mean in the predictors, independent observations, constant error variance and approximately Normal disturbances. Violations distort the posterior, so these should be checked, for example with posterior predictive checks of the residuals.
  • A Normal likelihood does not accommodate heavy-tailed or leptokurtic disturbances. A Student-t likelihood, as in Geweke (1993), is the usual robust alternative, and it is a different model that must be specified explicitly.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Reports full parameter uncertainty as a posterior distribution with credible intervals, not just a point estimate.
  • Incorporates prior knowledge and remains usable in small or sparse-data settings.
  • Predictions come with their own posterior distribution, giving honest uncertainty for forecasts.

Applications

  • Modelling relationships and making predictions when the sample is small or data is sparse.
  • Analyses where established prior information should be combined with new data.
  • Forecasting tasks that need calibrated predictive uncertainty rather than point forecasts.
  • Studies that report parameter effects as credible intervals alongside a frequentist baseline.

How it works

How it works

1

Bayes' rule is the engine: the posterior is proportional to the likelihood (how well the parameters explain the data) times the prior (belief before the data). This is how prior knowledge and observed evidence are formally combined.

Formula
p(\theta\mid y) \propto p(y\mid\theta)\,p(\theta)
2

The likelihood assumes each outcome is Normally distributed around a linear predictor Xβ with variance σ², the same mean structure as ordinary linear regression. A prior is placed on the coefficients β (e.g. a Normal prior) and on the variance σ² (e.g. an Inverse-Gamma prior).

Formula
y \sim \mathcal{N}(X\beta, \sigma^2)
3

Multiplying likelihood by priors gives the joint posterior over β and σ². For general models this posterior has no closed form, so it is explored by drawing samples with Markov chain Monte Carlo (MCMC, such as NUTS / Hamiltonian Monte Carlo) or approximated with variational inference; with conjugate Normal-Inverse-Gamma priors it is available in closed form. Posterior means and 95% credible intervals are then summarised from the samples.

Formula
p(\boldsymbol{\beta}, \sigma^2 \mid \mathbf{y}) \propto p(\mathbf{y} \mid \boldsymbol{\beta}, \sigma^2)\, p(\boldsymbol{\beta})\, p(\sigma^2)

Common pitfalls

  • Trusting the posterior without checking convergence (R-hat, effective sample size, trace plots).
  • Using an unintentionally strong prior that dominates the data, especially when n is small.
  • Skipping prior-sensitivity analysis and posterior predictive checks.
  • Interpreting a credible interval as if it were a frequentist confidence interval.

Frequently asked questions

What is the difference between a credible interval and a confidence interval?

A 95% credible interval is a direct probability statement: given the data and prior, there is a 95% probability the parameter lies in that range. A frequentist confidence interval is a statement about the long-run coverage of the procedure, not about a single interval. Reading a credible interval as a confidence interval (or vice versa) is a common mistake.

How do I choose a prior?

Use an informative prior when you have genuine prior knowledge to encode, and a weakly-informative prior when you mostly want to let the data speak while keeping estimates stable. Whatever you pick must be justified, and you should run a prior-sensitivity analysis — if the posterior shifts noticeably with reasonable prior changes, the result is not robust.

What are MCMC and R-hat?

MCMC (Markov chain Monte Carlo, e.g. NUTS / Hamiltonian Monte Carlo) draws samples from the posterior when it cannot be computed directly. R-hat is a convergence diagnostic that compares multiple chains; values below about 1.01, together with an adequate effective sample size, indicate the chains have mixed and the posterior summaries can be trusted.

How does Bayesian regression differ from OLS?

Ordinary least squares returns a single point estimate per coefficient with a standard error. Bayesian regression returns a full posterior distribution shaped by both the data and a prior, so it naturally handles small samples and prior information. With large samples and flat priors the two tend to agree closely.

How do I read a credible interval for a coefficient, and how does it differ from a predictive interval?

The 95% credible interval for a coefficient β_j is the range that contains β_j with 95% posterior probability. The posterior probability P(β_j > 0 | y) gives the probability that the effect is positive, which is the usual way to read its direction. A credible interval for the mean response Xβ reflects parameter uncertainty only. A posterior predictive interval for a new observation is wider, because it also includes the residual variance σ².

Related methods

Sources

  1. Gelman, A., Carlin, J. B., Stern, H. S., Dunson, D. B., Vehtari, A. & Rubin, D. B. (2013). Bayesian Data Analysis (3rd ed.). CRC Press.

    ISBN: 978-1439840955
  2. Introduction to Spatial Econometrics, p. 84