1
$\begingroup$

I used this tutorial to find optimal coefficients for my ARIMA model and still it pretty bad (see picture). How can I improve it?

sar_m = sarimax.SARIMAX(df_train,
                        trend='n', 
                        order=(2,1,1), 
                        seasonal_order=(2, 1, 1, 24),
                        enforce_stationarity=False,
                        enforce_invertibility=False,
                        simple_differencing=False).fit()
# predict for every hour of the next month
predict_steps = 24*30
forecast = sar_m.forecast(steps=predict_steps)

# plot against real data
plot_forecast(df_test[:predict_steps], forecast, 
              title='SARIMAX - Predicted vs Actual (September 2014)', 
              xlabel='Day in September 2014', 
              ylabel='Number of Pizza Orders')

# calculate RMSE error
rmse(df_test[:predict_steps].numOfOrders, forecast)

enter image description here

Sample data (df.head())

date,numOfPizzaOrders
2014-04-01 00:00:00,12
2014-04-01 01:00:00,5
2014-04-01 02:00:00,2
2014-04-01 03:00:00,4
2014-04-01 04:00:00,3
2014-04-01 05:00:00,3
2014-04-01 06:00:00,7
2014-04-01 07:00:00,5
2014-04-01 08:00:00,17
$\endgroup$
2
  • 2
    $\begingroup$ Perhaps you mean that SARIMAX doesn't fit the data? $\endgroup$
    – Sycorax
    Commented Jan 9, 2023 at 5:18
  • $\begingroup$ could you post the graph of your series without the arima estimation? it is hard to see the exact pattern here $\endgroup$
    – Ghostpunk
    Commented May 11, 2023 at 7:56

1 Answer 1

0
$\begingroup$

You should try to apply differencing.

Maybe even several times - #1 - seasonal, because when looking at your time series it's obvious there is a seasonality here.

Also, you may need to apply Box-Cox transformation for the dispersion equalization.

After all , apply Dickey-Fuller test together with visual control for to make sure that the time series satisfies stationarity requirement.

$\endgroup$
1
  • $\begingroup$ i doubt this series in non-stationary, i think if you remove the trend (which i believe is sinusoidal) the mean and variance remains relatively same $\endgroup$
    – Ghostpunk
    Commented May 11, 2023 at 7:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.