#10257·statsmodels

BUG: CovDetS/MM fail numerically for large k (det overflow in cov_weighted)

Author: twelfthlaborCreated Sep 15, 2026Updated Sep 15, 2026

CovDetS and CovDetMM fail numerically for large k relative to nobs, e.g.

python
x = np.random.default_rng(0).standard_normal((301, 149))
CovDetS(x).fit()   # LinAlgError with #10247 applied; on main the #10241 ValueError comes first

CovDetMCD fits the same input.

The overflow is in cov_weighted's determinant normalization (wcov /= det(wcov) ** (1 / k)): for large k, det(wcov) overflows and the iterations cannot recover. This is not new, main already fails on in-range sizes, e.g. (400, 149) raises LinAlgError: Singular matrix. #10247 keeps the failure loud (LinAlgError instead of all-NaN covariances); the normalization itself still needs a numerically stable form (e.g. slogdet or equivalent scaling) or a documented size limit.