statsmodels.tsa.deterministic.CalendarSeasonality¶
- class statsmodels.tsa.deterministic.CalendarSeasonality(freq, period)[source]¶
Seasonal dummy deterministic terms based on calendar time
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)
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
The frequency of the deterministic terms
Flag indicating whether the values produced are dummy variables
The full period
Last update:
Nov 14, 2024