Learn R Programming

robCompositions (version 1.3.2)

aDist: Aitchison distance

Description

Computes the Aitchison distance between two observations or between two data sets.

Usage

aDist(x, y)

Arguments

x
a vector, matrix or data.frame
y
a vector, matrix or data.frame with equal dimension as x

Value

  • The Aitchison distance between two compositions or between two data sets.

Details

This distance measure accounts for the relative scale property of the Aitchison distance. It measures the distance between two compositions if x and y are vectors and evaluate sum of the distances between x and y for each row of x and y if x and y are matrizes or data frames. It is not designed to apply it on one matrix, such as function acomp() in package compositions, but it is designed to compare different matrices. The underlying code is written in C and allows a fast computation also for large data sets.

References

Aitchison, J. (1986) The Statistical Analysis of Compositional Data Monographs on Statistics and Applied Probability. Chapman & Hall Ltd., London (UK). 416p.

See Also

ilr

Examples

Run this code
data(expenditures)
x <- xOrig <- expenditures
## Aitchison distance between the first 2 observations:
aDist(x[,1], x[,2])

## set some missing values:
x[1,3] <- x[3,5] <- x[2,4] <- x[5,3] <- x[8,3] <- NA

## impute them:
xImp <- impCoda(x, method="ltsReg")$xImp

## calculate the relative Aitchsion distance between xOrig and xImp:
aDist(xOrig, xImp)

Run the code above in your browser using DataLab