Skip to contents

Test for periodicity

Usage

pcTest(x, nullmodel, nseasons, ...)

Arguments

x

the object to be tested, e.g. a time series or a periodic acf

nullmodel

specification of the test to be performed

nseasons

number of seasons

...

additional arguments to be passed on to methods

Details

This is a generic function which acts as a dispatcher for various tests for periodicity and periodic correlation.

x is typically a time series but conceptually it is an object containing the statistics needed for carrying out the requested test. For example, x may be the periodic autocovariance function for tests based on sample autocorrelations and autocovariances.

The method with signature (x = "ANY", nullmodel = "character") may be considered as default for pcTest. The ``real'' default method simply prints an error message.

Value

a list containing the results of the requested test, see the individual methods for details

Methods

signature(x = "ANY", nullmodel = "character")

Argument nullmodel specifies the test to be performed. It should be a single character string. If it is one of the strings recognised by this method, the test specified below is carried out. Otherwise nullmodel is taken to be the name of a function which is called with arguments (x,...).

Currently, the following character strings are recognised:

"wn"

Box test for (non-periodic) white noise, simply calls Box.test.

"piar"

Franses (1996) test for periodic integration.

signature(x = "slMatrix", nullmodel = "character")

x here is the periodic autocovariance function. This method works similarly to the method for signature (x = "ANY", nullmodel = "character"), see its description.

Currently, the following character strings are recognised:

"pwn"

Ljung-Box test for periodic white noise,

"periodicity"

McLeod test for periodic correlation.

signature(x = "numeric", nullmodel = "character")

signature(x = "PeriodicTimeSeries", nullmodel = "character")

Author

Georgi N. Boshnakov

Note

TODO: critical values

Examples

cu <- pcts(dataFranses1996[ , "CanadaUnemployment"])
cu <- window(cu, start = availStart(cu), end = availEnd(cu))

test_piar(cu, 4, 1, sintercept = TRUE)
#> Loading required namespace: fUnitRoots
#> $p
#> [1] 1
#> 
#> $spec
#>     sintercept         sslope homoschedastic 
#>           TRUE          FALSE          FALSE 
#> 
#> $statistics
#>                LR      LRtau        tau  perFuller
#> stats   0.2757132 -0.5250840 -0.5066658 -0.7737611
#> pvalues        NA  0.8680436  0.8749612  0.9052944
#> 
pcTest(cu, "piar", 4, 1, sintercept = TRUE)
#> $p
#> [1] 1
#> 
#> $spec
#>     sintercept         sslope homoschedastic 
#>           TRUE          FALSE          FALSE 
#> 
#> $statistics
#>                LR      LRtau        tau  perFuller
#> stats   0.2757132 -0.5250840 -0.5066658 -0.7737611
#> pvalues        NA  0.8680436  0.8749612  0.9052944
#> 

if(require(partsm)){
# same with LRurpar.test from partsm
LRurpar.test(cu, list(regular = c(0,0,0), seasonal = c(1,0), regvar = 0), p = 1)
}
#> Loading required package: partsm
#> ----
#>   Likelihood ratio test for a single unit root in a PAR model of order 1 .
#> 
#>   Null hypothesis: PAR( 1 ) restricted to a unit root. 
#>   Alternative hypothesis: PAR( 1 ). 
#> 
#>   LR-statistic: 0.27 
#>   ---
#>   5 and 10 per cent asymptotic critical values:
#>     when seasonal intercepts are included: 9.24, 7.52. 
#>     when seasonal intercepts and trends are included: 12.96, 10.50. 
#> 
#>   LRtau-statistic: -0.52 
#>   ---
#>   5 and 10 per cent asymptotic critical values:
#>     when seasonal intercepts are included: -2.86, -2.57. 
#>     when seasonal intercepts and trends are included: -3.41, -3.12. 
#>