set.seed(1)
n <- 10; p <- 4
X <- matrix(rnorm(n * p), n, p)
y <- rnorm(n)
qr_res <- fastQR::qr_fast(X)
coef1 <- fastQR::qr_coef(qr = qr_res$qr, tau = qr_res$qraux, y = y)
## reference computation
coef2 <- base::qr.coef(base::qr(X), y)
max(abs(coef1 - coef2))
Run the code above in your browser using DataLab