Zurück zu den Modellen
Transformer

HPFilter

Filter a times series using the Hodrick-Prescott filter.

This is a wrapper around the hpfilter function from statsmodels. (see statsmodels.tsa.filters.hp_filter.hpfilter).

Schnellstart

python
from sktime.transformations.hpfilter import HPFilter

estimator = HPFilter(lamb=1600)

Parameter(1)

lambfloat
The Hodrick-Prescott smoothing parameter. A value of 1600 is suggested for quarterly data. Ravn and Uhlig suggest using a value of 6.25 (1600/4**4) for annual data and 129600 (1600*3**4) for monthly data.

Beispiele

>>> from sktime.transformations.hpfilter import HPFilter
>>> import pandas as pd
>>> import statsmodels.api as sm
>>> dta = sm. datasets. macrodata. load_pandas (). data
>>> index = pd. period_range ('1959Q1', '2009Q3', freq = 'Q')
>>> dta. set_index (index, inplace = True)
>>> hp = HPFilter (1600)
>>> cycles = hp. fit_transform (X = dta [['realinv' ]])