R: Fourier Coefficient based distance.

FourierDistance {TSdist} | R Documentation

## Fourier Coefficient based distance.

### Description

Computes the distance between a pair of numerical series based on their Discrete Fourier Transforms.

### Usage

    FourierDistance(x, y, n = (floor(length(x) / 2) + 1))

### Arguments

`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) )

### Details

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.

### Value

`d` | The computed distance between the pair of series.

### Author(s)

Usue Mori, Alexander Mendiburu, Jose A. Lozano.

### References

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).

### See Also

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`.

### Examples

    # 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)

[Package TSdist version 3.6 Index]