isomLR {complmrob} | R Documentation |
(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 = \sqrt{\frac{D - i}{D -i + 1}} \log{ \frac{x_i}{ \left( \prod_{j=i+1}^{D} x_j \right)^{1/(D - i)} }}
Usage
isomLR(x, comp = 1)
isomLRinv(z, perc = TRUE)
Arguments
x |
a numeric vector of length |
comp |
the component to use as the first compositional part |
z |
a numeric vector of length |
perc |
should the result be a matrix with percentage shares (default |
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
: Inverse transformation
Examples
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)