Get the hat matrix from a design matrix.
hat_matrix(design)
design
The T by Q design matrix
T
Q
Uses the QR decomposition.
The T by T hat matrix
hat_matrix(cbind(seq(100), 1))