alfadist: The alpha-distance

View source: R/alfadist.R

The alpha-distanceR Documentation

The \alpha-distance

Description

This is the Euclidean (or Manhattan) distance after the \alpha-transformation has been applied.

Usage

alfadist(x, a, type = "euclidean", square = FALSE)
alfadista(xnew, x, a, type = "euclidean", square = FALSE)

Arguments

xnew

A matrix or a vector with new compositional data.

x

A matrix with the compositional data.

a

The value of the power transformation, it has to be between -1 and 1. If zero values are present it has to be greater than 0. If \alpha=0, the isometric log-ratio transformation is applied.

type

Which type distance do you want to calculate after the \alpha-transformation, "euclidean", or "manhattan".

square

In the case of the Euclidean distance, you can choose to return the squared distance by setting this TRUE.

Details

The \alpha-transformation is applied to the compositional data first and then the Euclidean or the Manhattan distance is calculated.

Value

For "alfadist" a matrix including the pairwise distances of all observations or the distances between xnew and x. For "alfadista" a matrix including the pairwise distances of all observations or the distances between xnew and x.

Author(s)

Michail Tsagris.

R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.

References

Tsagris M.T., Preston S. and Wood A.T.A. (2016). Improved classification for compositional data using the \alpha-transformation. Journal of Classification. 33(2):243–261. https://arxiv.org/pdf/1506.04976v2.pdf

Tsagris M.T., Preston S. and Wood A.T.A. (2011). A data-based power transformation for compositional data. In Proceedings of the 4th Compositional Data Analysis Workshop, Girona, Spain. https://arxiv.org/pdf/1106.1451.pdf

See Also

alfa, alfainv, alfa.reg, esov

Examples

library(MASS)
x <- as.matrix(fgl[1:20, 2:9])
x <- x / rowSums(x)
alfadist(x, 0.1)
alfadist(x, 1)

Compositional documentation built on Oct. 23, 2023, 5:09 p.m.