L1.dist: Different distances between two given vectors

Description Usage Arguments Value Author(s) See Also Examples

View source: R/StabilityFunctions.R

Description

These functions are used for calculating different distances between two given vectors. Thus, L1.dist calculates the L1 distance, cosin.dist calculates the cosine distance, euclidian.dist computes the Euclidian distance, and rank.cor.dist computes the rank correlation distance. The vectors have to have same length. When using rank.cor.dist the vectors have to have length larger than 4.

Usage

1
2
3
4

Arguments

p

A numeric vector specifying the first component for the distance calculation. It has to have the same length as q.

q

A numeric vector specifying the second component for the distance calculation.

x

Same as p.

y

Same as q.

Value

The functions return the distance between the two given vectors.

Author(s)

Jasmina Bogojeska

See Also

kullback.leibler, L2.norm, stability.sim

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Define two numeric vectors with equal lengths (> 4).
x <- c(1, 2, 3, 4, 5)
y <- c(5, 6, 7, 8, 9)

## Calculate the L1 distance between the vectors x and y
L1.dist(x, y)

## Calculate the Euclidian distance between the vectors x and y
euclidian.dist(x, y)

## Calculate the cosine distance between the vectors x and y
cosin.dist(x, y)

## Calculate the rank-correlation distance between the vectors x and y
rank.cor.dist(x, y)

Rtreemix documentation built on Nov. 8, 2020, 5:57 p.m.