patternchange: Changepoint Detection Using Ordinal Patterns

View source: R/Pattern.R

patternchangeR Documentation

Changepoint Detection Using Ordinal Patterns

Description

Test for a change in the dependence structure of two time series using ordinal patterns

Usage

patternchange(tsx,tsy,h=2,conf.level,weight=TRUE,weightfun=NULL,bn=log(length(tsx)),
    kernel=function(x){return(max(0,1-abs(x)))})

## S3 method for class 'change'
plot(x, ...)

Arguments

tsx

numeric vector of first univariate time series.

tsy

numeric vector of second univariate time series.

h

numeric value determining the length of ordinal pattern.

conf.level

numerical value indicating the confidence level of the test.

weight

logical value indicating whether one uses weights of the L1 norm or the empirical probability of identical patterns; see details.

weightfun

function which defines the weights given the L1 norm between the patterns if weight=TRUE. If no weight-function is given, the canonical weight function is used; see details.

bn

numerical value determining the bandwidth of the kernel estimator used to estimate the long run variance.

kernel

kernel function for estimating the long run variance.

x

object of class "change"

...

further arguments passed to the internal plotting function (plot).

Details

Given two timeseries tsx and tsy a cusum type statistic tests whether there is a change in the patter dependence or not. The test is based on a comparison of patterns of length h+1 in tsx and tsy. One can either choose the number of identical patterns (weight=FALSE) or a metric that is defined by the weightfun argument to measure the difference between patterns (weight=TRUE). If no (weightfun) is given, the canonical weightfunction is used, which equals 1 if patterns are identical and 0 if the L1 norm of their difference attains the maximal possible value. The value is linear interpolated in between.

The procedure depends on an estimate of the long run variance. Here a kernel estimator is used. A kernel function and a bandwidth can be set using the arguments kernel and bn. If none of them is given, the bartlett kernel with a bandwidth of log(n), where n equals the length of the timeseries, is used.

Value

Object with classes "change" and "htest" containing the following values:

statistic

the value of the test statistic. Under the null the test statistic follows asymptotically a Kolmogorov Smirnov distribution.

p.value

the p-value of the test.

estimate

the estimated time of change.

null.value

the jump height of the at most one change point model, which is under the null hypothesis always 0.

alternative

a character string describing the alternative hypothesis.

method

a characters string describing the test.

trajectory

the cumulative sum on which the tests are based on. Could be used for additional plots.

Author(s)

Alexander Dürre

References

Schnurr, A. (2014): An ordinal pattern approach to detect and to model leverage effects and dependence structures between financial time series, Statistical Papers, vol. 55, 919–931.

Schnurr, A., Dehling, H. (2017): Testing for Structural Breaks via Ordinal Pattern Dependence, Journal of the American Statistical Association, vol. 112, 706–720.

See Also

Estimation of the pattern dependence is provided by patterndependence.

Examples

set.seed(1066)
a1 <- cbind(rnorm(100),rnorm(100))
a2 <- rmvnorm(100,sigma=matrix(c(1,0.8,0.8,1),ncol=2))
A <- rbind(a1,a2)
testresult <- patternchange(A[,1],A[,2])
plot(testresult)
testresult

ordinalpattern documentation built on Aug. 9, 2023, 5:09 p.m.