5

In Linear regression $y = X\beta + \epsilon$ The Hat matrix is defined to be $H = X(X^TX)^{-1} X^T$ .

However. If I compute the equation for Hat matrix, I just get an identity matrix. My calculation is the following:

$X(X^TX)^{-1} X^T $

$= X(X^{-1} (X^T)^{-1})X^T$

$= (XX^{-1}) ((X^T)^{-1}X^T) $

$= I \times I $

$=I$

I know I must be doing something wrong because if the Hat matrix is just an identity matrix, it wouldn't have any significance. What did I do wrong here?

1 Answers1

8

$X$ isn't necessarily invertible (in fact, it is usually not square!) so you cannot distribute $\;^{-1}$ inside $(X'X)$.

Kim Jong Un
  • 14,794
  • 1
  • 24
  • 49