set.seed(1)
n <- 10; p <- 4
X <- matrix(rnorm(n * p), n, p)
y <- rnorm(n)
yhat1 <- fastQR::qr_lse_fitted(X, y)
## reference computation
yhat2 <- base::qr.fitted(base::qr(X), y)
max(abs(yhat1 - yhat2))
Run the code above in your browser using DataLab