patterndependence | R Documentation |
Calculates the ordinal pattern coefficient and related values.
patterndependence(tsx,tsy,h=2,block=FALSE,first=TRUE,
tiesmethod=c("random","first"),ordinalcor=c("standard","positive","negative"))
## S3 method for class 'pattern'
plot(x, ...)
## S3 method for class 'pattern'
print(x, ...)
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; ordinal patterns are of length h+1. |
block |
logical value determining whether patterns are calculated on disjoint blocks or overlapping blocks. |
first |
logical value indicating which observartions are dropped if |
tiesmethod |
character string specifying how ties, that is equal values, are treated, see ‘Details’. |
ordinalcor |
character string specifying which ordinal pattern coefficient is output, see ‘Details’. |
x |
object of class |
... |
further arguments passed to the internal plotting function. |
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
. With regard to equal values within a window of consecutive observations (ties), the argument tiesmethod
determines the approach for computing the respective ordinal patterns. The “first
” method is in favor of increasing patterns, whereas the default “random
” puts the equal values in random order.
Beside the default 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 whether 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.
Object of class "pattern"
containing the following values:
patterncoef |
ordinal pattern coefficient. |
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. |
ordinalcor |
character string specifying the type of ordinal pattern coefficient. |
tiesmethod |
character string specifying how ties are treated. |
block |
logical value determining whether patterns are calculated on disjoint blocks or overlapping blocks. |
h |
number of increments defining one pattern; ordinal patterns are of length h+1. |
tablesame |
numeric vector representing the number of coinciding patterns, apportioned into different patterns. |
tableopposite |
numeric vector representing the number of reflected patterns, apportioned into different patterns. |
indexsame |
logic vector indicating whether patterns in both time series coincide. |
indexopposite |
logic vector indicating whether patterns in both time series are reflected. |
Alexander Dürre, Angelika Silbernagel
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.
set.seed(1066)
patternobj <- patterndependence(rnorm(100),rnorm(100))
plot(patternobj)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.