View source: R/cross_correlation_distance.R
CCorDistance | R Documentation |
Computes the distance measure based on the cross-correlation between a pair of numeric time series.
CCorDistance(x, y, lag.max=(min(length(x), length(y))-1))
x |
Numeric vector containing the first time series. |
y |
Numeric vector containing the second time series. |
lag.max |
Positive integer that defines the maximum lag considered in the
cross-correlation calculations (default= |
The cross-correlation based distance between two numeric time series is calculated as follows:
D= √{ ((1 - CC(x, y, 0) ^ 2) / ∑ (1 - CC(x, y, k) ^ 2)) }
where CC(x,y,k) is the cross-correlation between x and y at lag k.
The summatory in the denominator goes from 1 to lag.max
. In view of this, the parameter must be a positive integer no larger than the length of the series.
d |
The computed distance between the pair of series. |
Usue Mori, Alexander Mendiburu, Jose A. Lozano.
Liao, T. W. (2005). Clustering of time series data-a survey. Pattern Recognition, 38(11), 1857-1874.
Pree, H., Herwig, B., Gruber, T., Sick, B., David, K., & Lukowicz, P. (2014). On general purpose time series similarity measures and their use as kernel functions in support vector machines. Information Sciences, 281, 478–495.
To calculate this distance measure using ts
, zoo
or xts
objects see TSDistances
. To calculate distance matrices of time series databases using this measure see TSDatabaseDistances
.
# The objects example.series3 and example.series4 are two # numeric series of length 100 and 120 contained in the # TSdist package. data(example.series3) data(example.series4) # For information on their generation and shape see # help page of example.series. help(example.series) # Calculate the cross-correlation based distance # using the default lag.max. CCorDistance(example.series3, example.series4) # Calculate the cross-correlaion based distance # with lag.max=50. CCorDistance(example.series3, example.series4, lag.max=50)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.