Learn R Programming

TSdist (version 3.1)

DTWDistance: Dynamic Time Warping distance.

Description

Computes the Dynamic Time Warping distance between a pair of numeric time series.

Usage

DTWDistance(x, y, ...)

Arguments

x
Numeric vector containing the first time series.
y
Numeric vector containing the second time series.
...
Additional parameters for the function. See dtw for more information.

Value

  • dThe computed distance between the pair of series.

Details

This is simply a wrapper for the dtw function of package dtw. As such, all the functionalities of the dtw function are also available when using this function.

References

Giorgino T (2009). Computing and Visualizing Dynamic Time Warping Alignments in R: The dtw Package. Journal of Statistical Software, 31(7), pp. 1-24. URL:http://www.jstatsoft.org/v31/i07/

See Also

To calculate a lower bound of the DTW distance see LBKeoghDistance. 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

Run this code
# 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 basic DTW distance for two series of different length.

DTWDistance(example.series3, example.series4)

# Calculate the DTW distance for two series of different length
# with a sakoechiba window of size 30:

DTWDistance(example.series3, example.series4, window.type="sakoechiba", window.size=30)

# Calculate the DTW distance for two series of different length
# with an assymetric step pattern

DTWDistance(example.series3, example.series4, step.pattern=asymmetric)

Run the code above in your browser using DataLab