ChristianoFitzgeraldFilter.filter#

ChristianoFitzgeraldFilter.filter(data)[source]#

Filter a panel, keeping every observation.

The ideal weights are computed out to lag nobs once, 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. The symmetric flag is set where at least ceil(high) observations lie on both sides.

Parameters:

data (ArrayLike) – A (nobs, k) panel or one-dimensional series.

Return type:

BandPassResult

Returns:

The BandPassResult, same length as the input.

Raises:

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)