statsmodels.tsa.deterministic.Fourier

class statsmodels.tsa.deterministic.Fourier(period, order)[source]

Fourier series deterministic terms

Parameters:
periodint

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

orderint

The number of Fourier components to include. Must be <= 2*period.

Notes

Both a sine and a cosine term are included for each i=1, …, order

\[\begin{split}f_{i,s,t} & = \sin\left(2 \pi i \times \frac{t}{m} \right) \\ f_{i,c,t} & = \cos\left(2 \pi i \times \frac{t}{m} \right)\end{split}\]

where m is the length of the period.

Examples

Solar data has an 11-year cycle

>>> from statsmodels.datasets import sunspots
>>> from statsmodels.tsa.deterministic import Fourier
>>> data = sunspots.load_pandas().data
>>> fourier_gen = Fourier(11, order=2)
>>> fourier_gen.in_sample(data.index)
Attributes:
is_dummy

Flag indicating whether the values produced are dummy variables

order

The order of the Fourier terms included

period

The period of the Fourier terms

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

is_dummy

Flag indicating whether the values produced are dummy variables

order

The order of the Fourier terms included

period

The period of the Fourier terms