Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: xclust
See also: distance mat2vec

Quantlet: lpdist
Description: computes the so-called Lp-distances between the rows of a data matrix. In the case p=1 (absolute metric) or p=2 (euclidean metric) one should favour the function DISTANCE.

Usage: d = lpdist(x, q, p)
Input:
x n x m matrix
q m x 1 matrix of non-negative weights of columns
p scalar parameter (p>0) of the Lp-metric
Output:
d n(n-1)/2 x 1 matrix of paired distances between the n row points (the sequence of distances is described in AGGLOM)

Example:

; load the library xclust

library ("xclust")

; generate some data

x = #(0, 0, 1, 1)~#(0, 1, 0, 1)

; column weights

q = #(1, 1)

; apply euclidean metric

lpdist (x, q, 2)

Result:

Content of object d

[1,]        1 

[2,]        1 

[3,]   1.4142 

[4,]   1.4142 

[5,]        1 

[6,]        1 


Library: xclust
See also: distance mat2vec

Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Author: Hans-Joachim Mucha, 941111 Sigbert Klinke, 970902
(C) MD*TECH Method and Data Technologies, 21.9.2000