5. Distance Function


y = 1998 distance (x, metric)
computes the distance between p-dimensional data points in x depending on a specified metric

The áfunction 2001 distance evaluates the distance between two p-dimensional vectors with respect to a specified metric. The possible metrics are given in the following table:

Distance XploRe Name
L1 "l1"
L2 "l2", "euclid"
Maximum "maximum"
Cosine "cosine"
$\chi^2$ "chisquare"
Centroid "centroid"
Tanimoto "tanimoto"
Matching "matching"
   
Several of these distances (such as Tanimoto and Matching) are designed for binary data.

The first argument of 2004 distance is the matrix, the second argument the XploRe name. By default the second argument is "l2". The commands

  x = #(1, 4)~#(1, 5)
  distance(x,"l1")
define the matrix x and evaluate the L1 distance between the rows of that matrix:
  Contents of distance
  [1,]  0.000000  7.000000
  [2,]  7.000000  0.000000
while the command
  distance(x)
yields the L2 distance, since the second argument of the function 2011 distance is missing:
  Contents of distance
  [1,]  0.000000  5.000000
  [2,]  5.000000  0.000000
The examples for this section are collected in 2014matrix07.xpl.



Method and Data Technologies   MD*TECH Method and Data Technologies
  http://www.mdtech.de  mdtech@mdtech.de