# Aitchison distance

### Description

Computes the Aitchison distance between two observations, between two data sets or within observations of one data set.

### Usage

1 |

### Arguments

`x` |
a vector, matrix or data.frame |

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

### 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. It evaluates the sum of the distances between
`x`

and `y`

for each row of `x`

and `y`

if `x`

and
`y`

are matrices or data frames. It computes a n times n distance matrix (with n
the number of observations/compositions) if only `x`

is provided.

The underlying code is partly written in C and allows a fast computation also for
large data sets whenever `y`

is supplied.

### Value

The Aitchison distance between two compositions or between two data sets, or a distance matrix in case codey is not supplied.

### Author(s)

Matthias Templ, Bernhard Meindl

### References

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

Aitchison, J. and Barcelo-Vidal, C. and Martin-Fernandez, J.A. and
Pawlowsky-Glahn, V. (2000) Logratio analysis and compositional distance.
*Mathematical Geology*, **32**, 271-275.

Hron, K. and Templ, M. and Filzmoser, P. (2010) Imputation of missing values
for compositional data using classical and robust methods
*Computational Statistics and Data Analysis*, vol 54 (12), pages
3095-3107.

### See Also

`isomLR`

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ```
data(expenditures)
x <- xOrig <- expenditures
## Aitchison distance between two 2 observations:
aDist(x[1, ], x[2, ])
## Aitchison distance of x:
aDist(x)
## Example of distances between matrices:
## 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)
``` |