<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://debianws.lexgopc.com/wiki143/index.php?action=history&amp;feed=atom&amp;title=Bayesian_multivariate_linear_regression</id>
	<title>Bayesian multivariate linear regression - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://debianws.lexgopc.com/wiki143/index.php?action=history&amp;feed=atom&amp;title=Bayesian_multivariate_linear_regression"/>
	<link rel="alternate" type="text/html" href="http://debianws.lexgopc.com/wiki143/index.php?title=Bayesian_multivariate_linear_regression&amp;action=history"/>
	<updated>2026-10-25T21:04:18Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>http://debianws.lexgopc.com/wiki143/index.php?title=Bayesian_multivariate_linear_regression&amp;diff=3682509&amp;oldid=prev</id>
		<title>imported&gt;ArturGower: Corrected a typo where the Covariance matrix was placed. Now the forms fit the usual multi-variant Gaussian form.</title>
		<link rel="alternate" type="text/html" href="http://debianws.lexgopc.com/wiki143/index.php?title=Bayesian_multivariate_linear_regression&amp;diff=3682509&amp;oldid=prev"/>
		<updated>2025-01-29T18:42:51Z</updated>

		<summary type="html">&lt;p&gt;Corrected a typo where the Covariance matrix was placed. Now the forms fit the usual multi-variant Gaussian form.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{short description|Bayesian approach to multivariate linear regression}}&lt;br /&gt;
{{Regression bar}}&lt;br /&gt;
In [[statistics]], &amp;#039;&amp;#039;&amp;#039;Bayesian multivariate linear regression&amp;#039;&amp;#039;&amp;#039; is a&lt;br /&gt;
[[Bayesian inference|Bayesian]] approach to [[multivariate linear regression]], i.e. [[linear regression]] where the predicted outcome is a vector of correlated [[random variable]]s rather than a single scalar random variable. A more general treatment of this approach can be found in the article [[MMSE estimator]].&lt;br /&gt;
&lt;br /&gt;
==Details==&lt;br /&gt;
&lt;br /&gt;
Consider a regression problem where the [[dependent variable]] to be predicted is not a single [[real-valued]] scalar but an &amp;#039;&amp;#039;m&amp;#039;&amp;#039;-length vector of correlated real numbers.  As in the standard regression setup, there are &amp;#039;&amp;#039;n&amp;#039;&amp;#039; observations, where each observation &amp;#039;&amp;#039;i&amp;#039;&amp;#039; consists of &amp;#039;&amp;#039;k&amp;#039;&amp;#039;−1 [[explanatory variable]]s, grouped into a vector &amp;lt;math&amp;gt;\mathbf{x}_i&amp;lt;/math&amp;gt; of length &amp;#039;&amp;#039;k&amp;#039;&amp;#039; (where a [[dummy variable (statistics)|dummy variable]] with a value of 1 has been added to allow for an intercept coefficient).  This can be viewed as a set of &amp;#039;&amp;#039;m&amp;#039;&amp;#039; related regression problems for each observation &amp;#039;&amp;#039;i&amp;#039;&amp;#039;:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{align}&lt;br /&gt;
y_{i,1} &amp;amp;= \mathbf{x}_i^\mathsf{T}\boldsymbol\beta_{1} + \epsilon_{i,1} \\&lt;br /&gt;
&amp;amp;\;\;\vdots \\&lt;br /&gt;
y_{i,m} &amp;amp;= \mathbf{x}_i^\mathsf{T}\boldsymbol\beta_{m} + \epsilon_{i,m}&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
where the set of errors &amp;lt;math&amp;gt;\{ \epsilon_{i,1}, \ldots, \epsilon_{i,m}\}&amp;lt;/math&amp;gt; are all correlated. Equivalently, it can be viewed as a single regression problem where the outcome is a [[row vector]] &amp;lt;math&amp;gt;\mathbf{y}_i^\mathsf{T}&amp;lt;/math&amp;gt; and the regression coefficient vectors are stacked next to each other, as follows:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathbf{y}_i^\mathsf{T} = \mathbf{x}_i^\mathsf{T}\mathbf{B} + \boldsymbol\epsilon_{i}^\mathsf{T}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The [[coefficient matrix]] &amp;#039;&amp;#039;&amp;#039;B&amp;#039;&amp;#039;&amp;#039; is a &amp;lt;math&amp;gt;k \times m&amp;lt;/math&amp;gt; matrix where the coefficient vectors &amp;lt;math&amp;gt;\boldsymbol\beta_1,\ldots,\boldsymbol\beta_m&amp;lt;/math&amp;gt; for each regression problem are stacked horizontally:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathbf{B} =&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
\begin{pmatrix} \\ \boldsymbol\beta_1 \\ \\ \end{pmatrix}&lt;br /&gt;
\cdots&lt;br /&gt;
\begin{pmatrix} \\ \boldsymbol\beta_m \\ \\ \end{pmatrix}&lt;br /&gt;
\end{bmatrix}&lt;br /&gt;
=&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
\begin{pmatrix}&lt;br /&gt;
\beta_{1,1} \\ \vdots \\ \beta_{k,1}&lt;br /&gt;
\end{pmatrix}&lt;br /&gt;
\cdots&lt;br /&gt;
\begin{pmatrix}&lt;br /&gt;
\beta_{1,m} \\ \vdots \\ \beta_{k,m}&lt;br /&gt;
\end{pmatrix}&lt;br /&gt;
\end{bmatrix}&lt;br /&gt;
.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The noise vector &amp;lt;math&amp;gt;\boldsymbol\epsilon_{i}&amp;lt;/math&amp;gt; for each observation &amp;#039;&amp;#039;i&amp;#039;&amp;#039; is [[multivariate normal distribution|jointly normal]], so that the outcomes for a given observation are correlated:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\boldsymbol\epsilon_i \sim N(0, \boldsymbol\Sigma_{\epsilon}).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can write the entire regression problem in matrix form as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathbf{Y} = \mathbf{X}\mathbf{B} + \mathbf{E},&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;#039;&amp;#039;&amp;#039;Y&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;E&amp;#039;&amp;#039;&amp;#039; are &amp;lt;math&amp;gt;n \times m&amp;lt;/math&amp;gt; matrices.  The [[design matrix]] &amp;#039;&amp;#039;&amp;#039;X&amp;#039;&amp;#039;&amp;#039; is an &amp;lt;math&amp;gt;n \times k&amp;lt;/math&amp;gt; matrix with the observations stacked vertically, as in the standard [[linear regression]] setup:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
 \mathbf{X} = \begin{bmatrix} \mathbf{x}^\mathsf{T}_1 \\ \mathbf{x}^\mathsf{T}_2 \\ \vdots \\ \mathbf{x}^\mathsf{T}_n \end{bmatrix}&lt;br /&gt;
 = \begin{bmatrix} x_{1,1} &amp;amp; \cdots &amp;amp; x_{1,k} \\&lt;br /&gt;
 x_{2,1} &amp;amp; \cdots &amp;amp; x_{2,k} \\&lt;br /&gt;
 \vdots &amp;amp; \ddots &amp;amp; \vdots \\&lt;br /&gt;
 x_{n,1} &amp;amp; \cdots &amp;amp; x_{n,k}&lt;br /&gt;
 \end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The classical, frequentists [[linear least squares (mathematics)|linear least squares]] solution is to simply estimate the matrix of regression coefficients &amp;lt;math&amp;gt;\hat{\mathbf{B}}&amp;lt;/math&amp;gt; using the  [[Moore–Penrose pseudoinverse|Moore-Penrose]] [[pseudoinverse]]:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \hat{\mathbf{B}} = (\mathbf{X}^\mathsf{T}\mathbf{X})^{-1}\mathbf{X}^\mathsf{T}\mathbf{Y}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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 [[Bayesian linear regression|linear Bayesian regression]], we will find that we can specify a natural conditional conjugate prior (which is scale dependent).&lt;br /&gt;
