If your data is compositional, it means that the only relevant information available in your data is the relative information you have between parts. Therefore, you are interested in studying the relations between parts relatively. The log-ratio methodology studies this relative relations using the quotient between parts, to be more precise, using the logarithm between ratios of parts.
You can see that all the possible ratios between a $k$-part composition, $(x_1,\dots,x_k)$, are completely caracterized by considering only $k-1$ certain (independant) log-ratios. A common approach is to consider all the ratios against the last component, $(\log\frac{x_1}{x_k}, \dots, \log\frac{x_{k-1}}{x_k}))$, this approach is known as the additive log-ratio transformation (alr). It is possible to interpret the alr tranformation as the coordinates with respect a certain basis.
- A first problem you have with the alr tranformation is that the basis used to obtain the trnaformed values is not orthogonal but oblique and
- a second problem is that the simplex does not seems to have an standard basis.
Although, you can define orthonormal basis in the simplex and with this basis you can define a transformation. This tranformation is commonly known as ilr transformation (ilr) and the function implemented inside the package compositions is to obtain the ilr coordinates with respect to an orthonormal basis.
With your example (I've reduced the number of composition),
set.seed(1)
# loading library
library(compositions)
# Generate data
dataset <- data.frame(
x = runif(5, min = 0.2, max = 0.65),
y = runif(5, min = 0.2, max = 0.4),
z = runif(5, min = 0.1, max = 0.7))
# Make data compositional
dataset.compositional = acomp(dataset)
you have that the coordinates of your sample
(X <- dataset.compositional/rowSums(dataset.compositional))
# x y z
# [1,] 0.3462279 0.4114672 0.2423048
# [2,] 0.3818417 0.4041619 0.2139964
# [3,] 0.3515582 0.2550841 0.3933578
# [4,] 0.4811888 0.2575718 0.2612394
# [5,] 0.2730063 0.1993929 0.5276008
are
(dataset.ilr <- ilr(dataset.compositional))
# [,1] [,2]
# [1,] 0.12206935 -0.3618850
# [2,] 0.04017035 -0.4959822
# [3,] -0.22682715 0.2226876
# [4,] -0.44191428 -0.2435951
# [5,] -0.22218525 0.6662235
By default, the ilr
function uses the basis (in columns)
(B <- exp(ilrBase(D=3))
# 1 0.4930687 0.6648138
# 2 2.0281150 0.6648138
# 3 1.0000000 2.2625592
which means that your original sample can be obtained from the orthnormal basis B and the ilr coordinates.
X1 = t(apply(dataset.ilr, 1, function(x){
B[,1]^x[1] * B[,2]^x[2]
}))
X1 / rowSums(X1)
# 1 2 3
# [1,] 0.3462279 0.4114672 0.2423048
# [2,] 0.3818417 0.4041619 0.2139964
# [3,] 0.3515582 0.2550841 0.3933578
# [4,] 0.4811888 0.2575718 0.2612394
# [5,] 0.2730063 0.1993929 0.5276008
In this case, taking into an account the basis B, we see that (except for a constant term) the first column of the ilr coordinates is comparing the first component against the second component
1/sqrt(2) * log(X[,2]/X[,1]) # Compare with first column of dataset.ilr
# [1] 0.12206935 0.04017035 -0.22682715 -0.44191428 -0.22218525
the second column is comparing (expect for a constant term) the thir component against the other components (in fact, against the geometric mean of first and second component)
sqrt(2)/sqrt(3) * log(X[,3] / (X[,1]*X[,2])^(1/2))
# [1] -0.3618850 -0.4959822 0.2226876 -0.2435951 0.6662235
Finally, I think that a good place to find more information about the subject: articles, books, ... is http://www.compositionaldata.com/material.php