SeasonalityACF
Find candidate seasonality parameter using autocorrelation function CI.
Quickstart
from sktime.param_est.seasonality import SeasonalityACF
estimator = SeasonalityACF(candidate_sp=None, p_threshold=0.05, adjusted=False, nlags=None, fft=True, missing='none')Parameters(6)
- candidate_spNone, int or list of int, optional, default = None
candidate sp to test, and to restrict tests to; ints must be 2 or larger if None, will test all integer lags between 2 and
nlags(inclusive)- p_thresholdfloat, optional, default=0.05
- significance threshold to apply in testing for seasonality
- adjustedbool, optional, default=False
- If True, then denominators for autocovariance are n-k, otherwise n.
- nlagsint, optional, default=None
Number of lags to compute autocorrelations for and select from. At default None, uses
min(10 * np.log10(nobs), nobs - 1). Will be ignored ifcandidate_spis provided.- fftbool, optional, default=True
- If True, computes the ACF via FFT.
- missingstr, [“none”, “raise”, “conservative”, “drop”], optional, default=”none”
Specifies how NaNs are to be treated. “none” performs no checks. “raise” raises an exception if NaN values are found. “drop” removes the missing observations and treats non-missing as contiguous. “conservative” computes the autocovariance using nan-ops so that nans are
removed when computing the mean and cross-products that are used to estimate the autocovariance. When using “conservative”, n is set to the number of non-missing observations.
Examples
>>> from sktime.datasets import load_airline
>>> from sktime.param_est.seasonality import SeasonalityACF
>>>
>>> X = load_airline (). diff ()[1:]
>>> sp_est = SeasonalityACF ()
>>> sp_est. fit (X) SeasonalityACF(
... )
>>> sp_est. get_fitted_params ()["sp" ] 12
>>> sp_est. get_fitted_params ()["sp_significant" ] array([12, 11]) Series should be stationary before applying ACF. To pipeline SeasonalityACF with the Differencer, use the ParamFitterPipeline:
>>> from sktime.datasets import load_airline
>>> from sktime.param_est.seasonality import SeasonalityACF
>>> from sktime.transformations.difference import Differencer
>>>
>>> X = load_airline ()
>>> sp_est = Differencer () * SeasonalityACF ()
>>> sp_est. fit (X) ParamFitterPipeline(
... )
>>> sp_est. get_fitted_params ()["sp" ] 12
>>> sp_est. get_fitted_params ()["sp_significant" ] array([12, 11])