Seasonal patterns are common in many time series data (e.g. macroeconomic or meteorological data). One of the issues to be analyzed when working with seasonal data is whether the seasonal pattern remains relatively stable over the sample period or whether it changes across time.

Canova and Hansen (1995) [1] 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).

In this post, I show how obtain the test statistic by means of the uroot R package. I apply the test to the data set of quarterly macroeconomic series used in Table 7 of the original paper. I have recently improved the code and fixed some issues with the Newey and West covariance matrix. I have also added the facility to compute p-values described in Díaz-Emparanza, I. and Moral, M. Paz (2013) [2].

Given the options mentioned in the original paper (lag truncation equal to 5 and including a first order lag as regressor), the stability of seasonal dummies for the series `investments`

can be tested as follows:

require("uroot") x <- diff(log(ch.data$ifix)) res <- ch.test(x = x, type = "dummy", lag1 = TRUE, NW.order = 5) res

The following result is obtained:

statistic pvalue Quarter1 0.741 0.0073 ** Quarter2 0.2853 0.1567 Quarter3 0.8277 0.0039 ** Quarter4 0.4481 0.054 . joint 1.9773 0.01 ** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Test type: seasonal dummies NW covariance matrix lag order: 5 First order lag: yes Other regressors: no P-values: based on response surface regressions

Information about the model fitted to obtain the test statistic is available in the element `fitted.model`

.

R> summary(res$fit) Coefficients: Estimate Std. Error t value Pr(>|t|) xreglag1 0.304707 0.072953 4.177 4.95e-05 *** xregSD1 -0.109497 0.006289 -17.411 < 2e-16 *** xregSD2 0.174379 0.009782 17.826 < 2e-16 *** xregSD3 -0.014516 0.012310 -1.179 0.24 xregSD4 0.008329 0.006468 1.288 0.20 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 0.03846 on 153 degrees of freedom Multiple R-squared: 0.8509, Adjusted R-squared: 0.846 F-statistic: 174.6 on 5 and 153 DF, p-value: < 2.2e-16

The test for the stability of seasonal cycles can be obtained setting the argument `type = "dummy"`

.

The script table7.R applies both versions of the statistic to all the series in the data set. The results are summarized below.

Series | Quarter 1 | Quarter 2 | Quarter 3 | Quarter 4 |
---|---|---|---|---|

ifix | 0.741 ** | 0.285 | 0.828 ** | 0.448 . |

ifixr | 0.620 * | 0.095 | 0.892 ** | 0.050 |

ifixnr | 0.315 | 0.271 | 0.275 | 0.341 |

ifixnrs | 0.407 . | 0.357 . | 0.432 . | 0.571 * |

ifixnrpd | 0.376 . | 0.435 . | 0.203 | 0.290 |

cns | 1.934 *** | 0.915 ** | 0.605 * | 1.492 *** |

cdur | 0.242 | 0.116 | 0.345 | 0.313 |

cnd | 1.183 *** | 1.437 *** | 1.033 *** | 1.525 *** |

cser | 1.296 *** | 0.638 * | 1.098 *** | 0.932 ** |

gnp | 0.994 ** | 1.033 *** | 0.526 * | 0.881 ** |

imports | 0.157 | 0.434 . | 0.097 | 0.285 |

exports | 0.191 | 0.177 | 0.401 . | 0.22 |

finsale | 1.813 *** | 0.239 | 0.172 | 1.352 *** |

cpi | 0.421 . | 0.660 * | 0.295 | 0.290 |

tbill | 0.359 . | 0.218 | 0.100 | 0.073 |

businv | 0.238 | 1.382 *** | 0.342 | 0.550 * |

m1 | 0.075 | 2.134 *** | 0.137 | 0.188 |

unemp | 1.131 *** | 1.255 *** | 0.454 . | 0.130 |

labfor | 1.348 *** | 0.566 * | 0.374 . | 0.462 * |

empl | 0.368 . | 0.286 | 0.098 | 0.569 * |

monbase | 0.536 * | 0.316 | 0.217 | 0.225 |

monmult | 0.524 * | 1.036 *** | 0.193 | 0.408 . |

hours | 0.317 | 0.397 . | 0.158 | 0.340 |

wage | 0.068 | 0.716 ** | 0.273 | 0.694 ** |

Cells report the CH test statistic and significance codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1. |

The value of the statistics is not exactly the same as those reported in Table 7 of the original paper. They should be identical as the same options were used. Unfortunately the authors and the journal did not provide the code that reproduces the results of the paper. I checked my implementation with that available in the software Gretl [2]. Running some examples I obtained the same results in both programs. In the original paper, the authors may have used some variation on the computation of the Newey and West matrix or may have used some options other than from those eventually reported in the paper. There may also be some error in the transcription of results in the original paper (e.g., the results for the series `hours`

are close to those obtained here for the series `wage>`

and the other way around).

Regardless of the issues about reproducibility, the overall conclusion based on the Table above is the same as in the original paper. The seasonal pattern in most of the series is not stable for all the seasons. Yet, there are some series for which a stable seasonal pattern is not rejected at the 5% significance level: non-residential investments, non-residential producer durables, consumption durables, imports, exports, consumer price index, treasure bill and hours. According to the dummy version of the test, changes in the seasonal pattern occur a bit more often in the first and second quarters.

The Canova and Hansen test is an interesting tool that can be used as a complement to the more common unit root tests. Knowing the seasons that cause the instability in the seasonal pattern is helpful in order to find an explanation for evolving patterns, for example, changes in consumption habits, holidays or other socio-economic phenomena.

References:

[1] Canova, F. and Hansen, Bruce E. (1995) 'Are Seasonal Patterns Constant over Time? A Test for Seasonal Stability'. *Journal of Business & Economic Statistics*, **13**(3), pp. 237-252. DOI: 10.1080/07350015.1995.10524598. Paper available from one of the author's website. Data set.

Go to top

[2] Díaz-Emparanza, I. and Moral, M. Paz (2013). *Seasonal Stability Tests in gretl. An Application to International Tourism Data*. Working paper: Biltoki D.T. 2013.03. URL: https://addi.ehu.es/handle/10810/10577. Gretl package.

Go to top