There are three kinds of seasonal patterns that may emerge in time series. Seasonality might be deterministic or stochastic. On the stochastic side, seasonal patterns might be either stationary or not.

A lot of these seasonality should not mutually exclusive. A time series can have each a deterministic and stochastic seasonal component.

Let’s describe each pattern in turn.

## Deterministic seasonality

Time series with a deterministic seasonality have a relentless seasonal pattern. It all the time recurs in a predictable way, each in intensity and periodicity:

**similar intensity**: the extent of the seasonal pattern stays the identical over the identical seasonal period;**unchanged periodicity**: the situation of the peaks and troughs doesn’t change. In other words, the time between each repetition of the seasonal pattern is constant.

Here’s an artificial monthly time series with a deterministic seasonality:

`import numpy as np`period = 12

size = 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.normal(scale=0.1, size=size))

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

This time series is customized from the book in reference [3].

Constant seasonality might be well handled by seasonal dummy explanatory variables. A categorical variable that describes the seasonal period. On this case, the month that corresponds to every time step. This categorical variable is transformed right into a set of indicator (dummy) variables by one-hot encoding.

You may also use Fourier series to model seasonality. Fourier series are sine and cosine waves with various periods. You possibly can learn more about these in a previous article.

## Stochastic stationary seasonality

`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))

# synthetic series with stochastic seasonality

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

A stochastic stationary seasonality evolves over consecutive seasonal periods (e.g. yr over yr). The intensity is less predictable, however the periodicity stays roughly the identical.

With deterministic seasonality, the very best prediction for a given month doesn’t change regardless of the yr. For a stochastic stationary seasonality, the very best guess depends upon the worth of the identical month from the previous yr.

## Stochastic non-stationary seasonality

Sometimes, seasonal patterns change significantly over several seasonal periods. These changes might be brought on by seasonal unit roots, which suggests that seasonality is integrated.

Besides the intensity, the periodicity of this sort of seasonality also tends to vary over time. Because of this the peaks and troughs vary of their location.

Examples of this sort of seasonal pattern appear in numerous domains. These include consumption series or industrial production data.

Changes are difficult to predict when time series have an integrated seasonality. Shocks cause everlasting changes in the information, resulting in scenarios where “spring becomes summer” — quote from reference [1].