statsmodels.tsa.deterministic.Seasonality

class statsmodels.tsa.deterministic.Seasonality(period, initial_period=1)[source]

Seasonal dummy deterministic terms

Parameters:
periodint

The length of a full cycle. Must be >= 2.

initial_periodint

The seasonal index of the first observation. 1-indexed so must be in {1, 2, …, period}.

Attributes:
initial_period

The seasonal index of the first observation

is_dummy

Flag indicating whether the values produced are dummy variables

period

The period of the seasonality

Examples

Solar data has an 11-year cycle

>>> from statsmodels.datasets import sunspots
>>> from statsmodels.tsa.deterministic import Seasonality
>>> data = sunspots.load_pandas().data
>>> seas_gen = Seasonality(11)
>>> seas_gen.in_sample(data.index)

To start at a season other than 1

>>> seas_gen = Seasonality(11, initial_period=4)
>>> seas_gen.in_sample(data.index)

Methods

from_index(index)

Construct a seasonality directly from an index using its frequency.

in_sample(index)

Produce deterministic trends for in-sample fitting.

out_of_sample(steps, index[, forecast_index])

Produce deterministic trends for out-of-sample forecasts

Properties

initial_period

The seasonal index of the first observation

is_dummy

Flag indicating whether the values produced are dummy variables

period

The period of the seasonality


Last update: Dec 16, 2024