Calculate hat matrix
hatMatrix(M)
Design Matrix representing the randomization sequence
Hat matrix, i.e. M * (M^T M)^{-1} M^T
M * (M^T M)^{-1} M^T