Computes the orthogonal projection matrix Q = I - X(X'X)^(-1)X' that projects out the space spanned by confound regressors X. This is useful for advanced users who want to cache and reuse projection matrices.
Details
This function uses QR decomposition for numerical stability instead of computing the Moore-Penrose pseudoinverse directly. Only the estimated-rank QR basis is used, so redundant confound columns do not over-project. The resulting matrix Q can be applied to data to remove the influence of confound regressors.