<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Gauss-Markov |</title><link>https://kristianeschenburg.netlify.app/tag/gauss-markov/</link><atom:link href="https://kristianeschenburg.netlify.app/tag/gauss-markov/index.xml" rel="self" type="application/rss+xml"/><description>Gauss-Markov</description><generator>Source Themes Academic (https://sourcethemes.com/academic/)</generator><language>en-us</language><lastBuildDate>Sat, 12 May 2018 03:14:14 -0700</lastBuildDate><image><url>https://kristianeschenburg.netlify.app/img/Bayes.jpg</url><title>Gauss-Markov</title><link>https://kristianeschenburg.netlify.app/tag/gauss-markov/</link></image><item><title>Multivariate Normal Distribution</title><link>https://kristianeschenburg.netlify.app/post/multivariate-normal-distribution/</link><pubDate>Sat, 12 May 2018 03:14:14 -0700</pubDate><guid>https://kristianeschenburg.netlify.app/post/multivariate-normal-distribution/</guid><description>&lt;p>In this post, I&amp;rsquo;ll be covering the basics of Multivariate Normal Distributions, with special emphasis on deriving the conditional and marginal distributions.&lt;/p>
&lt;p>Given a random variable under the usual Gauss-Markov assumptions, with $y_{i} \sim N(\mu, \sigma^{2})$ with $e \sim N(0,\sigma^{2})$, and $N$ independent samples $y_{1}&amp;hellip;y_{n}$, we can define vector $\mathbf{y} = [y_{1}, y_{2},&amp;hellip;y_{n}] \sim N_{n}(\mathbf{\mu},\sigma^{2}I)$ with $\mathbf{e} \sim N_{n}(\mathbf{0},\sigma^{2}I)$. We can see from the covariance structure of the errors that all off-diagonal elements are 0, indicating that our samples are independent with equal variances.&lt;/p>
&lt;p>&lt;strong>Marginal Distributions&lt;/strong>&lt;/p>
&lt;p>Now assume that $\mathbf{y} = [\mathbf{y_{1}}, \mathbf{y_{2}} ] \sim N(\mathbf{\mu},\Sigma)$, where $\mathbf{\mu} = \begin{bmatrix} \mu_{1} \ \mu_{2} \end{bmatrix}$, and $\Sigma$ is an arbitrary covariance matrix, where we cannot assume independence. If $\Sigma$ is non-singular, we can decompose $\Sigma$ as&lt;/p>
&lt;p>$$ \Sigma = \begin{bmatrix}
\Sigma_{11} &amp;amp; \Sigma_{21}^{T} \\
\Sigma_{21} &amp;amp; \Sigma_{22}
\end{bmatrix}$$&lt;/p>
&lt;p>and, using the inversion lemmas from
&lt;a href="https://kristianeschenburg.netlify.app/post/blockwise-matrix-inversion/">Blockwise Matrix Inversion&lt;/a>, define its inverse $\Sigma^{-1} = V$ as&lt;/p>
&lt;p>$$
V = \begin{bmatrix}
V_{11} &amp;amp; V_{21}^{T} \\
V_{21} &amp;amp; V_{22} \\
\end{bmatrix}
\begin{bmatrix}
(\Sigma_{11} - \Sigma_{12}\Sigma_{22}^{-1}\Sigma_{21})^{-1} &amp;amp; -\Sigma^{-1}\Sigma_{12}(\Sigma_{22} - \Sigma_{21}\Sigma_{11}^{-1}\Sigma_{12})^{-1} \\
-\Sigma_{22}^{-1}\Sigma_{21}(\Sigma_{11}-\Sigma_{12}\Sigma_{22}^{-1}\Sigma_{21})^{-1} &amp;amp; (\Sigma_{22} - \Sigma_{21}\Sigma_{11}^{-1}\Sigma_{12})^{-1}
\end{bmatrix}$$&lt;/p>
&lt;p>From the properties of transformations of Normal random variables, we can define the marginal of $$y_{1}$$ as&lt;/p>
&lt;p>$$\begin{align}
By \sim N(B\mu,B\Sigma B^{T})
\end{align}$$&lt;/p>
&lt;p>where $B = \begin{bmatrix} \mathbf{I} &amp;amp; 0 \end{bmatrix}$ such that&lt;/p>
&lt;p>$$ \begin{bmatrix} \mathbf{I} &amp;amp; 0 \end{bmatrix} \begin{bmatrix} \mathbf{\mu_{1}} \ \mathbf{\mu_{2}} \end{bmatrix} = \mathbf{\mu_{1}}$$
$$\begin{bmatrix} \mathbf{I} &amp;amp; 0
\end{bmatrix} \begin{bmatrix}
\Sigma_{11} &amp;amp; \Sigma_{12} \\
\Sigma_{21} &amp;amp; \Sigma_{22}
\end{bmatrix}
\begin{bmatrix}
\mathbf{I} \\
0
\end{bmatrix} = \Sigma_{11}$$&lt;/p>
&lt;p>so that $\mathbf{y_{1}} \sim N(\mathbf{\mu_{1}},\Sigma_{11})$.&lt;/p>
&lt;p>&lt;strong>Conditional Distributions&lt;/strong>&lt;/p>
&lt;p>Showing the conditional distribution is a bit long-winded, so bear with me. We are interested in finding the distribution of $y_{2}\mid y_{1}$, which we can explicitly represent as&lt;/p>
&lt;p>$$\begin{align}
f_{y_{1}}(y_{2} \mid y_{1}) = \frac{f_{y_{1},y_{2}}(y_{1},y_{2})}{f_{y_{1}}(y_{1})}
\end{align}$$&lt;/p>
&lt;p>Writing out the joint density for $y$, we have the following&lt;/p>
&lt;p>$$\begin{align}
f(y) = \frac{1}{(2\pi)^{n/2}\mid \Sigma \mid ^{1/2}}\exp^{(-1/2)(y-\mu)^{T}\Sigma^{-1}(y-\mu)}
\end{align}$$&lt;/p>
&lt;p>Partitioning this expression up into the individual terms related to $y_{1}$ and $y_{2}$, the exponent becomes&lt;/p>
&lt;p>$$ (y-\mu)^{T}V(y-\mu) = \begin{bmatrix}
y_{1} - \mu_{1} \\
y_{2} - \mu_{2} \end{bmatrix}^{T}
\begin{bmatrix}
V_{11} &amp;amp; V_{12} \\
V_{21} &amp;amp; V_{22} \end{bmatrix}
\begin{bmatrix}
y_{1} - \mu_{1} \\
y_{2} - \mu_{2}
\end{bmatrix}$$&lt;/p>
&lt;p>Expanding this quadratic form out, we see that we end up with&lt;/p>
&lt;p>$$\begin{align}
(y_{1} - \mu_{1})^{T} V_{11}^{-1}(y_{1}-\mu_{1}) + 2(y_{1}-\mu_{1})^{T}V_{12}(y_{2}-\mu_{2}) + (y_{2} - \mu_{2})^{T}V_{22}(y_{2}-\mu_{2})
\end{align}$$&lt;/p>
&lt;p>Let us, for simplicity, set $z_{1} = (y_{1} - \mu_{1})$ and $z_{2} = (y_{2} - \mu_{2})$. Substituting back in our definitions of $V_{11}$,$V_{12}$,$V_{21}$, and $V_{22}$, and using the Sherman-Morrison-Woodbury definition for $V_{11}$, we have the following&lt;/p>
&lt;p>$$\begin{align}
&amp;amp;z_{1}^{T}(\Sigma_{11}^{-1} + \Sigma_{11}^{-1}\Sigma_{12}(\Sigma_{22} - \Sigma_{21}\Sigma_{11}^{-1}\Sigma_{12})^{-1}\Sigma_{21}\Sigma_{11})z_{1} \\
&amp;amp;- 2z_{1}^{T}(\Sigma_{11}^{-1}\Sigma_{12}(\Sigma_{22} - \Sigma_{21}\Sigma_{11}^{-1}\Sigma_{12}^{-1})^{-1})z_{2} \\
&amp;amp;+ z_{2}^{T}(\Sigma_{22} - \Sigma_{21}\Sigma_{11}^{-1}\Sigma_{12})^{-1})z_{2}
\end{align}$$&lt;/p>
&lt;p>which, by distribution of $z_{1}$ across the first term and splitting the second term into its two sums, we have&lt;/p>
&lt;p>$$\begin{align}
&amp;amp;z_{1}^{T}\Sigma_{11}^{-1}z_{11} + z_{1}^{T}\Sigma_{11}^{-1}\Sigma_{12}(\Sigma_{22} - \Sigma_{21}V_{11}^{-1}\Sigma_{12})^{-1}\Sigma_{21}\Sigma_{11}^{-1}z_{1} \\
&amp;amp;- z_{1}^{T}(\Sigma_{11}^{-1}\Sigma_{12}(\Sigma_{22} - \Sigma_{21}\Sigma_{11}^{-1}\Sigma_{12})^{-1})z_{2} - z_{1}^{T}(\Sigma_{11}^{-1}\Sigma_{12}(\Sigma_{22} - \Sigma_{21}\Sigma_{11}^{-1}\Sigma_{12})^{-1})z_{2} \\
&amp;amp;+ z_{2}^{T}(\Sigma_{22} - \Sigma_{21}\Sigma_{11}^{-1}\Sigma_{12})^{-1})z_{2}
\end{align}$$&lt;/p>
&lt;p>We can pull out forms $z_{1}^{T}\Sigma_{11}^{-1}\Sigma_{12}(\Sigma_{22}-\Sigma_{21}\Sigma_{11}^{-1}\Sigma_{12})^{-1}$ to the left and $(\Sigma_{22}-\Sigma_{21}\Sigma_{11}^{-1}\Sigma_{12})^{-1}z_{2}$ to the right and, after applying a transpose, have&lt;/p>
&lt;p>$$\begin{align}
=z_{1}^{T}\Sigma_{11}^{-1}z_{11} + (z_{2} -\Sigma_{21}\Sigma_{11}^{-1}z_{1})^{T}(\Sigma_{22} - \Sigma_{21}\Sigma_{11}^{-1}\Sigma_{12})^{-1}(z_{2} - \Sigma_{21}\Sigma_{11}^{-1}z_{1})
\end{align}$$&lt;/p>
&lt;p>Plugging the above back into our exponential term in our original density function, we see that we have a product of two exponential terms&lt;/p>
&lt;p>$$\begin{align}
&amp;amp;\frac{1}{C_{1}} \exp(\frac{-1}{2}(z_{1}^{T}\Sigma_{11}^{-1}z_{11})) \\
\end{align}$$&lt;/p>
&lt;p>and&lt;/p>
&lt;p>$$\begin{align}
&amp;amp;\frac{1}{C_{2}}\exp(\frac{-1}{2}(z_{2} - z_{1}\Sigma_{11}^{-1}\Sigma_{12})^{T}(\Sigma_{22} - \Sigma_{21}\Sigma_{11}^{-1}\Sigma_{12})^{-1}(z_{2} - \Sigma_{21}\Sigma_{11}^{-1}z_{1}))
\end{align}$$&lt;/p>
&lt;p>where&lt;/p>
&lt;p>$$\begin{align}
C_{1} &amp;amp;= (2\pi)^{p/2}\mid \Sigma_{11} \mid^{1/2} \\
C_{2} &amp;amp;= (2\pi)^{q/2}\mid \Sigma_{22} - \Sigma_{21}\Sigma_{11}^{-1}\Sigma_{12} \mid ^{1/2}
\end{align}$$&lt;/p>
&lt;p>The first term is the marginal density of $y_{1}$ and the second is the conditional density of $y_{2} \mid y_{1}$ with conditional mean $\mu_{2\mid 1} = \mu_{2} + \Sigma_{11}^{-1}\Sigma_{12}(y_{1} - \mu_{1})$ and conditional variance $\Sigma_{2\mid 1} = \Sigma_{22} - \Sigma_{21}\Sigma_{11}^{-1}\Sigma_{12}$.&lt;/p>
&lt;p>While long and drawn out, the formulas show that the conditional distribution of any subset of Normal random variables, given another subset, is also a Normal distribution, with conditional mean and variance defined by functions of the means and covariances of the original random vector.&lt;/p></description></item><item><title>Blockwise Matrix Inversion</title><link>https://kristianeschenburg.netlify.app/post/blockwise-matrix-inversion/</link><pubDate>Tue, 08 May 2018 23:24:17 -0700</pubDate><guid>https://kristianeschenburg.netlify.app/post/blockwise-matrix-inversion/</guid><description>&lt;p>I&amp;rsquo;m taking a Statistics course on the theory of linear models, which covers Gauss-Markov models and various extensions of them. Sometimes, when dealing with partitioned matrices, and commonly Multivariate Normal Distributions, we&amp;rsquo;ll often need to invert matrices in a blockwise manner. This has happened often enough during this course (coincidentally was necessary knowledge for a midterm question), so I figured I should just document some of the inversion lemmas.&lt;/p>
&lt;p>Let&amp;rsquo;s define our partitioned matrix as&lt;/p>
&lt;p>$$ R = \begin{bmatrix}
A &amp;amp; B \\
C &amp;amp; D
\end{bmatrix}$$&lt;/p>
&lt;p>We are specifically interested in finding&lt;/p>
&lt;p>$$ R^{-1} = \begin{bmatrix}
W &amp;amp; X \\
Y &amp;amp; Z
\end{bmatrix}$$&lt;/p>
&lt;p>such that&lt;/p>
&lt;p>$$ R R^{-1} = R^{-1}R =
\begin{bmatrix}
I &amp;amp; 0 \\
0 &amp;amp; I
\end{bmatrix}$$&lt;/p>
&lt;p>&lt;strong>Part 1: $R R^{-1}$&lt;/strong>&lt;/p>
&lt;p>For the right inverse ($R R^{-1}$), we can define&lt;/p>
&lt;p>$$ \begin{aligned}
AW + BY = I \\
AX + BZ = 0 \\
CW + DY = 0 \\
CX + DZ = I \\
\end{aligned}
$$&lt;/p>
&lt;p>and, assuming $A$ and $D$ are invertible,&lt;/p>
&lt;p>$$\begin{aligned}
X = -A^{-1}BZ \\
Y = -D^{-1}CW \\
\end{aligned}$$&lt;/p>
&lt;p>We can plug these identities back into the first system of equations as&lt;/p>
&lt;p>$$\begin{aligned}
AW + B(-D^{-1}CW) &amp;amp;= (A - BD^{-1}C)W = I \\
C(-A^{-1}BZ) + DZ &amp;amp;= (D - CA^{-1}B)Z = I \\
\end{aligned}$$&lt;/p>
&lt;p>so that&lt;/p>
&lt;p>$$\begin{aligned}
W = (A-BD^{-1}C)^{-1} \\
Z = (D-CA^{-1}B)^{-1} \\
\end{aligned}$$&lt;/p>
&lt;p>and finally&lt;/p>
&lt;p>$$ R^{-1} = \begin{bmatrix}
W &amp;amp; X \\
Y &amp;amp; Z
\end{bmatrix}
= \begin{bmatrix}
(A-BD^{-1}C)^{-1} &amp;amp; -A^{-1}B(D-CA^{-1}B)^{-1} \\
-D^{-1}C(A-BD^{-1}C)^{-1} &amp;amp; (D-CA^{-1}B)^{-1} \\
\end{bmatrix}$$&lt;/p>
&lt;p>It is important to note that the above result only holds if $A$, $D$, $(D-CA^{-1}B)$, and $(A-BD^{-1}C)$ are invertible.&lt;/p>
&lt;p>&lt;strong>Part 2: $R^{-1} R$&lt;/strong>&lt;/p>
&lt;p>Following the same logic as above, we have the following systems of equations for the left inverse ($R^{-1}R$)&lt;/p>
&lt;p>$$\begin{aligned}
WA + XC = I \\
WB + XD = 0 \\
YA + ZC = 0 \\
YB + ZD = I \\
\end{aligned}$$&lt;/p>
&lt;p>so that&lt;/p>
&lt;p>$$\begin{aligned}
X = WBD^{-1} = A^{-1}BZ \\
Y = ZCA^{-1} = D^{-1}CW \\
\end{aligned}$$&lt;/p>
&lt;p>which indicates that&lt;/p>
&lt;p>$$\begin{aligned}
W = (A-BD^{-1}C)^{-1} = C^{-1}D(D-CA^{-1}B)^{-1}CA^{-1} \\
X = (A-BD^{-1}C)^{-1}BD^{-1} = A^{-1}B(D-CA^{-1}B)^{-1} \\
\end{aligned}$$&lt;/p>
&lt;p>Importantly, blockwise matrix inversion allows us to define the inverse of a larger matrix, with respect to its subcomponents. Likewise, from here, we can go on to derive the Sherman-Morrison formula and Woodbury theorem, which allow us to do all kinds of cool stuff, like rank-one matrix updates. In the next few posts, I&amp;rsquo;ll go over a few examples of where blockwise matrix inversions are useful, and common scenarios where rank-one updates of matrices are applicable.&lt;/p></description></item></channel></rss>