Bayesian linear regression
   HOME

TheInfoList



OR:

Bayesian linear regression is a type of
conditional model Discriminative models, also referred to as conditional models, are a class of logistical models used for classification or regression. They distinguish decision boundaries through observed data, such as pass/fail, win/lose, alive/dead or healthy/si ...
ing in which the mean of one variable is described by a linear combination of other variables, with the goal of obtaining the
posterior probability The posterior probability is a type of conditional probability that results from updating the prior probability with information summarized by the likelihood via an application of Bayes' rule. From an epistemological perspective, the posterior ...
of the regression coefficients (as well as other parameters describing the distribution of the regressand) and ultimately allowing the out-of-sample prediction of the regressand (often labelled y) '' conditional on'' observed values of the regressors (usually X). The simplest and most widely used version of this model is the ''normal linear model'', in which y given X is distributed
Gaussian Carl Friedrich Gauss (1777–1855) is the eponym of all of the topics listed below. There are over 100 topics all named after this German mathematician and scientist, all in the fields of mathematics, physics, and astronomy. The English eponymo ...
. In this model, and under a particular choice of
prior probabilities In Bayesian probability, Bayesian statistical inference, a prior probability distribution, often simply called the prior, of an uncertain quantity is the probability distribution that would express one's beliefs about this quantity before some e ...
for the parameters—so-called
conjugate prior In Bayesian probability theory, if the posterior distribution p(\theta \mid x) is in the same probability distribution family as the prior probability distribution p(\theta), the prior and posterior are then called conjugate distributions, and th ...
s—the posterior can be found analytically. With more arbitrarily chosen priors, the posteriors generally have to be approximated.


Model setup

Consider a standard linear regression problem, in which for i = 1, \ldots, n we specify the mean of the
conditional distribution In probability theory and statistics, given two jointly distributed random variables X and Y, the conditional probability distribution of Y given X is the probability distribution of Y when X is known to be a particular value; in some cases the ...
of y_i given a k \times 1 predictor vector \mathbf_i: y_ = \mathbf_i^\mathsf \boldsymbol\beta + \varepsilon_i, where \boldsymbol\beta is a k \times 1 vector, and the \varepsilon_i are independent and identically normally distributed random variables: \varepsilon_ \sim N(0, \sigma^2). This corresponds to the following
likelihood function The likelihood function (often simply called the likelihood) represents the probability of random variable realizations conditional on particular values of the statistical parameters. Thus, when evaluated on a given sample, the likelihood funct ...
: \rho(\mathbf\mid\mathbf,\boldsymbol\beta,\sigma^) \propto (\sigma^2)^ \exp\left(-\frac (\mathbf- \mathbf \boldsymbol\beta)^\mathsf(\mathbf- \mathbf \boldsymbol\beta)\right). The
ordinary least squares In statistics, ordinary least squares (OLS) is a type of linear least squares method for choosing the unknown parameters in a linear regression model (with fixed level-one effects of a linear function of a set of explanatory variables) by the ...
solution is used to estimate the coefficient vector using the Moore–Penrose pseudoinverse: \hat = (\mathbf^\mathsf\mathbf)^\mathbf^\mathsf\mathbf where \mathbf is the n \times k
design matrix In statistics and in particular in regression analysis, a design matrix, also known as model matrix or regressor matrix and often denoted by X, is a matrix of values of explanatory variables of a set of objects. Each row represents an individual ob ...
, each row of which is a predictor vector \mathbf_i^\mathsf; and \mathbf is the column n-vector _1 \; \cdots \; y_n\mathsf. This is a
frequentist Frequentist inference is a type of statistical inference based in frequentist probability, which treats “probability” in equivalent terms to “frequency” and draws conclusions from sample-data by means of emphasizing the frequency or pro ...
approach, and it assumes that there are enough measurements to say something meaningful about \boldsymbol\beta. In the
Bayesian Thomas Bayes (/beɪz/; c. 1701 – 1761) was an English statistician, philosopher, and Presbyterian minister. Bayesian () refers either to a range of concepts and approaches that relate to statistical methods based on Bayes' theorem, or a followe ...
approach, the data are supplemented with additional information in the form of a
prior probability distribution In Bayesian statistical inference, a prior probability distribution, often simply called the prior, of an uncertain quantity is the probability distribution that would express one's beliefs about this quantity before some evidence is taken int ...
. The prior belief about the parameters is combined with the data's likelihood function according to
Bayes theorem In probability theory and statistics, Bayes' theorem (alternatively Bayes' law or Bayes' rule), named after Thomas Bayes, describes the probability of an event, based on prior knowledge of conditions that might be related to the event. For examp ...
to yield the posterior belief about the parameters \boldsymbol\beta and \sigma. The prior can take different functional forms depending on the domain and the information that is available ''a priori''. Since the data comprise both \mathbf and \mathbf, the focus only on the distribution of \mathbf conditional on \mathbf needs justification. In fact, a "full" Bayesian analysis would require a joint likelihood \rho(\mathbf,\mathbf\mid\boldsymbol\beta,\sigma^,\gamma) along with a prior \rho(\beta,\sigma^,\gamma), where \gamma symbolizes the parameters of the distribution for \mathbf. Only under the assumption of (weak) exogeneity can the joint likelihood be factored into \rho(\mathbf\mid\boldsymbol\mathbf,\beta,\sigma^)\rho(\mathbf\mid\gamma). The latter part is usually ignored under the assumption of disjoint parameter sets. More so, under classic assumptions \mathbf are considered chosen (for example, in a designed experiment) and therefore has a known probability without parameters.


