SeasonalUnitRootTest#
- class cultivars.diagnostics.seasonality.SeasonalUnitRootTest(*, statistic, pvalue, name, critical_values, null, nobs, lower_tail=False, companions=(), trend, lags, method, break_index=None, family, period)[source]#
Verdict of a seasonal unit-root or seasonal-stability test, one frequency per row.
Seasonal differencing \(1 - L^s\) factors over the \(s\) roots of unity,
\[1 - L^s = (1 - L)(1 + L) \prod_{k = 1}^{s/2 - 1} \bigl(1 - 2\cos(2\pi k / s)\, L + L^2\bigr),\]one factor per frequency \(\omega_k = 2\pi k / s\), and a seasonal test is a question asked at each factor. This record is a
UnitRootTestwhosecompanionsare the other frequencies of the same regression, and whose rows may reject in different tails: HEGY’s \(t\) statistics at the two real roots, \(\omega = 0\) and \(\omega = \pi\), reject in the lower tail, its \(F\) statistics at the complex pairs and the joint restrictions in the upper; every Canova-Hansen row, whose null is stationarity, in the upper. The headline record is HEGY’s \(t\) at frequency zero, or Canova-Hansen’s joint statistic, andlower_tailis set per row soreject()reads each correctly. The record adds nothing to the fields but the family and the period; what it adds is the title and the reading notes a mixed-tail table needs.- Variables:
family –
"HEGY"or"Canova-Hansen".period – Seasonal period
s.
Note
The two families answer complementary questions and are read together, as ADF and KPSS are at the zero frequency: a frequency HEGY cannot reject a root at and Canova-Hansen cannot reject stationarity at is one the sample does not decide. The Canova-Hansen
lagsfield is the kernel bandwidth, not an augmentation lag count, and itsmethodsays so.See also
hegy()andcanova_hansen()– the producers.UnitRootTest– the base, with the zero-frequency tests.kpss()– the zero-frequency counterpart of Canova-Hansen.
References
Hylleberg, S., Engle, R. F., Granger, C. W. J., & Yoo, B. S. (1990). Seasonal integration and cointegration. Journal of Econometrics, 44(1-2), 215-238.
Canova, F., & Hansen, B. E. (1995). Are seasonal patterns constant over time? A test for seasonal stability. Journal of Business & Economic Statistics, 13(3), 237-252.
Example
A random walk with a fixed quarterly pattern: HEGY keeps the root at frequency zero and rejects every seasonal one, which reads “difference once and use dummies”, and the rows reject in different tails:
>>> import numpy as np >>> rng = np.random.default_rng(0) >>> season = np.tile([1.0, -0.5, 2.0, -2.5], 50) >>> y = np.cumsum(rng.standard_normal(200)) + season >>> test = hegy(y, period=4, seed=0) >>> test.family, test.period, test.lower_tail, test.reject() ('HEGY', 4, True, False) >>> [(c.lower_tail, c.reject()) for c in test.companions] [(True, True), (False, True), (False, True), (False, True)]
Canova-Hansen on the same series keeps stationary seasonality at every frequency:
>>> test = canova_hansen(y, period=4, seed=0) >>> test.family, test.lower_tail, test.reject() ('Canova-Hansen', False, False)
Attributes#
|
|
Seasonal period \(s\); even, since the Nyquist root \(\omega = \pi\) is tested. |
|
First observation of the new regime for a break-allowing test; |
|
Augmentation lags of the regression, or the kernel bandwidth, whichever the test uses. |
|
How |
|
|