Search code examples
pythontime-seriesstatsmodelsforecastingarima

No result for SARIMAX


I'm working on a project to analyse how covid 19 affects shipment volume and I'm using SARIMAX to predict the shipment volume for the next few months. However, I keep getting the results as shown below :

   # Shipment volume data (monthly basis)
  
    df_monthly = df.loc[:'2020-06-30'].resample('MS').sum()
    df_monthly


   # covid 19 data (monthly basis)
     
     df_covid_monthly = df_covid.loc[:'2020-06-30']
     df_covid_monthly = df_covid.resample('MS').sum() 
     df_covid_monthly 

  
   # SARIMAX model
     
     model= SARIMAX(df_monthly, exog=df_covid_new, order=(2,1,1), enforce_invertibility=False, 
           enforce_stationarity=False)

     results= model.fit()

    # Prediction

    pred =  results.get_prediction(start='2020-06-01',end='2020-12-01',dynamic=False, index=None, 
    exog=df_covid_monthly['2020-02-01':], 
     extend_model=None, extend_kwargs=None)
    pred 

output :

<statsmodels.tsa.statespace.mlemodel.PredictionResultsWrapper at 0x27b64b4a608> 

Solution

  • After many readings and attempts on modifying my codes, I'm finally able to get the result for my prediction. Here's the changes I made:
    model = sm.tsa.SARIMAX(endog=df_monthly, order=(1,1,1),seasonal_order=(0,1,1,12))

    model_fit = model.fit()

    prediction = model_fit.predict(start='2020-07-01',end='2020-1201',dynamic=False, exog=df_covid_monthly,extend_kwargs=None)