diff --git a/nbs/src/arima.ipynb b/nbs/src/arima.ipynb index 3655b2754..3001d9e8a 100644 --- a/nbs/src/arima.ipynb +++ b/nbs/src/arima.ipynb @@ -1258,8 +1258,8 @@ " x -= np.dot(xreg, par[narma + np.arange(ncxreg)])\n", " \n", " res, resid = arima_css(x, arma, phi, theta, ncond)\n", - " if res == 0.0:\n", - " return math.inf\n", + " if res <= 0.0:\n", + " return -math.inf\n", " return 0.5 * math.log(res)\n", " \n", " coef = np.array(fixed)\n", diff --git a/statsforecast/arima.py b/statsforecast/arima.py index 64e1f5c47..a5508b358 100644 --- a/statsforecast/arima.py +++ b/statsforecast/arima.py @@ -890,8 +890,8 @@ def arma_css_op(p, x): x -= np.dot(xreg, par[narma + np.arange(ncxreg)]) res, resid = arima_css(x, arma, phi, theta, ncond) - if res == 0.0: - return math.inf + if res <= 0.0: + return -math.inf return 0.5 * math.log(res) coef = np.array(fixed)