RobustPeriod.detect#

static RobustPeriod.detect(data, lamb='ravn-uhlig', c=1.5, db_n=8, modwt_level=10, delta=1.345, max_worker_count=None, max_period_count=None)#

Find periods in the given series.

Parameters:
dataarray_like

Data to be investigated. Must be squeezable to 1-d.

lambfloat, {‘hodrick-prescott’, ‘ravn-uhlig’}, default = ‘ravn-uhlig’

The Hodrick-Prescott filter smoothing parameter. Possible values are either a float, ‘hodrick-prescott’, or ‘ravn-uhlig’. These represent the lambda parameter selection heuristics by Hodrick and Prescott [1] and Ravn and Uhlig [2], respectively. If lamb is not float value, then x must be a data array with a datetime-like index.

cfloat, default = 1.5

The constant threshold that determines the robustness of the Huber function. A smaller value makes the Huber function more sensitive to outliers. Huber recommends using a value between 1 and 2 [3].

db_nint, default = 8

The number of vanishing moments for the Daubechies wavelet [4] used to compute the Maximal Overlap Discrete Wavelet Transform (MODWT) [5]. Must be an integer between 1 and 38, inclusive.

modwt_levelint, default = 10

The level of the Maximal Overlap Discrete Wavelet Transform (MODWT). Must be a positive integer.

deltafloat, default = 1.345

The tuning constant for the Huber loss function. A smaller value makes the function more sensitive to outliers [3].

max_worker_countint, optional

The maximum number of worker processes to use. Defaults to the number of CPUs in the system.

max_period_countint, optional

The maximum number of periods to detect. If not specified, all detected periods are returned.

Returns:
NDArray

List of detected periods.

Raises:
AssertionError

If db_n is not between 1 and 38, inclusive.

References

[1]

Hodrick, R. J., & Prescott, E. C. (1997). Postwar US business cycles: an empirical investigation. Journal of Money, credit, and Banking, 1-16. https://doi.org/10.2307/2953682

[2]

Ravn, M. O., & Uhlig, H. (2002). On adjusting the Hodrick-Prescott filter for the frequency of observations. Review of economics and statistics, 84(2), 371-376. https://doi.org/10.1162/003465302317411604

[3] (1,2)

Huber, P. J., & Ronchetti, E. (2009). Robust Statistics. Wiley. https://doi.org/10.1002/9780470434697

[4]

Daubechies, I. (1992). Ten lectures on wavelets. Society for industrial and applied mathematics. https://doi.org/10.1137/1.9781611970104

[5]

Percival, D. B. (2000). Wavelet methods for time series analysis. Cambridge University Press. https://doi.org/10.1017/CBO9780511841040