Compute the transformation matrix to express a composition using the linearly dependant centered log-ratio coordinates.

clr_basis(dim)

Arguments

dim

number of parts

Value

matrix

References

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

Examples

(B <- clr_basis(5))
#>    clr1 clr2 clr3 clr4 clr5
#> c1  0.8 -0.2 -0.2 -0.2 -0.2
#> c2 -0.2  0.8 -0.2 -0.2 -0.2
#> c3 -0.2 -0.2  0.8 -0.2 -0.2
#> c4 -0.2 -0.2 -0.2  0.8 -0.2
#> c5 -0.2 -0.2 -0.2 -0.2  0.8
# CLR coordinates are linearly dependant coordinates.
(clr_coordinates <- coordinates(c(1,2,3,4,5), B))
#>       clr1       clr2       clr3       clr4       clr5 
#> -0.9574983 -0.2643512  0.1411139  0.4287960  0.6519396 
# The sum of all coordinates equal to zero
sum(clr_coordinates) < 1e-15
#> [1] TRUE