pyramid.arima
.CHTest¶
-
class
pyramid.arima.
CHTest
(m)[source][source]¶ Conduct a CH test for seasonality.
The Canova-Hansen test for seasonal differences. Canova and Hansen (1995) proposed a test statistic for the null hypothesis that the seasonal pattern is stable. The test statistic can be formulated in terms of seasonal dummies or seasonal cycles. The former allows us to identify seasons (e.g. months or quarters) that are not stable, while the latter tests the stability of seasonal cycles (e.g. cycles of period 2 and 4 quarters in quarterly data). [1]
Parameters: m : int
The seasonal differencing term. For monthly data, e.g., this would be 12. For quarterly, 4, etc. For the Canova-Hansen test to work,
m
must exceed 1.Notes
This test is generally not used directly, but in conjunction with
pyramid.arima.nsdiffs()
, which directly estimates the number of seasonal differences.References
[R27] Testing for seasonal stability using the Canova and Hansen test statisic: http://bit.ly/2wKkrZo Methods
estimate_seasonal_differencing_term
(x)Estimate the seasonal differencing term. get_params
([deep])Get parameters for this estimator. set_params
(**params)Set the parameters of this estimator. -
estimate_seasonal_differencing_term
(x)[source][source]¶ Estimate the seasonal differencing term.
Parameters: x : array-like, shape=(n_samples,)
The time series vector.
Returns: D : int
The seasonal differencing term. The CH test defines a set of critical values:
(0.4617146, 0.7479655, 1.0007818, 1.2375350, 1.4625240, 1.6920200, 1.9043096, 2.1169602, 2.3268562, 2.5406922, 2.7391007)
For different values of
m
, the CH statistic is compared to a different critical value, and returns 1 if the computed statistic is greater than the critical value, or 0 if not.
-