class pmdarima.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]


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.


This test is generally not used directly, but in conjunction with pmdarima.arima.nsdiffs(), which directly estimates the number of seasonal differences.


[R62]Testing for seasonal stability using the Canova and Hansen test statistic:
[R63]R source code for CH test:


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.

Initialize self. See help(type(self)) for accurate signature.


Estimate the seasonal differencing term.


x : array-like, shape=(n_samples,)

The time series vector.


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.


Get parameters for this estimator.


deep : bool, default=True

If True, will return the parameters for this estimator and contained subobjects that are estimators.


params : mapping of string to any

Parameter names mapped to their values.


Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.


**params : dict

Estimator parameters.


self : object

Estimator instance.