Calculate hat matrix
hatMatrix(M)
M
Hat matrix, i.e. M * (M^T M)^{-1} M^T
M * (M^T M)^{-1} M^T
Useful links