Home Artificial Intelligence 8 Techniques to Model Seasonality Modeling Seasonal Patterns

8 Techniques to Model Seasonality Modeling Seasonal Patterns

0
8 Techniques to Model Seasonality
Modeling Seasonal Patterns

Methods to handle seasonality for forecasting

Towards Data Science
Photo by Clark Young on Unsplash

This text is a follow-up to a previous post. There, we identified 3 kinds of seasonal patterns.

Here, we’ll:

  • Learn the best way to describe the seasonality of a time series.
  • Go over 8 approaches you should use to model seasonality.

Seasonality refers to repeatable patterns that recur over some period. It’s a vital source of variation that is vital to model.

A time series and its seasonally-adjusted version. The information source is in the following section. Image by writer.

There are several ways of handling seasonality. Some approaches remove the seasonal component before modeling. Seasonally-adjusted data (a time series minus the seasonal component) highlights long-term effects equivalent to trends or business cycles. Other approaches add extra variables that capture the cyclical nature of seasonality.

Before going over different methods, let’s create a time series and describe its seasonal patterns.

Evaluation example

We’ll use the identical process we did within the previous article (see also reference [1]):

period = 12 # monthly series
size = 120

beta1 = np.linspace(-.6, .3, num=size)
beta2 = np.linspace(.6, -.3, num=size)
sin1 = np.asarray([np.sin(2 * np.pi * i / 12) for i in np.arange(1, size + 1)])
cos1 = np.asarray([np.cos(2 * np.pi * i / 12) for i in np.arange(1, size + 1)])

xt = np.cumsum(np.random.normal(scale=0.1, size=size))

yt = xt + beta1 * sin1 + beta2 * cos1 + np.random.normal(scale=0.1, size=size)

yt = pd.Series(yt)

Here’s what this series appear to be:

Artificial time series with a stochastic stationary seasonality. Image by writer.

We will start by describing the seasonal pattern by its strength:

# https://github.com/vcerqueira/blog/tree/important/src
from src.seasonality import seasonal_strength

seasonal_strength(yt, period=12)
# 0.90

LEAVE A REPLY

Please enter your comment!
Please enter your name here