Learn R Programming

did2s (version 1.2.0)

robust_solve_XtX: Robust solve for X'X beta = X'Y using QR decomposition

Description

This function computes the least squares solution beta = (X'X)^(-1) X'Y in a numerically stable way using QR decomposition, handling rank-deficient matrices gracefully.

Usage

robust_solve_XtX(X, Y)

Value

The least squares solution beta (may contain 0 for rank-deficient columns)

Arguments

X

Design matrix (sparse or dense)

Y

Response matrix/vector (can be X'Y if already computed)