isomLR: (Inverse) Isometric log-ratio transformation for...

Description Usage Arguments Value Functions Examples

View source: R/isomLR.R

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

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)

Example output

            [,1]      [,2]      [,3]
 [1,] 0.08334000 0.7828109 0.1338491
 [2,] 0.08910738 0.5143648 0.3965278
 [3,] 0.03923599 0.8106016 0.1501624
 [4,] 0.14478842 0.5343736 0.3208380
 [5,] 0.03827275 0.7890746 0.1726526
 [6,] 0.08403358 0.5043082 0.4116582
 [7,] 0.04362153 0.8096515 0.1467270
 [8,] 0.10841551 0.6012514 0.2903331
 [9,] 0.06739447 0.7930027 0.1396028
[10,] 0.21073367 0.4767992 0.3124672
[11,] 0.06714572 0.6769404 0.2559139
[12,] 0.06696553 0.5672996 0.3657348
[13,] 0.06121030 0.7975352 0.1412545
[14,] 0.13285964 0.4796331 0.3875073
[15,] 0.03819795 0.7656035 0.1961985
[16,] 0.12428424 0.5028630 0.3728527
[17,] 0.09711100 0.7397025 0.1631865
[18,] 0.19929793 0.5134025 0.2872996
[19,] 0.03853176 0.8183503 0.1431180
[20,] 0.12865988 0.5548140 0.3165261
[21,] 0.04108871 0.8066963 0.1522150
[22,] 0.12387328 0.5167918 0.3593349
[23,] 0.03599360 0.7653750 0.1986314
[24,] 0.23431899 0.5168080 0.2488730
[25,] 0.05576541 0.7695030 0.1747316
[26,] 0.13345261 0.5017769 0.3647705
[27,] 0.04638068 0.7756469 0.1779724
[28,] 0.10549205 0.4967510 0.3977569
[29,] 0.04008407 0.7785833 0.1813327
[30,] 0.13363977 0.5268430 0.3395173
[31,] 0.05398761 0.7939946 0.1520178
[32,] 0.13764078 0.5387174 0.3236418
[33,] 0.08216597 0.8160746 0.1017594
[34,] 0.04501739 0.5441990 0.4107837
[35,] 0.06211275 0.7558033 0.1820840
[36,] 0.11802016 0.5243430 0.3576369
[37,] 0.03185074 0.7776948 0.1904544
[38,] 0.14856610 0.5000633 0.3513706
[39,] 0.04341484 0.8506019 0.1059833
[40,] 0.18187348 0.5339492 0.2841773
[41,] 0.05083085 0.7779494 0.1712197
[42,] 0.16913315 0.4861940 0.3446729
[43,] 0.07758399 0.7666371 0.1557789
[44,] 0.05918144 0.5173014 0.4235172
[45,] 0.04070852 0.7520481 0.2072434
[46,] 0.14280613 0.5094190 0.3477749
[47,] 0.02893501 0.7815407 0.1895243
[48,] 0.19227650 0.4940092 0.3137143
[49,] 0.04698436 0.7578498 0.1951658
[50,] 0.13837779 0.5441673 0.3174549

complmrob documentation built on Sept. 18, 2019, 1:02 a.m.

Related to isomLR in complmrob...