qr_lse_resid: Compute residuals using QR decomposition
Description
Computes the residual vector \(r = y - \hat y\) for a linear
least-squares problem using a QR decomposition computed internally.
Usage
qr_lse_resid(X, y)
Value
a numeric vector of residuals.
Arguments
X
numeric matrix of dimension \(n \times p\).
y
numeric response vector of length \(n\).
Details
The QR decomposition of \(X\) is computed internally. The residuals
are obtained as
$$r = y - Q Q^\top y$$
without explicitly forming the orthogonal matrix \(Q\).
This function is intended as a convenience wrapper for least-squares
computations when the explicit QR factors are not required.