(Inverse) Isometric log-ratio transformation for compositional data

Description

Projects the D-dimensional compositional data on the (D-1)-dimensional simplex isometrically back and forth by transforming the values according to

z_i = √((D - i)/(D - i + 1)) log( x_i / (∏ (j = i + 1 ... D) x_j)^(1/(D - i))

Usage

1
2
3
isomLR(x, comp = 1)

isomLRinv(z, perc = TRUE)

Arguments

x

a numeric vector of length D or a numeric matrix with D columns

comp

the component to use as the first compositional part

z

a numeric vector of length D-1 or a numeric matrix with D-1 columns.

perc

should the result be a matrix with percentage shares (default TRUE).

Value

isomLR: a numeric matrix with (D-1) columns with the transformed values. The name of the first column is the name of the first part (the other names are according to the order of the columns in the given matrix x)

isomLRinv: a numeric matrix with D columns with the transformed values. The values in the matrix are not on the original scale, but the percentage shares are equal.

Functions

  • isomLRinv:

Examples

1
2
3
4
5
6
X <- as.matrix(USArrests[ , -3])
# Get the ilr with relative information of the 1st column to the other cols
ilrZ1 <- isomLR(X)
# Get the ilr with relative information of the 2nd column to the other cols
ilrZ2 <- isomLR(X, 2)
isomLRinv(ilrZ1)