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 variable. A more general treatment of this approach can be found in the article MMSE estimator.

Details

Consider a regression problem where the dependent variable to be predicted is not a single real-valued scalar but an m-length vector of correlated real numbers. As in the standard regression setup, there are n observations, where each observation i consists of k−1 explanatory variables, grouped into a vector 𝐱i of length k (where a dummy variable with a value of 1 has been added to allow for an intercept coefficient). This can be viewed as a set of m related regression problems for each observation i: yi,1=𝐱i𝖳𝜷1+ϵi,1⋮yi,m=𝐱i𝖳𝜷m+ϵi,m where the set of errors {ϵi,1,…,ϵi,m} are all correlated. Equivalently, it can be viewed as a single regression problem where the outcome is a row vector 𝐲i𝖳 and the regression coefficient vectors are stacked next to each other, as follows: 𝐲i𝖳=𝐱i𝖳𝐁+𝝐i𝖳.

The coefficient matrix B is a k×m matrix where the coefficient vectors 𝜷1,…,𝜷m for each regression problem are stacked horizontally: 𝐁=[(𝜷1)⋯(𝜷m)]=[(β1,1⋮βk,1)⋯(β1,m⋮βk,m)].

The noise vector 𝝐i for each observation i is jointly normal, so that the outcomes for a given observation are correlated: 𝝐i∼N(0,𝜮ϵ).

We can write the entire regression problem in matrix form as: 𝐘=𝐗𝐁+𝐄, where Y and E are n×m matrices. The design matrix X is an n×k matrix with the observations stacked vertically, as in the standard linear regression setup: 𝐗=[𝐱1𝖳𝐱2𝖳⋮𝐱n𝖳]=[x1,1⋯x1,kx2,1⋯x2,k⋮⋱⋮xn,1⋯xn,k].

The classical, frequentists linear least squares solution is to simply estimate the matrix of regression coefficients 𝐁̂ using the Moore-Penrose pseudoinverse: 𝐁̂=(𝐗𝖳𝐗)−1𝐗𝖳𝐘.

To obtain the Bayesian solution, we need to specify the conditional likelihood and then find the appropriate conjugate prior. As with the univariate case of linear Bayesian regression, we will find that we can specify a natural conditional conjugate prior (which is scale dependent).

Let us write our conditional likelihood as ρ(𝐄|𝜮ϵ)∝|𝜮ϵ|−n/2exp⁡(−12tr⁡(𝐄𝖳𝜮ϵ−1𝐄)), writing the error 𝐄 in terms of 𝐘,𝐗, and 𝐁 yields ρ(𝐘|𝐗,𝐁,𝜮ϵ)∝|𝜮ϵ|−n/2exp⁡(−12tr⁡((𝐘−𝐗𝐁)𝖳𝜮ϵ−1(𝐘−𝐗𝐁))),

We seek a natural conjugate prior—a joint density ρ(𝐁,Σϵ) which is of the same functional form as the likelihood. Since the likelihood is quadratic in 𝐁, we re-write the likelihood so it is normal in (𝐁−𝐁̂) (the deviation from classical sample estimate).

Using the same technique as with Bayesian linear regression, we decompose the exponential term using a matrix-form of the sum-of-squares technique. Here, however, we will also need to use the Matrix Differential Calculus (Kronecker product and vectorization transformations).

First, let us apply sum-of-squares to obtain new expression for the likelihood: ρ(𝐘|𝐗,𝐁,𝜮ϵ)∝|𝜮ϵ|−(n−k)/2exp⁡(−tr⁡(12𝐒𝖳𝐒𝜮ϵ−1))|𝜮ϵ|−k/2exp⁡(−12tr⁡((𝐁−𝐁̂)𝖳𝐗𝖳𝐗(𝐁−𝐁̂)𝜮ϵ−1)), 𝐒=𝐘−𝐗𝐁̂

We would like to develop a conditional form for the priors: ρ(𝐁,𝜮ϵ)=ρ(𝜮ϵ)ρ(𝐁|𝜮ϵ), where ρ(𝜮ϵ) is an inverse-Wishart distribution and ρ(𝐁|𝜮ϵ) is some form of normal distribution in the matrix 𝐁. This is accomplished using the vectorization transformation, which converts the likelihood from a function of the matrices 𝐁,𝐁̂ to a function of the vectors 𝜷=vec⁡(𝐁),𝜷̂=vec⁡(𝐁̂).

Write tr⁡((𝐁−𝐁̂)𝖳𝐗𝖳𝐗(𝐁−𝐁̂)𝜮ϵ−1)=vec⁡(𝐁−𝐁̂)𝖳vec⁡(𝐗𝖳𝐗(𝐁−𝐁̂)𝜮ϵ−1)

