Statistical Methods

Read Rank and Residual Returns Before Reporting a Least-Squares Fit

Define the task

A least-squares solver can return a coefficient vector even when the design does not identify every coefficient uniquely. Read its effective rank, singular-value information and documented residual-return convention before reporting a fit. Keep the design column labels, scaling, rank cutoff and solver driver. An empty residual array is not evidence of a perfect fit; its meaning depends on matrix shape, rank and driver.

Carry out the check

Recompute the residual vector as observed response minus design times fitted coefficients, then sum its squares explicitly. Compare effective rank with the number of columns. If columns are dependent, explain the identifiability issue rather than treating a minimum-norm solution as unique scientific evidence. Numerical rank depends on tolerance and scale. Do not resolve instability by silently changing the cutoff until coefficients look convenient. Record why any rescaling or column removal was appropriate.

Worked hypothetical example

Hypothetical example: a design with two identical columns [1,2] and response [1,2] has rank 1, not 2. Coefficients (0.5,0.5) fit perfectly and are a minimum-norm choice, but (1,0) also fits perfectly. The residual sum of squares is zero in both cases; the individual contributions are not identified. Use this example to test report logic that confuses zero residuals with a uniquely interpretable parameter estimate. Statistical uncertainty requires additional model assumptions beyond a numerical least-squares solution.

Method checked 24 November 2026 against primary documentation: linalg.lstsq.

Related reading

Reading path: Analyze data. Guide 221 of 222. Choose any guide to suit your project.

Statistical Methods

Audit Residual and Convergence in a Conjugate-Gradient Solve

Practical steps and a hypothetical example: Check convergence evidence for a positive-definite iterative solve.

Statistical Methods

Audit Residual Contributions to a Huber Loss

Practical steps and a hypothetical example: Audit the contribution of large residuals to a prespecified robust loss.

Browse this reading pathTools for this stageGuides and downloads for this stage