Description Usage Arguments Details Value Note References See Also Examples
Canova and Hansen (CH) test statistic for the null hypothesis of a stable seasonal pattern.
1 2 |
x |
a univariate seasonal time series. |
type |
a character string specifying the formulation of the test,
|
lag1 |
logical, if |
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 |
pvalue |
a character specifying the method employed to compute p-values:
|
rs.nobsreg |
an integer indicating the number of points employed in the response surface
regression (only for |
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π 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=π;
sid=c(1,0,0,0,0,1)
returns the joint test statistic for cycles related
to frequencies w_1=π/6 and w_6=π;
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.
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 |
fitted.model |
the fitted regression model. |
NW.order |
the value of the input argument codeNW.order. |
isNullxreg |
logical, auxiliary element for |
type.pvalue |
character, the value of the input argument codepvalue. |
pvlabels |
a vector of characters containing a label related to each p-values.
Auxiliary element for |
The method print
displays the test statistics and p-values;
summary
shows the same output and includes the fitted regression model.
When type = "dummy"
, the p-value for the joint test statistic
based on response surface regressions is not available. If pvalue = "RS"
,
the p-value reported for the joint test statistic in the trigonometric version is based
on the tables given in the reference paper, Canova and Hansen (1995).
When sid
is a numeric (selected combination of dummies or cycles),
the reported p-values are based on interpolation in tables;
if pvalue = "RS"
, it is changed to "raw"
and a warning is given.
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: http://dx.doi.org/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: http://www.ehu.eus/ignacio.diaz-emparanza/packages/Canova_Hansen.gfn.
ch.rs.pvalue
seasonal.cycles
,
seasonal.dummies
, uroot.raw.pvalue
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 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)
## Not run:
# 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)
## End(Not run)
|
Canova and Hansen test for seasonal stability
data: hours
statistic pvalue
Quarter1 0.3173 0.1343
Quarter2 0.3974 0.0782 .
Quarter3 0.1578 0.4049
Quarter4 0.3396 0.1164
joint 1.128 0.0793 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Test type: seasonal dummies
NW covariance matrix lag order: 4
First order lag: yes
Other regressors: no
P-values: based on response surface regressions
Call:
lm(formula = x ~ 0 + xreg)
Residuals:
Min 1Q Median 3Q Max
-0.0091803 -0.0026042 0.0002348 0.0031443 0.0081779
Coefficients:
Estimate Std. Error t value Pr(>|t|)
xreglag1 0.035674 0.110632 0.322 0.748
xregSD1 -0.011685 0.001172 -9.969 9.76e-16 ***
xregSD2 0.006545 0.001568 4.173 7.51e-05 ***
xregSD3 0.008175 0.001078 7.581 4.99e-11 ***
xregSD4 -0.007573 0.001243 -6.095 3.53e-08 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.003869 on 81 degrees of freedom
Multiple R-squared: 0.8428, Adjusted R-squared: 0.8331
F-statistic: 86.85 on 5 and 81 DF, p-value: < 2.2e-16
Canova and Hansen test for seasonal stability
data: hours
statistic pvalue
pi/2 0.265 0.5931
pi 0.7731 0.003 **
joint 1.0836 0.0092 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Test type: seasonal cycles
NW covariance matrix lag order: 4
First order lag: yes
Other regressors: no
P-values: based on response surface regressions
Call:
lm(formula = x ~ 0 + xreg)
Residuals:
Min 1Q Median 3Q Max
-0.0091803 -0.0026042 0.0002348 0.0031443 0.0081779
Coefficients:
Estimate Std. Error t value Pr(>|t|)
xregc -0.0011346 0.0004365 -2.599 0.0111 *
xreglag1 0.0356740 0.1106325 0.322 0.7479
xregSD1 -0.0099302 0.0009574 -10.373 < 2e-16 ***
xregSD2 0.0070590 0.0012709 5.554 3.44e-07 ***
xregSD3 -0.0006206 0.0004229 -1.467 0.1462
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.003869 on 81 degrees of freedom
Multiple R-squared: 0.8428, Adjusted R-squared: 0.8331
F-statistic: 86.85 on 5 and 81 DF, p-value: < 2.2e-16
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.