I am trying to forecast a time series in Python by using auto_arima and adding Fourier terms as exogenous features. The data come from kaggle's forecasting challenge. The specificity of this time series is that it has daily data with weekly and annual seasonalities.

Multiple sources have used SARIMAX + Fourier terms and/or auto arima with fourier terms.

Why do we use fourier terms? What value they bring into the model? what are alternatives to fourier terms?


1 Answer 1

  • Fourier terms are periodic and that makes them useful in describing a periodic pattern.

  • Fourier terms can be added linearly to describe more complex functions. We have for instance the following relationship with only two terms

    $$a \sin(2\pi t) + b \cos(2\pi t) = c \cos(2\pi t + \theta)$$

    With the amplitude $c = \text{sign}(a) \sqrt{a^2 + b^2}$ and phase shift $\theta = \tan^{-1}(-a/b)$.

    The right side is not an easy function to work with. The phase shift $\theta$ makes the function non-linear and you can not use it in, for instance, linear regression.

    With more Fourier terms you can describe more variations in the shape of function.

An alternative to Fourier terms would be to use seasonal arima(SARIMA), or to use terms that similarly describe the seasonal component (e.g. you could add a seasonal term that models only the weekends or only the first sunday of the month, or whatever other special seasonal effect that might be expected based on theoretic grounds).

The advantage of the Fourier terms is that they describe the seasonality as a relatively smooth function (yet the ability to increase the number of terms allows you to fine tune the degree of smoothness).

SARIMA let's you model the seasonality as an ARIMA with lag terms that are a multiple of the period. But when the period is long then this adds many variables to the model. For instance, if you have the year as a period and measure days then you get a multiple of 365 additional variables (you only need to fit a few more AR and/or MA terms, but you also have the previous 365 terms $X_t$ that are part of the model that makes the prediction).

Related: Fourier terms to model seasonality in ARIMA models


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.