MinkowskiDistance: Minkowski distance.

View source: R/proxy_wrappers.R

MinkowskiDistanceR Documentation

Minkowski distance.

Description

Computes the Minkowski distance between two numeric vectors for a given p.

Usage

MinkowskiDistance(x, y, p)

Arguments

x

Numeric vector containing the first time series.

y

Numeric vector containing the second time series.

p

A strictly positive integer value that defines the chosen L_p norm.

Details

The Minkowski distance is computed between the two numeric series using the following formula:

D=√[p]{(x_i-y_i)^p)}

The two series must have the same length and p must be a positive integer value. This distance is calculated with the help of the dist function of the proxy package.

Value

d

The computed distance between the pair of series.

Author(s)

Usue Mori, Alexander Mendiburu, Jose A. Lozano.

References

David Meyer and Christian Buchta (2015). proxy: Distance and Similarity Measures. R package version 0.4-14. http://CRAN.R-project.org/package=proxy

See Also

This function can also be invoked by the wrapper function LPDistance.

Furthermore, 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)


# Compute the Minkowski distance between them:

MinkowskiDistance(example.series1, example.series2, p=3)

TSdist documentation built on Aug. 31, 2022, 5:09 p.m.