base_lr_transforms: Log-Ratio Transformation

Description Usage Arguments Details Value Examples

Description

glr is generic log-ratio transform, code used by other transforms, can be called directly.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
glr(x, V)

glrInv(y, V)

create_alr_base(D, d, inv = FALSE)

alr(x, d = NULL)

alrInv(y, d = NULL)

create_default_ilr_base(D)

ilr(x, V = NULL)

ilrInv(y, V = NULL)

create_clr_base(D, inv = FALSE)

clr(x)

clrInv(y)

Arguments

x

vector or matrix (rows are samples, parts are columns) of data in simplex

V

transformation matrix (defines transform)

y

matrix (rows are samples, coords are columns) of transformed data

D

the number of parts (e.g., number of columns in untransformed data)

d

for ALR, which component (integer position) to take as reference (default is ncol(x)) for alrInv corresponds to column position in untransformed matrix.

inv

for ALR and CLR, transformation matrix is different forward and inverse

Details

The implementation of the ILR transform here relies on the fact that all the standard log-ratio transforms can be written in the following form

y=\log(x)V

with inverse transform given by

x=\mathcal{C}[exp(yV^t)]

where \mathcal{C}[\cdot] is the closure operator (miniclo). Note however that if V does not represent an orthonormal basis in the Aitchison geometry then the V used for the log-ratio transform may be different than the one used for the reverse transform (this is the case for the ALR and CLR transforms). Default ILR base formed by Gram-Schmidt orthogonalization of an ALR basis.

Value

matrix (converts vectors to row matricies)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#ALR Transform
x <- matrix(runif(30), 10, 3)
x <- miniclo(x)
x.alr <- alr(x, 2)
x <- alrInv(x.alr, 2)

# ILR
x.ilr <- ilr(x)
x <- ilrInv(x.ilr)

# CLR
x.clr <- clr(x)
x <- clrInv(x.clr)

# CUSTOM - Be careful if your custom matrix is not
# orthogonal the inverse transform may not be given by just the transpose!
# For example, this is the case for the ALR
V <- matrix(c(1, 1, -1), 3, 1)
x.custom <- glr(x, V)

jsilve24/driver documentation built on Jan. 30, 2022, 12:07 p.m.