|
| 1 | +--- |
| 2 | +layout: proof |
| 3 | +mathjax: true |
| 4 | + |
| 5 | +author: "Joram Soch" |
| 6 | +affiliation: "BCCN Berlin" |
| 7 | +e_mail: "joram.soch@bccn-berlin.de" |
| 8 | +date: 2021-11-09 15:19:00 |
| 9 | + |
| 10 | +title: "Transformation matrices for simple linear regression" |
| 11 | +chapter: "Statistical Models" |
| 12 | +section: "Univariate normal data" |
| 13 | +topic: "Simple linear regression" |
| 14 | +theorem: "Transformation matrices" |
| 15 | + |
| 16 | +sources: |
| 17 | + |
| 18 | +proof_id: "P285" |
| 19 | +shortcut: "slr-mat" |
| 20 | +username: "JoramSoch" |
| 21 | +--- |
| 22 | + |
| 23 | + |
| 24 | +**Theorem:** Under [ordinary least squares](/P/slr-ols) for [simple linear regression](/D/slr), [estimation](/D/emat), [projection](/D/pmat) and [residual-forming](/D/rfmat) matrices are given by |
| 25 | + |
| 26 | +$$ \label{eq:slr-mat} |
| 27 | +\begin{split} |
| 28 | +E &= \frac{1}{(n-1)\,s_x^2} \left[ \begin{matrix} (x^\mathrm{T} x/n) \, 1_n^\mathrm{T} - \bar{x} \, x^\mathrm{T} \\ - \bar{x} \, 1_n^\mathrm{T} + x^\mathrm{T} \end{matrix} \right] \\ |
| 29 | +P &= \frac{1}{(n-1)\,s_x^2} \left[ \begin{matrix} (x^\mathrm{T} x/n) - 2 \bar{x} x_1 + x_1^2 & \cdots & (x^\mathrm{T} x/n) - \bar{x} (x_1 + x_n) + x_1 x_n \\ \vdots & \ddots & \vdots \\ (x^\mathrm{T} x/n) - \bar{x} (x_1 + x_n) + x_1 x_n & \cdots & (x^\mathrm{T} x/n) - 2 \bar{x} x_n + x_n^2 \end{matrix} \right] \\ |
| 30 | +R &= \frac{1}{(n-1)\,s_x^2} \left[ \begin{matrix} (n-1) (x^\mathrm{T} x/n) + \bar{x} (2 x_1 - n\bar{x}) - x_1^2 & \cdots & -(x^\mathrm{T} x/n) + \bar{x} (x_1 + x_n) - x_1 x_n \\ \vdots & \ddots & \vdots \\ -(x^\mathrm{T} x/n) + \bar{x} (x_1 + x_n) - x_1 x_n & \cdots & (n-1) (x^\mathrm{T} x/n) + \bar{x} (2 x_n - n\bar{x}) - x_n^2 \end{matrix} \right] |
| 31 | +\end{split} |
| 32 | +$$ |
| 33 | + |
| 34 | +where $1_n$ is an $n \times 1$ vector of ones, $x$ is the $n \times 1$ single predictor variable, $\bar{x}$ is the [sample mean](/D/mean-samp) of $x$ and $s_x^2$ is the [sample variance](/D/var-samp) of $x$. |
| 35 | + |
| 36 | + |
| 37 | +**Proof:** [Simple linear regression is a special case of multiple linear regression](/P/slr-mlr) with |
| 38 | + |
| 39 | +$$ \label{eq:slr-mlr} |
| 40 | +X = \left[ 1_n, \, x \right] \quad \text{and} \quad \beta = \left[ \begin{matrix} \beta_0 \\ \beta_1 \end{matrix} \right] \; , |
| 41 | +$$ |
| 42 | + |
| 43 | +such that the simple linear regression model can also be written as |
| 44 | + |
| 45 | +$$ \label{eq:mlr} |
| 46 | +y = X\beta + \varepsilon, \; \varepsilon \sim \mathcal{N}(0, \sigma^2 I_n) \; . |
| 47 | +$$ |
| 48 | + |
| 49 | +Moreover, we [note the following equality](/P/slr-olsdist): |
| 50 | + |
| 51 | +$$ \label{eq:b-est-cov-den} |
| 52 | +x^\mathrm{T} x - n\bar{x}^2 = (n-1) \, s_x^2 \; . |
| 53 | +$$ |
| 54 | + |
| 55 | +<br> |
| 56 | +1) The [estimation matrix is given by](/P/mlr-mat) |
| 57 | + |
| 58 | +$$ \label{eq:E} |
| 59 | +E = (X^\mathrm{T} X)^{-1} X^\mathrm{T} |
| 60 | +$$ |
| 61 | + |
| 62 | +which is a $2 \times n$ matrix and can be reformulated as follows: |
| 63 | + |
| 64 | +$$ \label{eq:E-qed} |
| 65 | +\begin{split} |
| 66 | +E &= (X^\mathrm{T} X)^{-1} X^\mathrm{T} \\ |
| 67 | +&= \left( \left[ \begin{matrix} 1_n^\mathrm{T} \\ x^\mathrm{T} \end{matrix} \right] \left[ 1_n, \, x \right] \right)^{-1} \left[ \begin{matrix} 1_n^\mathrm{T} \\ x^\mathrm{T} \end{matrix} \right] \\ |
| 68 | +&= \left( \left[ \begin{matrix} n & n\bar{x} \\ n\bar{x} & x^\mathrm{T} x \end{matrix} \right] \right)^{-1} \left[ \begin{matrix} 1_n^\mathrm{T} \\ x^\mathrm{T} \end{matrix} \right] \\ |
| 69 | +&= \frac{1}{n x^\mathrm{T} x - (n\bar{x})^2} \left[ \begin{matrix} x^\mathrm{T} x & -n\bar{x} \\ -n\bar{x} & n \end{matrix} \right] \left[ \begin{matrix} 1_n^\mathrm{T} \\ x^\mathrm{T} \end{matrix} \right] \\ |
| 70 | +&= \frac{1}{x^\mathrm{T} x - n\bar{x}^2} \left[ \begin{matrix} x^\mathrm{T} x/n & -\bar{x} \\ -\bar{x} & 1 \end{matrix} \right] \left[ \begin{matrix} 1_n^\mathrm{T} \\ x^\mathrm{T} \end{matrix} \right] \\ |
| 71 | +&= \frac{1}{(n-1)\,s_x^2} \left[ \begin{matrix} (x^\mathrm{T} x/n) \, 1_n^\mathrm{T} - \bar{x} \, x^\mathrm{T} \\ - \bar{x} \, 1_n^\mathrm{T} + x^\mathrm{T} \end{matrix} \right] \; . |
| 72 | +\end{split} |
| 73 | +$$ |
| 74 | + |
| 75 | +<br> |
| 76 | +2) The [projection matrix is given by](/P/mlr-mat) |
| 77 | + |
| 78 | +$$ \label{eq:P} |
| 79 | +P = X (X^\mathrm{T} X)^{-1} X^\mathrm{T} = X \, E |
| 80 | +$$ |
| 81 | + |
| 82 | +which is an $n \times n$ matrix and can be reformulated as follows: |
| 83 | + |
| 84 | +$$ \label{eq:P-qed} |
| 85 | +\begin{split} |
| 86 | +P &= X \, E = \left[ \begin{matrix} 1_n & x \end{matrix} \right] \left[ \begin{matrix} e_1 \\ e_2 \end{matrix} \right] \\ |
| 87 | +&= \frac{1}{(n-1)\,s_x^2} \left[ \begin{matrix} 1 & x_1 \\ \vdots & \vdots \\ 1 & x_n \end{matrix} \right] \left[ \begin{matrix} (x^\mathrm{T} x/n) - \bar{x} x_1 & \cdots & (x^\mathrm{T} x/n) - \bar{x} x_n \\ -\bar{x} + x_1 & \cdots & -\bar{x} + x_n \end{matrix} \right] \\ |
| 88 | +&= \frac{1}{(n-1)\,s_x^2} \left[ \begin{matrix} (x^\mathrm{T} x/n) - 2 \bar{x} x_1 + x_1^2 & \cdots & (x^\mathrm{T} x/n) - \bar{x} (x_1 + x_n) + x_1 x_n \\ \vdots & \ddots & \vdots \\ (x^\mathrm{T} x/n) - \bar{x} (x_1 + x_n) + x_1 x_n & \cdots & (x^\mathrm{T} x/n) - 2 \bar{x} x_n + x_n^2 \end{matrix} \right] \; . |
| 89 | +\end{split} |
| 90 | +$$ |
| 91 | + |
| 92 | +<br> |
| 93 | +3) The [residual-forming matrix is given by](/P/mlr-mat) |
| 94 | + |
| 95 | +$$ \label{eq:R} |
| 96 | +R = I_n - X (X^\mathrm{T} X)^{-1} X^\mathrm{T} = I_n - P |
| 97 | +$$ |
| 98 | + |
| 99 | +which also is an $n \times n$ matrix and can be reformulated as follows: |
| 100 | + |
| 101 | +$$ \label{eq:R-qed} |
| 102 | +\begin{split} |
| 103 | +R &= I_n - P = \left[ \begin{matrix} 1 & \cdots & 0 \\ \vdots & \ddots & \vdots \\ 0 & \cdots & 1 \end{matrix} \right] - \left[ \begin{matrix} p_{11} & \cdots & p_{1n} \\ \vdots & \ddots & \vdots \\ p_{n1} & \cdots & p_{nn} \end{matrix} \right] \\ |
| 104 | +&= \frac{1}{(n-1)\,s_x^2} \left[ \begin{matrix} x^\mathrm{T} x - n\bar{x}^2 & \cdots & 0 \\ \vdots & \ddots & \vdots \\ 0 & \cdots & x^\mathrm{T} x - n\bar{x}^2 \end{matrix} \right] \\ |
| 105 | +&- \frac{1}{(n-1)\,s_x^2} \left[ \begin{matrix} (x^\mathrm{T} x/n) - 2 \bar{x} x_1 + x_1^2 & \cdots & (x^\mathrm{T} x/n) - \bar{x} (x_1 + x_n) + x_1 x_n \\ \vdots & \ddots & \vdots \\ (x^\mathrm{T} x/n) - \bar{x} (x_1 + x_n) + x_1 x_n & \cdots & (x^\mathrm{T} x/n) - 2 \bar{x} x_n + x_n^2 \end{matrix} \right] \\ |
| 106 | +&= \frac{1}{(n-1)\,s_x^2} \left[ \begin{matrix} (n-1) (x^\mathrm{T} x/n) + \bar{x} (2 x_1 - n\bar{x}) - x_1^2 & \cdots & -(x^\mathrm{T} x/n) + \bar{x} (x_1 + x_n) - x_1 x_n \\ \vdots & \ddots & \vdots \\ -(x^\mathrm{T} x/n) + \bar{x} (x_1 + x_n) - x_1 x_n & \cdots & (n-1) (x^\mathrm{T} x/n) + \bar{x} (2 x_n - n\bar{x}) - x_n^2 \end{matrix} \right] \; . |
| 107 | +\end{split} |
| 108 | +$$ |
0 commit comments