With conjugate priors


Conjugate prior distribution

For an arbitrary prior distribution, there may be no analytical solution for the
posterior distribution The posterior probability is a type of conditional probability that results from updating the prior probability with information summarized by the likelihood via an application of Bayes' rule. From an epistemological perspective, the posterior p ...
. In this section, we will consider a so-called
conjugate prior In Bayesian probability theory, if the posterior distribution p(\theta \mid x) is in the same probability distribution family as the prior probability distribution p(\theta), the prior and posterior are then called conjugate distributions, and th ...
for which the posterior distribution can be derived analytically. A prior \rho(\boldsymbol\beta,\sigma^) is conjugate to this likelihood function if it has the same functional form with respect to \boldsymbol\beta and \sigma. Since the log-likelihood is quadratic in \boldsymbol\beta, the log-likelihood is re-written such that the likelihood becomes normal in (\boldsymbol\beta-\hat). Write \begin (\mathbf- \mathbf \boldsymbol\beta)^\mathsf(\mathbf- \mathbf \boldsymbol\beta) &= \mathbf- \mathbf \hat) + (\mathbf \hat - \mathbf \boldsymbol\beta)\mathsf \mathbf- \mathbf \hat) + (\mathbf \hat - \mathbf \boldsymbol\beta)\\ &= (\mathbf- \mathbf \hat)^\mathsf(\mathbf- \mathbf \hat) + (\boldsymbol\beta - \hat)^\mathsf(\mathbf^\mathsf\mathbf)(\boldsymbol\beta - \hat) + \underbrace_\\ &= (\mathbf- \mathbf \hat)^\mathsf(\mathbf- \mathbf \hat) + (\boldsymbol\beta - \hat)^\mathsf(\mathbf^\mathsf\mathbf)(\boldsymbol\beta - \hat)\,. \end The likelihood is now re-written as \rho(\mathbf, \mathbf,\boldsymbol\beta,\sigma^) \propto (\sigma^2)^ \exp\left(-\frac\right)(\sigma^2)^ \exp\left(-\frac(\boldsymbol\beta - \hat)^\mathsf(\mathbf^\mathsf\mathbf)(\boldsymbol\beta - \hat)\right), where vs^2 =(\mathbf- \mathbf \hat)^\mathsf(\mathbf- \mathbf \hat) \quad \text \quad v = n-k, where k is the number of regression coefficients. This suggests a form for the prior: \rho(\boldsymbol\beta,\sigma^2) = \rho(\sigma^2)\rho(\boldsymbol\beta\mid\sigma^2), where \rho(\sigma^2) is an
inverse-gamma distribution In probability theory and statistics, the inverse gamma distribution is a two-parameter family of continuous probability distributions on the positive real line, which is the distribution of the reciprocal of a variable distributed according to ...
\rho(\sigma^2) \propto (\sigma^2)^ \exp\left(-\frac\right). In the notation introduced in the
inverse-gamma distribution In probability theory and statistics, the inverse gamma distribution is a two-parameter family of continuous probability distributions on the positive real line, which is the distribution of the reciprocal of a variable distributed according to ...
article, this is the density of an \text( a_0, b_0) distribution with a_0=\tfrac and b_0=\tfrac v_0s_0^2 with v_0 and s_0^2 as the prior values of v and s^, respectively. Equivalently, it can also be described as a
scaled inverse chi-squared distribution The scaled inverse chi-squared distribution is the distribution for ''x'' = 1/''s''2, where ''s''2 is a sample mean of the squares of ν independent normal random variables that have mean 0 and inverse variance 1/σ2 = τ2. The distribu ...
, \text\chi^2(v_0, s_0^2). Further the conditional prior density \rho(\boldsymbol\beta, \sigma^) is a
normal distribution In statistics, a normal distribution or Gaussian distribution is a type of continuous probability distribution for a real-valued random variable. The general form of its probability density function is : f(x) = \frac e^ The parameter \mu ...
, \rho(\boldsymbol\beta\mid\sigma^2) \propto (\sigma^2)^ \exp\left(-\frac(\boldsymbol\beta - \boldsymbol\mu_0)^\mathsf \mathbf_0 (\boldsymbol\beta - \boldsymbol\mu_0)\right). In the notation of the
normal distribution In statistics, a normal distribution or Gaussian distribution is a type of continuous probability distribution for a real-valued random variable. The general form of its probability density function is : f(x) = \frac e^ The parameter \mu ...
, the conditional prior distribution is \mathcal\left(\boldsymbol\mu_0, \sigma^2 \boldsymbol\Lambda_0^\right).


