statsmodels.tsa.deterministic.CalendarSeasonality

class statsmodels.tsa.deterministic.CalendarSeasonality(freq, period)[source]

Seasonal dummy deterministic terms based on calendar time

Parameters:
freqstr

The frequency of the seasonal effect.

periodstr

The pandas frequency string describing the full period.

Examples

Here we simulate irregularly spaced data (in time) and hourly seasonal dummies for the data.

>>> import numpy as np
>>> import pandas as pd
>>> base = pd.Timestamp("2020-1-1")
>>> gen = np.random.default_rng()
>>> gaps = np.cumsum(gen.integers(0, 1800, size=1000))
>>> times = [base + pd.Timedelta(gap, unit="s") for gap in gaps]
>>> index = pd.DatetimeIndex(pd.to_datetime(times))
>>> from statsmodels.tsa.deterministic import CalendarSeasonality
>>> cal_seas_gen = CalendarSeasonality("H", "D")
>>> cal_seas_gen.in_sample(index)
Attributes:
freq

The frequency of the deterministic terms

is_dummy

Flag indicating whether the values produced are dummy variables

period

The full period

Methods

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

freq

The frequency of the deterministic terms

is_dummy

Flag indicating whether the values produced are dummy variables

period

The full period