&lt;br /&gt;
Let us write our conditional likelihood as&amp;lt;ref name=&amp;quot;BSaM&amp;quot;&amp;gt;Peter E. Rossi, Greg M. Allenby, Rob McCulloch. &amp;#039;&amp;#039;Bayesian Statistics and Marketing&amp;#039;&amp;#039;. John Wiley &amp;amp; Sons, 2012, p. 32.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\rho(\mathbf{E}|\boldsymbol\Sigma_{\epsilon}) \propto |\boldsymbol\Sigma_{\epsilon}|^{-n/2} \exp\left(-\tfrac{1}{2} \operatorname{tr}\left(\mathbf{E}^\mathsf{T} \boldsymbol\Sigma_{\epsilon}^{-1}\mathbf{E} \right) \right) ,&amp;lt;/math&amp;gt;&lt;br /&gt;
writing the error &amp;lt;math&amp;gt;\mathbf{E}&amp;lt;/math&amp;gt; in terms of &amp;lt;math&amp;gt;\mathbf{Y},\mathbf{X},&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{B}&amp;lt;/math&amp;gt; yields&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\rho(\mathbf{Y}|\mathbf{X},\mathbf{B},\boldsymbol\Sigma_{\epsilon}) \propto |\boldsymbol\Sigma_{\epsilon}|^{-n/2} \exp(-\tfrac{1}{2} \operatorname{tr}((\mathbf{Y}-\mathbf{X} \mathbf{B})^\mathsf{T} \boldsymbol\Sigma_{\epsilon}^{-1}(\mathbf{Y}-\mathbf{X} \mathbf{B})  ) ) ,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We seek a natural conjugate prior—a joint density &amp;lt;math&amp;gt;\rho(\mathbf{B},\Sigma_{\epsilon})&amp;lt;/math&amp;gt;  which is of the same functional form as the likelihood.  Since the likelihood is quadratic in &amp;lt;math&amp;gt;\mathbf{B}&amp;lt;/math&amp;gt;, we re-write the likelihood so it is normal in &amp;lt;math&amp;gt;(\mathbf{B}-\hat{\mathbf{B}})&amp;lt;/math&amp;gt; (the deviation from classical sample estimate).&lt;br /&gt;
&lt;br /&gt;
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 (mathematics)|vectorization]] transformations).&lt;br /&gt;
&lt;br /&gt;
First, let us apply sum-of-squares to obtain new expression for the likelihood:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\rho(\mathbf{Y}|\mathbf{X},\mathbf{B},\boldsymbol\Sigma_{\epsilon}) \propto |\boldsymbol\Sigma_{\epsilon}|^{-(n-k)/2} \exp(-\operatorname{tr}(\tfrac{1}{2}\mathbf{S}^\mathsf{T} \mathbf{S} \boldsymbol\Sigma_{\epsilon}^{-1}))  &lt;br /&gt;
|\boldsymbol\Sigma_{\epsilon}|^{-k/2} \exp(-\tfrac{1}{2} \operatorname{tr}((\mathbf{B}-\hat{\mathbf{B}})^\mathsf{T} \mathbf{X}^\mathsf{T} \mathbf{X}(\mathbf{B}-\hat{\mathbf{B}}) \boldsymbol\Sigma_{\epsilon}^{-1} ) )&lt;br /&gt;
,&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathbf{S} = \mathbf{Y} - \mathbf{X}\hat{\mathbf{B}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We would like to develop a conditional form for the priors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\rho(\mathbf{B},\boldsymbol\Sigma_{\epsilon}) = \rho(\boldsymbol\Sigma_{\epsilon})\rho(\mathbf{B}|\boldsymbol\Sigma_{\epsilon}),&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho(\boldsymbol\Sigma_{\epsilon})&amp;lt;/math&amp;gt; is an [[inverse-Wishart distribution]]&lt;br /&gt;
and &amp;lt;math&amp;gt;\rho(\mathbf{B}|\boldsymbol\Sigma_{\epsilon})&amp;lt;/math&amp;gt; is some form of [[normal distribution]] in the matrix &amp;lt;math&amp;gt;\mathbf{B}&amp;lt;/math&amp;gt;.  This is accomplished using the [[vectorization (mathematics)|vectorization]] transformation, which converts the likelihood from a function of the matrices &amp;lt;math&amp;gt;\mathbf{B}, \hat{\mathbf{B}}&amp;lt;/math&amp;gt; to a function of the vectors &amp;lt;math&amp;gt;\boldsymbol\beta = \operatorname{vec}(\mathbf{B}), \hat{\boldsymbol\beta} = \operatorname{vec}(\hat{\mathbf{B}})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Write&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\operatorname{tr}((\mathbf{B} - \hat{\mathbf{B}})^\mathsf{T}\mathbf{X}^\mathsf{T} \mathbf{X}(\mathbf{B} - \hat{\mathbf{B}}) \boldsymbol\Sigma_\epsilon^{-1}) = \operatorname{vec}(\mathbf{B} - \hat{\mathbf{B}})^\mathsf{T} \operatorname{vec}(\mathbf{X}^\mathsf{T} \mathbf{X}(\mathbf{B} - \hat{\mathbf{B}}) \boldsymbol\Sigma_{\epsilon}^{-1} )&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \operatorname{vec}(\mathbf{X}^\mathsf{T} \mathbf{X}(\mathbf{B} - \hat{\mathbf{B}}) \boldsymbol\Sigma_{\epsilon}^{-1} ) =  (\boldsymbol\Sigma_{\epsilon}^{-1} \otimes \mathbf{X}^\mathsf{T}\mathbf{X} )\operatorname{vec}(\mathbf{B} - \hat{\mathbf{B}}), &amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;\mathbf{A} \otimes \mathbf{B}&amp;lt;/math&amp;gt; denotes the [[Kronecker product]] of matrices &amp;#039;&amp;#039;&amp;#039;A&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;B&amp;#039;&amp;#039;&amp;#039;, a generalization of the [[outer product]] which multiplies an &amp;lt;math&amp;gt;m \times n&amp;lt;/math&amp;gt; matrix by a &amp;lt;math&amp;gt;p \times q&amp;lt;/math&amp;gt; matrix to generate an &amp;lt;math&amp;gt;mp \times nq&amp;lt;/math&amp;gt; matrix, consisting of every combination of products of elements from the two matrices.&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{align}&lt;br /&gt;
&amp;amp;\operatorname{vec}(\mathbf{B} - \hat{\mathbf{B}})^\mathsf{T} (\boldsymbol\Sigma_{\epsilon}^{-1} \otimes \mathbf{X}^\mathsf{T}\mathbf{X} )\operatorname{vec}(\mathbf{B} - \hat{\mathbf{B}}) \\&lt;br /&gt;
&amp;amp;= (\boldsymbol\beta - \hat{\boldsymbol\beta})^\mathsf{T}(\boldsymbol\Sigma_{\epsilon}^{-1} \otimes \mathbf{X}^\mathsf{T}\mathbf{X} )(\boldsymbol\beta-\hat{\boldsymbol\beta})&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
which will lead to a likelihood which is normal in &amp;lt;math&amp;gt;(\boldsymbol\beta - \hat{\boldsymbol\beta})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
With the likelihood in a more tractable form, we can now find a natural (conditional) conjugate prior.&lt;br /&gt;
&lt;br /&gt;
===Conjugate prior distribution===&lt;br /&gt;
&lt;br /&gt;
The natural conjugate prior using the vectorized variable &amp;lt;math&amp;gt;\boldsymbol\beta&amp;lt;/math&amp;gt; is of the form:&amp;lt;ref name=&amp;quot;BSaM&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\rho(\boldsymbol\beta, \boldsymbol\Sigma_{\epsilon}) = \rho(\boldsymbol\Sigma_{\epsilon})\rho(\boldsymbol\beta|\boldsymbol\Sigma_{\epsilon}),&amp;lt;/math&amp;gt;&lt;br /&gt;
where&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \rho(\boldsymbol\Sigma_{\epsilon}) \sim \mathcal{W}^{-1}(\mathbf V_0,\boldsymbol\nu_0)&amp;lt;/math&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \rho(\boldsymbol\beta|\boldsymbol\Sigma_{\epsilon}) \sim N(\boldsymbol\beta_0, \boldsymbol\Sigma_{\epsilon} \otimes \boldsymbol\Lambda_0^{-1}).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Posterior distribution===&lt;br /&gt;
&lt;br /&gt;
Using the above prior and likelihood, the posterior distribution can be expressed as:&amp;lt;ref name=&amp;quot;BSaM&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{align}&lt;br /&gt;
\rho(\boldsymbol\beta,\boldsymbol\Sigma_{\epsilon}|\mathbf{Y},\mathbf{X})&lt;br /&gt;
\propto{}&amp;amp; |\boldsymbol\Sigma_{\epsilon}|^{-(\boldsymbol\nu_0 + m + 1)/2}\exp{(-\tfrac{1}{2}\operatorname{tr}(\mathbf V_0 \boldsymbol\Sigma_{\epsilon}^{-1}))} \\&lt;br /&gt;
&amp;amp;\times|\boldsymbol\Sigma_{\epsilon}|^{-k/2}\exp{(-\tfrac{1}{2} \operatorname{tr}((\mathbf{B}-\mathbf B_0)^\mathsf{T}\boldsymbol\Lambda_0(\mathbf{B}-\mathbf B_0)\boldsymbol\Sigma_{\epsilon}^{-1}))} \\&lt;br /&gt;
&amp;amp;\times|\boldsymbol\Sigma_{\epsilon}|^{-n/2}\exp{(-\tfrac{1}{2}\operatorname{tr}((\mathbf{Y}-\mathbf{XB})^\mathsf{T}(\mathbf{Y}-\mathbf{XB})\boldsymbol\Sigma_{\epsilon}^{-1}))},&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math&amp;gt;\operatorname{vec}(\mathbf B_0) = \boldsymbol\beta_0&amp;lt;/math&amp;gt;.&lt;br /&gt;
The terms involving &amp;lt;math&amp;gt;\mathbf{B}&amp;lt;/math&amp;gt; can be grouped (with &amp;lt;math&amp;gt;\boldsymbol\Lambda_0 = \mathbf{U}^\mathsf{T}\mathbf{U}&amp;lt;/math&amp;gt;) using:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{align}&lt;br /&gt;
&amp;amp; \left(\mathbf{B} - \mathbf B_0\right)^\mathsf{T} \boldsymbol\Lambda_0 \left(\mathbf{B} - \mathbf B_0\right) + \left(\mathbf{Y} - \mathbf{XB}\right)^\mathsf{T} \left(\mathbf{Y} - \mathbf{XB}\right) \\&lt;br /&gt;
={}&amp;amp; \left(\begin{bmatrix}\mathbf Y \\ \mathbf U \mathbf B_0\end{bmatrix} - \begin{bmatrix}\mathbf{X}\\ \mathbf{U}\end{bmatrix}\mathbf{B}\right)^\mathsf{T} \left(\begin{bmatrix}\mathbf{Y}\\ \mathbf U \mathbf B_0\end{bmatrix}-\begin{bmatrix}\mathbf{X}\\ \mathbf{U}\end{bmatrix}\mathbf{B}\right) \\&lt;br /&gt;
={}&amp;amp; \left(\begin{bmatrix}\mathbf Y \\ \mathbf U \mathbf B_0\end{bmatrix} - \begin{bmatrix}\mathbf{X}\\ \mathbf{U}\end{bmatrix}\mathbf B_n\right)^\mathsf{T}\left(\begin{bmatrix}\mathbf{Y}\\ \mathbf U \mathbf B_0\end{bmatrix}-\begin{bmatrix}\mathbf{X}\\ \mathbf{U}\end{bmatrix}\mathbf B_n\right) + \left(\mathbf B - \mathbf B_n\right)^\mathsf{T} \left(\mathbf{X}^\mathsf{T} \mathbf{X} + \boldsymbol\Lambda_0\right) \left(\mathbf{B}-\mathbf B_n\right) \\&lt;br /&gt;
={}&amp;amp; \left(\mathbf{Y} - \mathbf X \mathbf B_n \right)^\mathsf{T} \left(\mathbf{Y} - \mathbf X \mathbf B_n\right) + \left(\mathbf B_0 - \mathbf B_n\right)^\mathsf{T} \boldsymbol\Lambda_0 \left(\mathbf B_0 - \mathbf B_n\right) + \left(\mathbf{B} - \mathbf B_n\right)^\mathsf{T} \left(\mathbf{X}^\mathsf{T} \mathbf{X} + \boldsymbol\Lambda_0\right)\left(\mathbf B - \mathbf B_n\right),&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
with&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathbf B_n = \left(\mathbf{X}^\mathsf{T}\mathbf{X} + \boldsymbol\Lambda_0\right)^{-1}\left(\mathbf{X}^\mathsf{T} \mathbf{X} \hat{\mathbf{B}} + \boldsymbol\Lambda_0\mathbf B_0\right) = \left(\mathbf{X}^\mathsf{T} \mathbf{X} + \boldsymbol\Lambda_0\right)^{-1}\left(\mathbf{X}^\mathsf{T} \mathbf{Y} + \boldsymbol\Lambda_0 \mathbf B_0\right).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This now allows us to write the posterior in a more useful form:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{align}&lt;br /&gt;
\rho(\boldsymbol\beta,\boldsymbol\Sigma_{\epsilon}|\mathbf{Y},\mathbf{X})&lt;br /&gt;
\propto{}&amp;amp;|\boldsymbol\Sigma_{\epsilon}|^{-(\boldsymbol\nu_0 + m + n + 1)/2}\exp{(-\tfrac{1}{2}\operatorname{tr}((\mathbf V_0 + (\mathbf{Y}-\mathbf{XB_n})^\mathsf{T} (\mathbf{Y}-\mathbf{XB_n}) + (\mathbf B_n-\mathbf B_0)^\mathsf{T}\boldsymbol\Lambda_0(\mathbf B_n-\mathbf B_0))\boldsymbol\Sigma_{\epsilon}^{-1}))} \\&lt;br /&gt;
&amp;amp;\times|\boldsymbol\Sigma_{\epsilon}|^{-k/2}\exp{(-\tfrac{1}{2}\operatorname{tr}((\mathbf{B}-\mathbf B_n)^\mathsf{T} (\mathbf{X}^T\mathbf{X} + \boldsymbol\Lambda_0) (\mathbf{B}-\mathbf B_n)\boldsymbol\Sigma_{\epsilon}^{-1}))}.&lt;br /&gt;
\end{align}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This takes the form of an [[inverse-Wishart distribution]] times a [[Matrix normal distribution]]:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\rho(\boldsymbol\Sigma_{\epsilon}|\mathbf{Y},\mathbf{X}) \sim \mathcal{W}^{-1}(\mathbf V_n,\boldsymbol\nu_n)&amp;lt;/math&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \rho(\mathbf{B}|\mathbf{Y},\mathbf{X},\boldsymbol\Sigma_{\epsilon}) \sim \mathcal{MN}_{k,m}(\mathbf B_n, \boldsymbol\Lambda_n^{-1}, \boldsymbol\Sigma_{\epsilon}).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The parameters of this posterior are given by:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathbf V_n = \mathbf V_0 + (\mathbf{Y}-\mathbf{XB_n})^\mathsf{T}(\mathbf{Y}-\mathbf{XB_n}) + (\mathbf B_n - \mathbf B_0)^\mathsf{T}\boldsymbol\Lambda_0(\mathbf B_n-\mathbf B_0)&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\boldsymbol\nu_n = \boldsymbol\nu_0 + n&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathbf B_n = (\mathbf{X}^\mathsf{T}\mathbf{X} + \boldsymbol\Lambda_0)^{-1}(\mathbf{X}^\mathsf{T} \mathbf{Y} + \boldsymbol\Lambda_0\mathbf B_0)&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\boldsymbol\Lambda_n = \mathbf{X}^\mathsf{T} \mathbf{X} + \boldsymbol\Lambda_0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[Bayesian linear regression]]&lt;br /&gt;
* [[Matrix normal distribution]]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Reflist}}&lt;br /&gt;
{{More footnotes|date=November 2010}}&lt;br /&gt;
* {{cite book |authorlink= George E. P. Box |last1= Box |first1= G. E. P. |author2-link=George Tiao |last2= Tiao |first2= G. C. |year= 1973 |title= Bayesian Inference in Statistical Analysis |chapter= 8 |publisher= Wiley |isbn= 0-471-57428-7 }}&lt;br /&gt;
* {{cite journal|last= Geisser|first= S. |year= 1965 |title= Bayesian Estimation in Multivariate Analysis |journal= [[The Annals of Mathematical Statistics]] |volume= 36 |issue= 1 |pages= 150&amp;amp;ndash;159 |doi= 10.1214/aoms/1177700279 |jstor= 2238083|doi-access= free }}&lt;br /&gt;
* {{cite journal|last1= Tiao |first1= G. C. |last2= Zellner |first2= A. |year= 1964 |title= On the Bayesian Estimation of Multivariate Regression |journal= [[Journal of the Royal Statistical Society. Series B (Methodological)]] |volume= 26 |issue= 2 |pages= 277&amp;amp;ndash;285 |doi= 10.1111/j.2517-6161.1964.tb00560.x |jstor= 2984424}}&lt;br /&gt;
&lt;br /&gt;
{{DEFAULTSORT:Bayesian Multivariate Linear Regression}}&lt;br /&gt;
[[Category:Bayesian inference|Multivariate linear regression]]&lt;br /&gt;
[[Category:Single-equation methods (econometrics)]]&lt;/div&gt;</summary>
		<author><name>imported&gt;ArturGower</name></author>
	</entry>
</feed>