Learn R Programming

uroot (version 2.1-3)

ch.test: Canova and Hansen Test for Seasonal Stability

Description

Canova and Hansen (CH) test statistic for the null hypothesis of a stable seasonal pattern.

Usage

ch.test(x, type = c("dummy", "trigonometric"), lag1 = FALSE, NW.order = NULL, 
  sid = NULL, xreg = NULL, pvalue = c("RS", "raw"), rs.nobsreg = 13)

Value

A list of class "CHtest" with components:

statistics

the value of the test statistics.

pvalues

the p-values for each test statistics.

method

a character string describing the type of test.

data.name

a character string giving the name of the data.

type

the value of the input argument type.

fitted.model

the fitted regression model.

NW.order

the value of the input argument NW.order.

isNullxreg

logical, auxiliary element for print method. Were external regressors defined in the argument xreg?

type.pvalue

character, the value of the input argument pvalue.

pvlabels

a vector of characters containing a label related to each p-values. Auxiliary element for print method.

The method print displays the test statistics and p-values; summary shows the same output and includes the fitted regression model.

Arguments

x

a univariate seasonal time series.

type

a character string specifying the formulation of the test, "dummy" for seasonal dummies or "trigonometric" for seasonal cycles.

lag1

logical, if TRUE a first order lag of the time series x is included in the regression model. The default is FALSE.

NW.order

an integer, the lag truncation parameter to be used in the Newey and West covariance matrix.

sid

an optional numeric vector, the target seasonal dummies or cycles to be tested. By default all the individual and joint test statistics are returned.

xreg

an optional vector or matrix of external regressors with the same length or number of rows as the length of the input time series x.

pvalue

a character specifying the method employed to compute p-values: "RS", the default, interpolation based on response surface regressions; "raw", interpolation in the tabulated values provided in the reference paper for the Von Mises distribution.

rs.nobsreg

an integer indicating the number of points employed in the response surface regression (only for pvalue = "RS").

Details

The seasons or seasonal cycles to be tested can be chosen through an indicator variable defined in the argument sid. By default, all the \(t\)-statistics related to each individual dummy or cycle and the joint \(F\)-statistic are returned. If type = "dummy", the index of the target seasons can be specified in sid. For example, in a quarterly series: sid=c(2) returns the test statistic to the stability of the second quarter; sid=c(1,3) returns the joint test statistic for the first and third quarters; sid=c(1,2,3,4) returns the joint test statistic for the null of seasonal stability at all seasons. If type = "trigonometric", the indicator vector sid must be of length floor(frequency(x)/2) and will consist of ones and zeros. Each element in sid is related to each seasonal cycle according to the same order in which the seasonal frequencies, \(w_j\), are defined: \(w_j=2\pi j/S\), \(j=1,...,Sh\), where \(S\) is the periodicity and \(Sh\) is floor(frequency(x)/2). For example, in a monthly series: sid=c(0,0,0,0,0,1) returns the test statistic to the stability of the cycle with frequency \(w_6=\pi\); sid=c(1,0,0,0,0,1) returns the joint test statistic for cycles related to frequencies \(w_1=\pi/6\) and \(w_6=\pi\); sid=c(1,1,1,1,1,1) returns the joint test statistic for the stability of all seasonal cycles. The following keywords are also admitted: sid="all", computes all the test statistic related to each individual season or cycle as well as the joint test statistic for all seasons or cycles; sid="joint" computes the joint test statistic for all seasons or cycles.

References

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: tools:::Rd_expr_doi("10.1080/07350015.1995.10524598").

Díaz-Emparanza, I. and Moral, M. P. (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 code: https://www.ehu.eus/ignacio.diaz-emparanza/packages/Canova_Hansen.gfn (seems unavailable, so not linked)

See Also

ch.rs.pvalue seasonal.cycles, seasonal.dummies, uroot.raw.pvalue.

Examples

Run this code
library(uroot)
# example for the series "hours" with the same options 
# employed in Canova and Hansen (1995)
data("ch-data")
hours <- diff(log(ch.data$hours))
res1 <- ch.test(x = hours, type = "dummy", lag1 = TRUE, NW.order = 4)
res1
# the auxiliary regression is stored in the element "fitted.model"
summary(res1$fit)

if (FALSE) {
# this requires tables not included in the current version of the package 
# see note in main documentation file, uroot-package
res2 <- ch.test(x = hours, type = "trigonometric", lag1 = TRUE, NW.order = 4)
res2
summary(res2$fit)}

Run the code above in your browser using DataLab