ChristianoFitzgeraldFilter.filter#
- ChristianoFitzgeraldFilter.filter(data)[source]#
Filter a panel, keeping every observation.
The ideal weights are computed out to lag
nobsonce, the endpoint weights derived from their cumulative sums, and each observation’s cycle assembled from the weights that fit inside the sample on each side plus the endpoint weight for what does not. Thesymmetricflag is set where at leastceil(high)observations lie on both sides.- Parameters:
data (
ArrayLike) – A(nobs, k)panel or one-dimensional series.- Return type:
- Returns:
The
BandPassResult, same length as the input.- Raises:
DimensionError – If the panel is not one- or two-dimensional.
NumericalError – If the panel is not finite.
Example
>>> import numpy as np >>> t = np.arange(300.0) >>> y = np.sin(2 * np.pi * t / 12) + np.sin(2 * np.pi * t / 80) >>> res = ChristianoFitzgeraldFilter().filter(y) >>> res.cycle.shape, res.offset, bool(np.allclose(res.cycle + res.trend, y[:, None])) ((300, 1), 0, True) >>> int(res.symmetric.argmax()), int(res.symmetric.sum()) (32, 236)