LU decomposition error using SARIMAX in statsmodels

Viewed 1658

I get a 'LU decomposition' error where using SARIMAX in the statsmodels python package. This is the code:

from statsmodels.tsa.statespace.sarimax import SARIMAX
model = SARIMAX(endog=series, order=(0,0,1), seasonal_order=(1,0,1,12), trend='n')
model_fit = model.fit()
predictions = model_fit.predict(len(series), len(series)+30)

The error I get is: 'LinAlgError: LU decomposition error'. The error appears only for certain combination of numbers in 'order' and 'seasonal_order'.

2 Answers

If you will take the log of series value for example

Train_log = np.log(train['Count'])

import statsmodels.api as sm
model=sm.tsa.statespace.SARIMAX(Train_log,order=(2, 1, 4),seasonal_order=(0,1,1,24))
result=model.fit()

will helps to resolve the error as I got the same error and by changing it into Train_log error was gone.

model = SARIMAX(endog=series, order=(0,0,1), seasonal_order=(1,0,1,12), trend='n', enforce_stationarity=False)

Do not enforce stationarity so that your model can still fit on non-stationary data

Related