Compute the transformation matrix to express a composition using the oblique additive log-ratio coordinates.

alr_basis(dim, denominator = dim, numerator = which(denominator != 1:dim))

Arguments

dim

number of parts

denominator

part used as denominator (default behaviour is to use last part)

numerator

parts to be used as numerator. By default all except the denominator parts are chosen following original order.

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

alr_basis(5)
#>    alr1 alr2 alr3 alr4
#> c1    1    0    0    0
#> c2    0    1    0    0
#> c3    0    0    1    0
#> c4    0    0    0    1
#> c5   -1   -1   -1   -1
# Third part is used as denominator
alr_basis(5, 3)
#>    alr1 alr2 alr3 alr4
#> c1    1    0    0    0
#> c2    0    1    0    0
#> c3   -1   -1   -1   -1
#> c4    0    0    1    0
#> c5    0    0    0    1
# Third part is used as denominator, and
# other parts are rearranged
alr_basis(5, 3, c(1,5,2,4))
#>    alr1 alr2 alr3 alr4
#> c1    1    0    0    0
#> c2    0    0    1    0
#> c3   -1   -1   -1   -1
#> c4    0    0    0    1
#> c5    0    1    0    0