Least squared method confusion with matrices

42 Views Asked by At

I have a little problem with my homework in a subject called "Matrices in statistics".

The task is as follows:

Find $\Big( \begin{matrix} a \\ b \end{matrix} \Big)$ least squared estimations by $x_i$ and $y_i$.

What I've tried to do so far, is ..

$\Big( \begin{matrix} \widehat{a} \\ \widehat{b} \end{matrix} \Big) = (K^{T}K)^{-1}K^{T} \vec{y} = $$ \left[\Big( \begin{matrix} x_{1} .... x_{n} \\ 1 ...... 1 \end{matrix} \Big) \Bigg(\begin{matrix} x_{1} \quad 1 \\ ... \\ x_{n} \quad 1 \end{matrix} \Bigg) \right]^{-1} \Big( \begin{matrix} x_{1} .... x_{n} \\ 1 ...... 1 \end{matrix} \Big) \Bigg(\begin{matrix} y_{1} \\ ... \\ y_{n} \end{matrix} \Bigg) = \left[\begin{matrix} \sum_{i=1}^{n} x_{i}^{2} \qquad \sum_{i=1}^{n} x_{i}\\ \sum_{i=1}^{n} x_{i} \qquad n \end{matrix} \right] \Bigg(\begin{matrix} \sum_{i=1}^{n} x_{i}y_{i} \\ \sum_{i=1}^{n} y_{i} \end{matrix} \Bigg) $

..

I think I've done correctly thus far, but I don't know how to continue from there. I would be very thankful if you could help me!

1

There are 1 best solutions below

0
On

Denote $\hat{\beta} = (\hat{\alpha}, \hat{\beta} ) ^T$. Note that $$ \hat{\beta} = (X^TX)^{-1}X^Ty, $$ where \begin{align} X = \begin{pmatrix} 1 & x_1 \\ : & :\\ 1 & x_n \\ \end{pmatrix}, \end{align} hence, \begin{align} X'X = \begin{pmatrix} n & \sum x_i \\ \sum x_i & \sum x_i ^2\\ \end{pmatrix}. \end{align} As such, \begin{align} (X'X)^{-1} = (n \sum (x _i - \bar{x})^2)^{-1} \begin{pmatrix} \sum x_i ^2 & - \sum x_i \\ - \sum x_i & n\\ \end{pmatrix}. \end{align} Thus, \begin{align} \hat{\beta} = (X'X)^{-1}X'y = \begin{pmatrix} \bar{y} - \hat{\beta} \bar{x} \\ \frac{\sum ( x_i - \bar{x} ) (y_i - \bar{y})}{\sum (x_i - \bar{x})^2} \end{pmatrix}. \end{align}