I stumbled upon a (for me) odd formula for the sample covariance matrix. Is there anyone who can show me how to get to this form?:
Start with the simple regression $\iota = Xb + \epsilon$, a $1\times T$ vector, and by applying OLS we get $\hat{b} = (X'X)^{-1}X'\iota.$
Now the formula stated:
$$\hat{\Sigma} = \frac{1}{T}X'X - \bar{x}\bar{x}'.$$
They state that $\hat{\Sigma}$ is the sample covariance matrix. Does anyone know how to get to this last result?
The definition is normally $\hat{\Sigma} = \frac{1}{T}\sum \limits_{t=1}^{T}(x_t - \bar{x})(x_t - \bar{x})'$, but I can't seem to derive the form above.
Thanks in advance!