Seasonal data forecasting using the R-forecast model

Source: Äri-IT Kevad 2023

Author: Arvo Sarapuu, BI Developer at BCS Itera

In addition to the data forecasting model ARIMA, which is an extension of the R forecast, the SARIMA model, which takes seasonality into account, is also now in use.


Seasonal data forecasting using the R-forecast model

R forecast is a widely known forecasting tool that employs the ARIMA (Autoregressive Integrated Moving Average) model. While ARIMA is excellent at leveraging time series for forecasting, it has its limitations when it comes to seasonality. This issue is effectively tackled by the SARIMA (Seasonal Autoregressive Integrated Moving Average) model, an extension of ARIMA.

Like ARIMA, SARIMA is also a combination of an autoregressive (AR) and a moving average (MA) model, where the forecast of the AR model corresponds to a linear combination of the prior values of the variable, the MA model forecast corresponds to a linear combination of previous forecast errors and I indicates the data values that have been replaced with the difference between your values and previous values.

However, SARIMA also puts emphasis on seasonality (S). Therefore, if you have data from a specific time period with fixed trends, the SARIMA model is more accurate (eg weather forecasts, people’s behaviour during school holidays).



There are situations and events that always happen at specific times, such as public holidays, school holidays or even paydays – all of these events undeniably influence the consumer. If we combine both the event and consumer behaviour at that time, we can use it in our model (eg ice cream sales in the summer, the sale of Christmas goods in December).

SARIMA includes three new hyperparameters, ie parameters that define the calculation logic of the model. Seasonality, in turn, also comprises four other elements:

  • seasonal autoregressive order (when the season ends);
  • seasonal difference order (which change indicates the start of the season);
  • seasonal moving average order (checking with error percentage);
  • the number of time steps for a single seasonal period (of which the analysed cycle consists, eg 12 months in a year).

However, the standard model is certainly not suitable for all types of data. All the attributes of the model can and should be adjusted to generate a forecast tailored to the specific characteristics of your company.

One advantage of SARIMA is that since there are not many hyperparameters, it is possible to quickly find the right configuration between them. In contrast to ARIMA, having a sufficient amount of data for forecasting is particularly important with SARIMA. Even a three-year history may not be sufficient. The ARIMA/SARIMA model is used to forecast seasonal diseases (influenza/COVID) as well as air temperature, stock market trends and consumer behaviour, provided that the data incorporates seasonality.


Say hello to the new and versatile HRM4Baltics! Everything from personnel to payroll

Eelmine uudis