in

3 Forms of Seasonality and How you can Detect Them | by Vitor Cerqueira | Jun, 2023


There are three sorts of seasonal patterns that may emerge in time sequence. Seasonality could be deterministic or stochastic. On the stochastic facet, seasonal patterns could be both stationary or not.

These kinds of seasonality are usually not mutually unique. A time sequence can have each a deterministic and stochastic seasonal part.

Let’s describe every sample in flip.

Deterministic seasonality

Time sequence with a deterministic seasonality have a relentless seasonal sample. It at all times recurs in a predictable means, each in depth and periodicity:

  • comparable depth: the extent of the seasonal sample stays the identical over the identical seasonal interval;
  • unchanged periodicity: the placement of the peaks and troughs doesn’t change. In different phrases, the time between every repetition of the seasonal sample is fixed.

Right here’s an artificial month-to-month time sequence with a deterministic seasonality:

import numpy as np

interval = 12
measurement = 120
beta1 = 0.3
beta2 = 0.6
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.regular(scale=0.1, measurement=measurement))

series_det = xt + beta1*sin1 + beta2*cos1 + np.random.regular(scale=0.1, measurement=measurement)

A synthetic month-to-month sequence and its deterministic seasonal part. Picture by creator.

This time sequence is tailored from the e book in reference [3].

Fixed seasonality could be effectively dealt with by seasonal dummy explanatory variables. A categorical variable that describes the seasonal interval. On this case, the month that corresponds to every time step. This categorical variable is reworked right into a set of indicator (dummy) variables by one-hot encoding.

You too can use Fourier sequence to mannequin seasonality. Fourier sequence are sine and cosine waves with various durations. You possibly can be taught extra about these in a previous article.

Stochastic stationary seasonality

beta1 = np.linspace(-.6, .3, num=measurement)
beta2 = np.linspace(.6, -.3, num=measurement)
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.regular(scale=0.1, measurement=measurement))

# artificial sequence with stochastic seasonality
series_stoc = xt + beta1*sin1 + beta2*cos1 + np.random.regular(scale=0.1, measurement=measurement)

A synthetic month-to-month sequence with a stochastic stationary seasonal part. Picture by creator.

A stochastic stationary seasonality evolves over consecutive seasonal durations (e.g. 12 months over 12 months). The depth is much less predictable, however the periodicity stays roughly the identical.

With deterministic seasonality, the most effective prediction for a given month doesn’t change no matter the 12 months. For a stochastic stationary seasonality, the most effective guess is determined by the worth of the identical month from the earlier 12 months.

Stochastic non-stationary seasonality

Generally, seasonal patterns change considerably over a number of seasonal durations. These adjustments could be attributable to seasonal unit roots, which implies that seasonality is built-in.

Apart from the depth, the periodicity of any such seasonality additionally tends to alter over time. Because of this the peaks and troughs fluctuate of their location.

Examples of any such seasonal sample seem in numerous domains. These embody consumption sequence or industrial manufacturing knowledge.

Modifications are tough to foretell when time sequence have an built-in seasonality. Shocks trigger everlasting adjustments within the knowledge, resulting in situations the place “spring turns into summer time” — quote from reference [1].


Coaching Language Fashions with Textbook-High quality Artificial Knowledge | by Vincent Vatter | Jun, 2023

Information Aggregation in Python with Pandas: Analysing Geological Lithology Information | by Andy McDonald | Jun, 2023