Let vec⁡(𝐗𝖳𝐗(𝐁−𝐁̂)𝜮ϵ−1)=(𝜮ϵ−1⊗𝐗𝖳𝐗)vec⁡(𝐁−𝐁̂), where 𝐀⊗𝐁 denotes the Kronecker product of matrices A and B, a generalization of the outer product which multiplies an m×n matrix by a p×q matrix to generate an mp×nq matrix, consisting of every combination of products of elements from the two matrices.

Then vec⁡(𝐁−𝐁̂)𝖳(𝜮ϵ−1⊗𝐗𝖳𝐗)vec⁡(𝐁−𝐁̂)=(𝜷−𝜷̂)𝖳(𝜮ϵ−1⊗𝐗𝖳𝐗)(𝜷−𝜷̂) which will lead to a likelihood which is normal in (𝜷−𝜷̂).

With the likelihood in a more tractable form, we can now find a natural (conditional) conjugate prior.

Conjugate prior distribution

The natural conjugate prior using the vectorized variable 𝜷 is of the form: ρ(𝜷,𝜮ϵ)=ρ(𝜮ϵ)ρ(𝜷|𝜮ϵ), where ρ(𝜮ϵ)∼𝒲−1(𝐕0,𝝂0) and ρ(𝜷|𝜮ϵ)∼N(𝜷0,𝜮ϵ⊗𝜦0−1).

Posterior distribution

Using the above prior and likelihood, the posterior distribution can be expressed as: ρ(𝜷,𝜮ϵ|𝐘,𝐗)∝|𝜮ϵ|−(𝝂0+m+1)/2exp⁡(−12tr⁡(𝐕0𝜮ϵ−1))×|𝜮ϵ|−k/2exp⁡(−12tr⁡((𝐁−𝐁0)𝖳𝜦0(𝐁−𝐁0)𝜮ϵ−1))×|𝜮ϵ|−n/2exp⁡(−12tr⁡((𝐘−𝐗𝐁)𝖳(𝐘−𝐗𝐁)𝜮ϵ−1)), where vec⁡(𝐁0)=𝜷0. The terms involving 𝐁 can be grouped (with 𝜦0=𝐔𝖳𝐔) using: (𝐁−𝐁0)𝖳𝜦0(𝐁−𝐁0)+(𝐘−𝐗𝐁)𝖳(𝐘−𝐗𝐁)=([𝐘𝐔𝐁0]−[𝐗𝐔]𝐁)𝖳([𝐘𝐔𝐁0]−[𝐗𝐔]𝐁)=([𝐘𝐔𝐁0]−[𝐗𝐔]𝐁n)𝖳([𝐘𝐔𝐁0]−[𝐗𝐔]𝐁n)+(𝐁−𝐁n)𝖳(𝐗𝖳𝐗+𝜦0)(𝐁−𝐁n)=(𝐘−𝐗𝐁n)𝖳(𝐘−𝐗𝐁n)+(𝐁0−𝐁n)𝖳𝜦0(𝐁0−𝐁n)+(𝐁−𝐁n)𝖳(𝐗𝖳𝐗+𝜦0)(𝐁−𝐁n), with 𝐁n=(𝐗𝖳𝐗+𝜦0)−1(𝐗𝖳𝐗𝐁̂+𝜦0𝐁0)=(𝐗𝖳𝐗+𝜦0)−1(𝐗𝖳𝐘+𝜦0𝐁0).

This now allows us to write the posterior in a more useful form: ρ(𝜷,𝜮ϵ|𝐘,𝐗)∝|𝜮ϵ|−(𝝂0+m+n+1)/2exp⁡(−12tr⁡((𝐕0+(𝐘−𝐗𝐁𝐧)𝖳(𝐘−𝐗𝐁𝐧)+(𝐁n−𝐁0)𝖳𝜦0(𝐁n−𝐁0))𝜮ϵ−1))×|𝜮ϵ|−k/2exp⁡(−12tr⁡((𝐁−𝐁n)𝖳(𝐗T𝐗+𝜦0)(𝐁−𝐁n)𝜮ϵ−1)).

This takes the form of an inverse-Wishart distribution times a Matrix normal distribution: ρ(𝜮ϵ|𝐘,𝐗)∼𝒲−1(𝐕n,𝝂n) and ρ(𝐁|𝐘,𝐗,𝜮ϵ)∼ℳ𝒩k,m(𝐁n,𝜦n−1,𝜮ϵ).

The parameters of this posterior are given by: 𝐕n=𝐕0+(𝐘−𝐗𝐁𝐧)𝖳(𝐘−𝐗𝐁𝐧)+(𝐁n−𝐁0)𝖳𝜦0(𝐁n−𝐁0) 𝝂n=𝝂0+n 𝐁n=(𝐗𝖳𝐗+𝜦0)−1(𝐗𝖳𝐘+𝜦0𝐁0) 𝜦n=𝐗𝖳𝐗+𝜦0

See also

References

  1. 1 2 3 Peter E. Rossi, Greg M. Allenby, Rob McCulloch. Bayesian Statistics and Marketing. John Wiley & Sons, 2012, p. 32.