Transformer
CFFilter
Filter a times series using the Christiano Fitzgerald filter.
Quickstart
python
from sktime.transformations.cffilter import CFFilter
estimator = CFFilter(low=6, high=32, drift=True)Parameters(3)
- lowfloat, optional, default = 6.0
- Minimum period of oscillations. Features below low periodicity are filtered out. For quarterly data, the default of 6 gives 1.5 years periodicity.
- highfloat, optional, default = 32.0
- Maximum period of oscillations. Features above high periodicity are filtered out. For quarterly data, the default of 32 gives 8 year periodicity.
- driftbool, optional, default = True
- Whether or not to subtract a trend from the data. The trend is estimated as np.arange(nobs)*(x[-1] -x[0])/(len(x)-1). > X: argument of CFFilter._transform() > x: If X is 1d, X=x. If 2d, x is assumed to be in columns. > nobs: len(x)
Examples
>>> from sktime.transformations.cffilter import CFFilter
>>> import pandas as pd
>>> import statsmodels.api as sm
>>> dta = sm. datasets. macrodata. load_pandas (). data
>>> index = pd. date_range (start = '1959Q1', end = '2009Q4', freq = 'Q')
>>> dta. set_index (index, inplace = True)
>>> cf = CFFilter (6, 24, True)
>>> cycles = cf. fit_transform (X = dta [['realinv' ]])