2
votes

I am trying a simple prediction using ARIMA. The code below produces all NaNs as output for the argument of order of (1,1,3), but for order argument of (1,1,2) and (1,1,4) i am able to get proper(numerical) output. The same function works fine, in some other installations with older/newer versions of pandas, statsmodels and pmdarima. I checked related questions here in Stackoverflow, but since the same function with the same argument is working in other libraries, i assume there is nothing wrong with the order argument of (1,1,3) and probably the bug is with library versions or some other configuration. Any help is appreciated.

from statsmodels.tsa.arima_model import ARIMA
    def testarima():
        trainseries = pd.Series([600.00,10.00,405.00,900.00,500.00,500.00,500.00,500.00,500.00,
                                 500.00,1000.00,533.00,2784.11,1775.00,300.00,4289.42,1270.00,
                                 500.00,2145.00,1650.00,1750.00,785.00,4137.50,2450.00,2194.00,
                                 1750.00,1000.00,2250.00,1000.00,1055.98,1000.00,250.00,450.00,
                                 540.00,2247.50,200.00,820.00,570.00,555.00])
        model = ARIMA(trainseries, order=(1, 1, 3))
        # print("train: " + str(train))
        try:
            model_fit = model.fit(disp=0)            
            fc, se, conf = model_fit.forecast(24, alpha=0.05)
            print('result: '+str(fc))
            return fc
        except:
            return np.zeros(24)

statsmodels v 0.10.2 pmdarima v 1.5.1 pandas 0.25.3 python 3.7.5

There is a warning output

C:\Users\AppData\Local\Programs\Python\Python37\lib\site-packages\statsmodels\tsa\kalmanf\kalmanfilter.py:225: RuntimeWarning: invalid value encountered in log Z_mat.astype(complex), R_mat, T_mat)

C:\Users\AppData\Local\Programs\Python\Python37\lib\site-packages\statsmodels\tsa\kalmanf\kalmanfilter.py:225: RuntimeWarning: invalid value encountered in true_divide Z_mat.astype(complex), R_mat, T_mat)

C:\Users\AppData\Local\Programs\Python\Python37\lib\site-packages\statsmodels\base\model.py:492: HessianInversionWarning: Inverting hessian failed, no bse or cov_params available 'available', HessianInversionWarning)

But in other installation where this is working also these warnings appear, but there i get proper numerical output

1

1 Answers

0
votes

use panda version 0.22.0.0 its not resolved then avoid statsmodel just import ARIMA, if you using tensorflow in colab its not supporting tensorflow 2 version