Posterior distribution

With the prior now specified, the posterior distribution can be expressed as \begin \rho(\boldsymbol\beta,\sigma^2\mid\mathbf,\mathbf) &\propto \rho(\mathbf\mid\mathbf,\boldsymbol\beta,\sigma^2)\rho(\boldsymbol\beta\mid\sigma^2)\rho(\sigma^2) \\ & \propto (\sigma^2)^ \exp\left(-\frac(\mathbf- \mathbf \boldsymbol\beta)^\mathsf(\mathbf- \mathbf \boldsymbol\beta)\right) (\sigma^2)^ \exp\left(-\frac(\boldsymbol\beta -\boldsymbol\mu_0)^\mathsf \boldsymbol\Lambda_0 (\boldsymbol\beta - \boldsymbol\mu_0)\right) (\sigma^2)^ \exp\left(-\frac\right) \end With some re-arrangement, the posterior can be re-written so that the posterior mean \boldsymbol\mu_n of the parameter vector \boldsymbol\beta can be expressed in terms of the least squares estimator \hat and the prior mean \boldsymbol\mu_0, with the strength of the prior indicated by the prior precision matrix \boldsymbol\Lambda_0 \boldsymbol\mu_n = (\mathbf^\mathsf\mathbf+\boldsymbol\Lambda_0)^(\mathbf^\mathsf \mathbf\hat+\boldsymbol\Lambda_0\boldsymbol\mu_0) . To justify that \boldsymbol\mu_n is indeed the posterior mean, the quadratic terms in the exponential can be re-arranged as a quadratic form in \boldsymbol\beta - \boldsymbol\mu_n. (\mathbf- \mathbf \boldsymbol\beta)^\mathsf(\mathbf- \mathbf \boldsymbol\beta) + (\boldsymbol\beta - \boldsymbol\mu_0)^\mathsf\boldsymbol\Lambda_0(\boldsymbol\beta - \boldsymbol\mu_0) =(\boldsymbol\beta-\boldsymbol\mu_n)^\mathsf(\mathbf^\mathsf\mathbf+\boldsymbol\Lambda_0)(\boldsymbol\beta-\boldsymbol\mu_n)+\mathbf^\mathsf\mathbf-\boldsymbol\mu_n^\mathsf(\mathbf^\mathsf\mathbf+\boldsymbol\Lambda_0)\boldsymbol\mu_n+\boldsymbol\mu_0^\mathsf \boldsymbol\Lambda_0\boldsymbol\mu_0 . Now the posterior can be expressed as a
normal distribution In statistics, a normal distribution or Gaussian distribution is a type of continuous probability distribution for a real-valued random variable. The general form of its probability density function is : f(x) = \frac e^ The parameter \mu ...
times an
inverse-gamma distribution In probability theory and statistics, the inverse gamma distribution is a two-parameter family of continuous probability distributions on the positive real line, which is the distribution of the reciprocal of a variable distributed according to ...
: \rho(\boldsymbol\beta,\sigma^2\mid\mathbf,\mathbf) \propto (\sigma^2)^ \exp\left(-\frac(\boldsymbol\beta - \boldsymbol\mu_n)^\mathsf(\mathbf^\mathsf \mathbf+\mathbf_0)(\boldsymbol\beta - \boldsymbol\mu_n)\right) (\sigma^2)^ \exp\left(-\frac\right) . Therefore, the posterior distribution can be parametrized as follows. \rho(\boldsymbol\beta,\sigma^2\mid\mathbf,\mathbf) \propto \rho(\boldsymbol\beta \mid \sigma^2,\mathbf,\mathbf) \rho(\sigma^2\mid\mathbf,\mathbf), where the two factors correspond to the densities of \mathcal\left( \boldsymbol\mu_n, \sigma^2\boldsymbol\Lambda_n^ \right)\, and \text\left(a_n,b_n \right) distributions, with the parameters of these given by \boldsymbol\Lambda_n=(\mathbf^\mathsf\mathbf+\mathbf_0), \quad \boldsymbol\mu_n = (\boldsymbol\Lambda_n)^(\mathbf^\mathsf \mathbf \hat + \boldsymbol\Lambda_0 \boldsymbol\mu_0) , a_n= a_0 + \frac, \qquad b_n=b_0+\frac(\mathbf^\mathsf \mathbf + \boldsymbol\mu_0^\mathsf \boldsymbol\Lambda_0\boldsymbol\mu_0-\boldsymbol\mu_n^\mathsf \boldsymbol\Lambda_n \boldsymbol\mu_n) . which can be interpreted as Bayesian learning.


