patterndependence {ordinalpattern} | R Documentation |
Ordinal Pattern Dependence
Description
Calculates the standard ordinal pattern coefficient and related values
Usage
patterndependence(tsx,tsy,h=2,block=FALSE,first=TRUE)
## S3 method for class 'pattern'
plot(x, ...)
## S3 method for class 'pattern'
print(x, ...)
Arguments
tsx |
numeric vector representing the first univariate time series. |
tsy |
numeric vector representing the second univariate time series. |
h |
numeric value determining the length of the ordinal pattern. |
block |
logical value determining whether patterns are calculated on disjoint blocks or overlapping blocks. |
first |
logical value indicating which observartions are dropped if |
x |
object of class |
... |
further arguments passed to the internal plotting function. |
Details
The standard ordinal pattern coefficient is a non-parametric and robust measure of dependence between two time series. It is based on ordinal patterns, which are defined as sequences of ranks of h+1
subsequent observations. This sequences of subseqent observations can either move one observation per time or a whole block of h+1
observations. The former is preferred since it uses more information. If one chooses the later, one has to decide whether the first or the last observations are removed in case that the time series length is no multiple of h+1
.
Beside the standard ordinal pattern coefficient, which range from -1 to 1, one can also look at the positive and negative ordinal pattern coefficient, which roughly measures wheather there are unsual many identical or opposite patterns in the time series.
The plot function draws both time series and shows the six most frequent coinciding pattern with counts on the right. At the bottom, the location of these coinciding patterns is visualized.
Value
Object of class "pattern"
containing the following values:
patterncoef |
standard ordinal pattern coefficient. |
alpha |
positive ordinal pattern coefficient, see details. |
beta |
negative ordinal pattern coefficient, see details. |
numbequal |
number of equal ordinal patterns. |
numbopposite |
number of opposite ordinal patterns. |
PatternXz |
number of ordinal patterns in first time series. |
PatternYz |
number or ordinal patterns in second time series. |
coding |
coding of the ordinal patterns, used in |
PatternX |
numeric vector representing the time series of patterns in |
PatternY |
numeric vector representing the time series of patterns in |
tsx |
numeric vector representing the first univariate time series. |
tsy |
numeric vector representing the second univariate time series. |
maxpat |
number representing the maximal pattern code. |
block |
logical value determining whether patterns are calculated on disjoint blocks or overlapping blocks. |
h |
number of consecutive observations defining one pattern |
tablesame |
numeric vector representing the number of coinciding patterns, apportioned into different patterns. |
tablesame |
numeric vector representing the number of reflected patterns, apportioned into different patterns. |
indexsame |
logic vector indicating whether patterns in both time series coincide. |
indexsame |
logic vector indicating whether patterns in both time series are reflected. |
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.
Examples
set.seed(1066)
patternobj <- patterndependence(rnorm(100),rnorm(100))
plot(patternobj)