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 of n points
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 every two 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



Author: H.-J. Mucha, S. Klinke, 20010912
(C) MD*TECH Method and Data Technologies, 05.02.2006