Model evidence

The
model evidence A marginal likelihood is a likelihood function that has been integrated over the parameter space. In Bayesian statistics, it represents the probability of generating the observed sample from a prior and is therefore often referred to as model evi ...
p(\mathbf\mid m) is the probability of the data given the model m. It is also known as the
marginal likelihood A marginal likelihood is a likelihood function that has been integrated over the parameter space. In Bayesian statistics, it represents the probability of generating the observed sample from a prior and is therefore often referred to as model evi ...
, and as the ''prior predictive density''. Here, the model is defined by the likelihood function p(\mathbf\mid\mathbf,\boldsymbol\beta,\sigma) and the prior distribution on the parameters, i.e. p(\boldsymbol\beta,\sigma). The model evidence captures in a single number how well such a model explains the observations. The model evidence of the Bayesian linear regression model presented in this section can be used to compare competing linear models by Bayesian model comparison. These models may differ in the number and values of the predictor variables as well as in their priors on the model parameters. Model complexity is already taken into account by the model evidence, because it marginalizes out the parameters by integrating p(\mathbf,\boldsymbol\beta,\sigma\mid\mathbf) over all possible values of \boldsymbol\beta and \sigma. p(\mathbf, m)=\int p(\mathbf\mid\mathbf,\boldsymbol\beta,\sigma)\, p(\boldsymbol\beta,\sigma)\, d\boldsymbol\beta\, d\sigma This integral can be computed analytically and the solution is given in the following equation. p(\mathbf\mid m)=\frac\sqrt \cdot \frac \cdot \frac Here \Gamma denotes the
gamma function In mathematics, the gamma function (represented by , the capital letter gamma from the Greek alphabet) is one commonly used extension of the factorial function to complex numbers. The gamma function is defined for all complex numbers except ...
. Because we have chosen a conjugate prior, the marginal likelihood can also be easily computed by evaluating the following equality for arbitrary values of \boldsymbol\beta and \sigma. p(\mathbf\mid m)=\frac Note that this equation is nothing but a re-arrangement of
Bayes theorem In probability theory and statistics, Bayes' theorem (alternatively Bayes' law or Bayes' rule), named after Thomas Bayes, describes the probability of an event, based on prior knowledge of conditions that might be related to the event. For examp ...
. Inserting the formulas for the prior, the likelihood, and the posterior and simplifying the resulting expression leads to the analytic expression given above.


