Bayesian Linear Regression

The Bayesian linear regression model is

where , , and the prior is the Normal-Inverse-Gamma (NIG) family scaled by . The conjugate posterior is again NIG with


Marginal posterior for (integrating out ):

a multivariate Student- centered at with degrees of freedom. The scale matrix inherits both the design-matrix geometry (through ) and the residual scale .

Posterior predictive for new inputs : again multivariate Student-,

The predictive covariance splits into noise variance () and parameter-uncertainty variance () — the latter grows with distance from the training design, producing natural uncertainty inflation for extrapolation.

Ridge-regression correspondence. With prior , the posterior mean is

exactly the ridge regression estimator with penalty . Ridge is the Bayesian MAP under a Gaussian prior; the Bayesian interpretation adds a principled way to choose (via marginal likelihood) and a credible interval on each coefficient.

Reference prior limit. With and (improper prior ), the posterior mean equals the OLS estimate , and the marginal posterior is with — numerically identical to the frequentist sampling distribution.

Prerequisites

Intuition

The conjugate analysis works because everything in the model is Gaussian. Writing the log-joint as a function of , both the prior and the likelihood contribute quadratic forms; their sum is another quadratic, completed to identify a Gaussian posterior for conditional on . The variance, , has its own Inverse-Gamma conjugate prior, and the two pieces combine into the NIG hierarchy. Integrating out of the joint posterior yields a Student- marginal for , mirroring the univariate Normal-Inverse-Gamma story in 3.5.2 Normal-Normal Model.

The matrix is the posterior precision: the data contribute their Gram matrix and the prior contributes . For ridge, regularizes directions where the data are information-poor (small eigenvalues of ). The prior effectively adds phantom observations that pull toward , and the ratio of prior-precision eigenvalues to data-precision eigenvalues controls how much each coordinate of is shrunk.

The predictive variance is the crucial Bayesian payoff. Plug-in prediction forgets that itself was estimated; the Bayesian predictive distribution correctly inflates variance by , which grows for test inputs far from the training design. A regression model is therefore automatically more uncertain about extrapolation — no post-hoc confidence-inflation tricks needed.

Properties

(Ridge as MAP Under Gaussian Prior) The ridge estimator is the posterior mode under .

Setting and yields posterior mean , the ridge estimator. The Bayesian view explains why ridge shrinks: the Gaussian prior puts mass near zero, so coefficients without strong data support are pulled toward zero. The choice of corresponds to choosing the prior’s concentration; cross-validation and Type-II MLE (evidence maximization, see 3.7 Marginal Likelihood) give two principled ways to set it.

(Lasso as MAP Under Laplace Prior) A Laplace (double-exponential) prior on yields the LASSO posterior mode.

Taking with density , the log-posterior is -fit plus ; maximizing it recovers the LASSO. The Laplace prior is not conjugate to the Gaussian likelihood — the posterior has no closed form, but it admits a data-augmented Gibbs sampler via a scale mixture representation. Practical Bayesian LASSO fits typically use the Park-Casella Gibbs sampler.

(Multivariate Student-t Marginal for ) Integrating out of the NIG posterior yields a Student- marginal for the coefficient vector.


Degrees of freedom grow linearly with ; the tails thicken for small and approach Gaussian as . The -th marginal is univariate Student-:

whose credible interval is . Under the reference prior limit this collapses to the classical -interval.

(Posterior Predictive is Multivariate Student-t) Predictions at new inputs inherit heavy tails and design-dependent uncertainty.


The predictive variance decomposes as noise variance plus parameter-uncertainty variance . For a test input far from training, is large; predictive intervals widen automatically. This is the discrete-grid analog of the increasing posterior variance in GP regression away from data.

(Reference-Prior Posterior Equals OLS Sampling Distribution) The Jeffreys prior limit recovers frequentist inference exactly.

With and ,

with . The Bayesian credible interval coincides numerically with the frequentist confidence interval, though the interpretations differ (see 3.2 Credible Intervals).

(Conjugate Gibbs Sampler) In non-conjugate extensions, the conditional for given stays Gaussian, enabling Gibbs.

If has any prior (not necessarily Inverse-Gamma), the conditional remains Gaussian — a full conditional ready for Gibbs. This conditional conjugacy is why Bayesian regression is a canonical Gibbs target even when the full joint is not conjugate. See 3.11.2 Gibbs Sampling.

(Evidence and Model Comparison) The marginal likelihood has closed form, enabling Bayesian model selection.


This lets Bayes factors compare nested linear models (whether to include a covariate, polynomial order, etc.) without resorting to BIC. The closed form also enables Type-II MLE tuning of (evidence-based choice of ridge penalty). See 3.7 Marginal Likelihood.

(Sensitivity to Prior Scale) Regression coefficient priors must be calibrated to covariate scale.

A prior has very different regularizing force when the covariate ranges over than when it ranges over . Standard practice is to standardize covariates before regression, making a unit-scale prior the default. Alternately, use a scale-invariant hierarchical prior that learns an appropriate per-coefficient scale.

Examples

Derivation

Goal: derive the NIG posterior for .

The likelihood times prior is


Collecting terms quadratic in inside the exponent:

by completing the square, with and . The constant-in- piece is

Substituting:

which is NIG with as stated.

Marginal posterior for : integrating out against the Inverse-Gamma marginal of the NIG. The resulting density is , the multivariate- kernel.

Posterior predictive: with and . Summing two Student- dependence structures preserves degrees of freedom and adds scales.

See Also