'LU decomposition error using SARIMAX in statsmodels
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'.
Solution 1:[1]
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.
Solution 2:[2]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | sonia |
Solution 2 | Mardy Marn |