Other cases

In general, it may be impossible or impractical to derive the posterior distribution analytically. However, it is possible to approximate the posterior by an approximate Bayesian inference method such as
Monte Carlo sampling Monte Carlo methods, or Monte Carlo experiments, are a broad class of computational algorithms that rely on repeated random sampling to obtain numerical results. The underlying concept is to use randomness to solve problems that might be determi ...
Carlin and Louis(2008) and Gelman, et al. (2003) explain how to use sampling methods for Bayesian linear regression. or
variational Bayes Variational Bayesian methods are a family of techniques for approximating intractable integrals arising in Bayesian inference and machine learning. They are typically used in complex statistical models consisting of observed variables (usuall ...
. The special case \boldsymbol\mu_0=0, \mathbf_0 = c\mathbf is called
ridge regression Ridge regression is a method of estimating the coefficients of multiple- regression models in scenarios where the independent variables are highly correlated. It has been used in many fields including econometrics, chemistry, and engineering. Als ...
. A similar analysis can be performed for the general case of the multivariate regression and part of this provides for Bayesian
estimation of covariance matrices In statistics, sometimes the covariance matrix of a multivariate random variable is not known but has to be estimated. Estimation of covariance matrices then deals with the question of how to approximate the actual covariance matrix on the basis ...
: see
Bayesian multivariate linear regression In statistics, Bayesian multivariate linear regression is a Bayesian approach to multivariate linear regression, i.e. linear regression where the predicted outcome is a vector of correlated random variables rather than a single scalar random v ...
.


See also

*
Bayes linear statistics Bayes linear statistics is a subjectivist statistical methodology and framework. Traditional subjective Bayesian analysis is based upon fully specified probability distributions, which are very difficult to specify at the necessary level of detail ...
*
Regularized least squares Regularized least squares (RLS) is a family of methods for solving the least-squares problem while using regularization to further constrain the resulting solution. RLS is used for two main reasons. The first comes up when the number of variables ...
*
Tikhonov regularization Ridge regression is a method of estimating the coefficients of multiple-regression models in scenarios where the independent variables are highly correlated. It has been used in many fields including econometrics, chemistry, and engineering. Also ...
*
Spike and slab variable selection Spike-and-slab regression is a type of Bayesian linear regression in which a particular hierarchical prior distribution for the regression coefficients is chosen such that only a subset of the possible regressors is retained. The technique that ...
* Bayesian interpretation of kernel regularization


Notes


References

* * * * * * *


External links

* Bayesian estimation of linear models (R programming wikibook). Bayesian linear regression as implemented in R. {{Statistics, correlation Linear regression Single-equation methods (econometrics)