Function to perform isometric log-ratio transformation
Function to perform isometric log-ratio transformation
This implementation is a special case of the class of isometric log-ratio transformations.
ilr(x)invilr(x)
Arguments
x: A numeric vector. Naturally, the forward transformation is only sensible for vectors with all elements being greater than zero.
Returns
The result of the forward or backward transformation. The returned components always sum to 1 for the case of the inverse log-ratio transformation.
Examples
# Order mattersilr(c(0.1,1,10))ilr(c(10,1,0.1))# Equal entries give ilr transformations with zeros as elementsilr(c(3,3,3))# Almost equal entries give small numbersilr(c(0.3,0.4,0.3))# Only the ratio between the numbers counts, not their suminvilr(ilr(c(0.7,0.29,0.01)))invilr(ilr(2.1* c(0.7,0.29,0.01)))# Inverse transformation of larger numbers gives unequal elementsinvilr(-10)invilr(c(-10,0))# The sum of the elements of the inverse ilr is 1sum(invilr(c(-10,0)))# This is why we do not need all elements of the inverse transformation to go back:a <- c(0.1,0.3,0.5)b <- invilr(a)length(b)# Four elementsilr(c(b[1:3],1- sum(b[1:3])))# Gives c(0.1, 0.3, 0.5)
References
Peter Filzmoser, Karel Hron (2008) Outlier Detection for Compositional Data Using Robust Methods. Math Geosci 40 233-248
See Also
Another implementation can be found in R package robCompositions.