ceholden / yatsm

Yet Another Time Series Model
https://yatsm.readthedocs.org/en/latest/
MIT License
63 stars 30 forks source link

BUG: yatsm.regression.robust_fit.RLM #86

Closed ceholden closed 8 years ago

ceholden commented 8 years ago

When RLM is performed on a time series where the number of observations, n, is approximately equal to the number of parameters, k, there is the potential for the MAD calculation to estimate a penalty of zero, resulting in a division by 0, and errors in the relevant BLAS routine.

The BLAS error typically looks like:

On entry to DGELSD parameter number 4 had an illegal value

For example, a time series y = [1000, 1100, 1050, 950, 1003], the observations of 1100, 1050, and 950 may receive a weight of 0. When calculating the median absolute deviation, the median of [1100, 0, 0, 0, 1003] is zero. In order to prevent the inevitable division by zero, we should ensure that this scaling variable is always at least as large as the machine epsilon value.