9.8 Condition numbers and PSD repair
For a symmetric matrix, the implemented condition number is the ratio of largest to smallest absolute eigenvalue. A zero smallest magnitude yields infinity.
Large condition number means small perturbations can create large solution changes. It does not by itself identify which parameter is redundant; inspect eigenvectors, scales and model structure.
The common covariate configuration defaults its covariance gate to numerics.max_condition_number = 1e12. Screen workflows can impose different model-quality thresholds. Always name the gate and matrix being evaluated.
Nearest-PSD projection
nearest_psd eigendecomposes a symmetrized matrix and floors eigenvalues below floor × matrix_scale. It reconstructs the matrix and reports total eigenvalue movement relative to scale. robust_cholesky first tries ordinary Cholesky, then uses a relative floor of 1e-10.
This is a spectral clipping repair, not a statistical re-estimation of covariance. It can make simulation possible while altering correlations and variances. The repair magnitude should be reported.
Boundary distinctions
Positive semidefinite is sufficient to describe a covariance but ordinary Cholesky requires positive definite. A fixed-zero variance creates a legitimate singular direction; an indefinite covariance with a large negative eigenvalue indicates a different problem. Treat them separately.
Validation cases
Include well-conditioned positive definite, near-singular positive, exact singular, small-negative-roundoff and materially indefinite matrices. Verify factorization/reconstruction and confirm that unacceptable repairs fail at the calling layer.
Common mistakes
- Interpreting every singular covariance as a software error.
- Repairing a materially negative eigenvalue without disclosure.
- Comparing condition numbers computed from differently scaled matrices.
Checklist
- Report matrix identity, scale, eigenvalues and condition number.
- Distinguish PSD, PD and indefinite cases.
- Record the relative PSD repair.
Further reading
See Cholesky paths, stabilized inversion and Chapter 40's planned compatibility limits.