FourierDistance {TSdist} | R Documentation |
Computes the distance between a pair of numerical series based on their Discrete Fourier Transforms.
FourierDistance(x, y, n = (floor(length(x) / 2) + 1))
x |
Numeric vector containing the first time series. |
y |
Numeric vector containing the second time series. |
n |
Positive integer that represents the number of Fourier Coefficients to consider. ( default=(floor(length(x) / 2) + 1) ) |
The Euclidean distance between the first n
Fourier coefficients of series x
and y
is computed. The series must have the same length. Furthermore, n
should not be larger than the length of the series.
d |
The computed distance between the pair of series. |
Usue Mori, Alexander Mendiburu, Jose A. Lozano.
Agrawal, R., Faloutsos, C., & Swami, A. (1993). Efficient similarity search in sequence databases. In Proceedings of the 4th International Conference of Foundations of Data Organization and Algorithms (Vol. 5, pp. 69-84).
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.series1 and example.series2 are two
# numeric series of length 100 contained in the TSdist package.
data(example.series1)
data(example.series2)
# For information on their generation and shape see help
# page of example.series.
help(example.series)
# Calculate the Fourier coefficient based distance using
# the default number of coefficients:
FourierDistance(example.series1, example.series2)
# Calculate the Fourier coefficient based distance using
# only the first 20 Fourier coefficients:
FourierDistance(example.series1, example.series2, n=20)