1
$\begingroup$

I'm writing a tutorial on traditional time series forecasting models. One key issue with ARIMA models is that they cannot model seasonal data. So, I wanted to get some seasonal data and show that the model cannot handle it.

However, it seems to model the seasonality quite easily - it peaks every 4 quarters as per the original data. What is going on?

enter image description here

Code to reproduce the plot

from statsmodels.datasets import get_rdataset
from statsmodels.tsa.arima.model import ARIMA
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()

# Get data
uk = get_rdataset('UKNonDurables', 'AER')
uk = uk.data
uk_pre1980 = uk[uk.time <= 1980]

# Make ARIMA model
order = (4, 1, 4)
# Without a seasonal component
seasonal_order = (0, 0, 0, 0)
arima = ARIMA(uk_pre1980.value, 
            order=order, 
            seasonal_order=seasonal_order, 
            trend='n')
res = arima.fit()

# Plot
all_elements = len(uk) - len(uk_pre1980)
plt.plot(uk.value, 'b', label='Actual')
plt.plot(res.forecast(steps=all_elements), 'r', label='Preds')
plt.title(f'order={order}, seasonal_order={seasonal_order}')
plt.legend()
plt.show()
$\endgroup$
4
  • 1
    $\begingroup$ ARMA (and by extension ARIMA) models can capture periodicity. Seasonality is non-stationary, while periodicity is assumed stationary. So periodicity (what you observe) can be captured by non-seasonal ARIMA models (even ARMA models). This is the point IMO $\endgroup$
    – Nikos M.
    Nov 14, 2021 at 14:23
  • 1
    $\begingroup$ this can be of help, although they use the terms in the reverse meaning than my previous comment $\endgroup$
    – Nikos M.
    Nov 14, 2021 at 14:33
  • 1
    $\begingroup$ a juxtaposition of the seasonal vs periodic here $\endgroup$
    – Nikos M.
    Nov 14, 2021 at 14:34
  • 1
    $\begingroup$ and this set of definitions as well $\endgroup$
    – Nikos M.
    Nov 14, 2021 at 14:37

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.