Transformer
BKFilter
Filter a times series using the Baxter-King filter.
This is a wrapper around the bkfilter function from statsmodels. (see statsmodels.tsa.filters.bk_filter.bkfilter).
The Baxter-King filter is intended for economic and econometric time series data and deals with the periodicity of the business cycle. Applying their band-pass filter to a series will produce a new series that does not contain fluctuations at a higher or lower frequency than those of the business cycle. Baxter-King follow Burns and Mitchell’s work on business cycles, which suggests that U.S. business cycles typically last from 1.5 to 8 years.
Schnellstart
python
from sktime.transformations.bkfilter import BKFilter
estimator = BKFilter(low=6, high=32, K=12)Tags
Fähigkeiten
- Multivariat
- Reihen ungleicher Länge
- Inverse Transformation: Nicht unterstützt
- Fehlende Werte: Nicht unterstützt
- Entfernt fehlende Werte: Nicht unterstützt
- Gleicht Reihenlängen an: Nicht unterstützt
Eigenschaften
- Eingabetypscitype:transform-input
- Series
- Ausgabetypscitype:transform-output
- Series
- Label-Typscitype:transform-labels
- None
- Fit ist leerfit_is_empty
- Ja
- Behält den Zeitindextransform-returns-same-time-index
- Nein
- Benötigt Xrequires_X
- Ja
- Benötigt yrequires_y
- Nein
- X und y brauchen denselben IndexX-y-must-have-same-index
- Nein
Parameter(3)
- lowfloat
- Minimum period for oscillations. Baxter and King recommend a value of 6 for quarterly data and 1.5 for annual data.
- highfloat
- Maximum period for oscillations. BK recommend 32 for U.S. business cycle quarterly data and 8 for annual data.
- Kint
- Lead-lag length of the filter. Baxter and King suggest a truncation length of 12 for quarterly data and 3 for annual data.
Beispiele
>>> from sktime.transformations.bkfilter import BKFilter
>>> 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 = pd. offsets. QuarterEnd (startingMonth = 12)
... )
>>> dta. set_index (index, inplace = True)
>>> bk = BKFilter (6, 24, 12)
>>> cycles = bk. fit_transform (X = dta [['realinv' ]])Referenzen
- Baxter, M. and R. G. King. “Measuring Business Cycles: Approximate
Band-Pass Filters for Economic Time Series.” Review of Economics and Statistics, 1999, 81(4), 575-593.