ilr: Isometric Log-Ratio (ilr) transformation

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/ilr.R

Description

Undertakes an isometric log-ratio transformation to remove the effects of closure in a data matrix.

Usage

1
ilr(xx, ifclose = FALSE, ifwarn = TRUE)

Arguments

xx

a n by p matrix to be isometrically log-ratio transformed. It is essential that a single unit of measurement is used. Thus it may be required to convert, for example, determinations in percent to ppm (mg/kg) so that all measurements are in ppm prior to executing this function. Natural logarithms are used.

ifclose

if it is required to close a data set prior to transformation set ifclose = TRUE.

ifwarn

by default ifwarn = TRUE which generates a reminder/warning that when carrying out a centred log-ratio transformation all the data must be in the same measurement units. The message can be suppressed by setting ifwarn = FALSE.

Details

Most analytical chemical data for major, minor and trace elements are of a closed form, i.e. for a physical individual sample they sum to a constant, whether it be percent, ppm (mg/kg), or some other units. It does not matter that only some components contributing to the constant sum are present in the matrix, the data are closed. As a result, as some elements increase in concentration others must decrease, this leads to correlation measures and graphical presentations that do not reflect the true underlying relationships. However, isometrically transformed data matrices are not suitable for univariate EDA inspection as the new synthetic variables bear a complex relationship to the original measurements. For univariate studies use function gx.ilr, and for bivariate studies use gx.symm.coords Other procedures for removing closure effects are additive log-ratios (alr) and centred log-ratios (clr).

Value

x

a n by (p-1) matrix of isometric log-ratio values. The names of the new (p-1) synthetic variables, iso1 through to isop, where the p in isop equals p-1, are entered as column names in the matrix.

Note

Any less than detection limit values represented by negative values, or zeros or other numeric codes representing blanks in the data, must be removed prior to executing this function, see ltdl.fix.df.

Any rows containing NAs in the data matrix are removed prior to undertaking the transformation.

The ilr transform is recommended for the calculation of Mahalanobis distances, a procedure which requires matrix inversion. When a Principal Component or Factor Analysis is required use of the ilr transform may be preferrable, see also the notes in clr. In that instance back transformation from the isometrically transformed variables to the original variables is required. Interested R users should refer to the papers by Filzmoser et al. (see below).

Author(s)

Peter Filzmoser and Karel Hron, with additions by Robert G. Garrett

References

Aitchison, J. and Egozcue, J.J., 2005. Compositional data analysis; where are we and where should we be heading. Mathematical Geology, 37(7):829-850.

Buccianti, A., Mateu-Figueras, G, and Pawlowsky-Glahn, V. (eds.), 2006. Compositional data analysis in the geosciences: from theory to practice. The Geological Society Publishing House, Bath, U.K. Special Publication 264, 224 p.

Filzmoser, P. and Hron, K., 2008. Outlier detection for compositional data using robust methods. Mathematical Geosciences, 40(3):234-248.

Filzmoser, P., Hron, K. and Reimann, C., 2009. Principal component analysis for compositional data with outliers. Environmetrics, 20(6):621-633.

Filzmoser, P., Hron, K., Reimann, C. and Garrett, R.G., 2009. Robust factor analysis for compositional data. Computers & Geosciences, 35(9):1854-1861.

See Also

alr, clr, ltdl.fix.df, remove.na

Examples

1
2
3
4
5
6
7
8
9
## Make test data sind available
data(sind.mat2open)

## Undertake ilr transform
temp <- ilr(sind.mat2open)
temp

## Clean-up
rm(temp)

Example output

Loading required package: MASS
Loading required package: fastICA
  ** Are the data all in the same measurement units? **
         Iso1          Iso2     Iso3        Iso4     Iso5
N01 -4.319890  0.3540206433 6.066023  2.13869092 2.053390
N02 -4.353642  0.2099299310 6.422128  1.93243549 1.807245
N03 -4.380793  0.0178922056 6.355656  2.24360539 2.464650
N04 -4.134057  0.2320173487 6.437746  1.94453327 2.054023
N05 -4.110399  0.2621305153 6.446578  1.78830131 1.996715
N06 -4.172859  0.0682116180 5.889779  2.04581210 1.874100
N07 -4.263292 -0.0001453617 6.032651  1.99340706 1.953208
N08 -4.244250  0.4702614642 5.941748  2.04242767 1.667635
N09 -3.769918  0.5283495848 6.100312  1.53119582 2.778341
N10 -4.343499  0.8778207094 6.653467  2.38904087 2.241351
N11 -4.375904  0.5472857857 6.253639  1.87975022 2.458271
N12 -3.485430  0.5981089715 5.874254  1.48354810 2.871969
N13 -2.743384  1.1065155238 5.644439  0.25317402 3.548470
N14 -4.154700  0.3783490151 6.805686  1.66069301 1.936526
N15 -2.326087  1.2958481541 5.465229  0.06768242 3.873708
N16 -2.826691  1.8105499702 5.591193 -0.19756848 3.595117
N17 -4.028256  0.2771886493 6.514881  2.36694089 1.932599
N18 -4.212079  0.1611063357 6.593137  2.14272363 1.407480
N19 -4.153320  0.4116796455 6.895061  2.16089093 1.438762
N20 -4.508881  0.4003793554 5.647623  1.69516586 1.850415
N21 -4.232666  1.0115801574 5.724235  1.28650138 1.790699
N22 -4.484304  0.3072402982 6.611077  2.15662028 2.366375
N23 -3.822266 -0.3022777329 6.328810  2.20849998 2.576706
N24 -4.086416  0.3320576066 6.281958  2.00703415 2.118992
N25 -4.321852  0.5190000310 6.258035  2.04298187 2.428426

rgr documentation built on March 18, 2018, 1:59 p.m.

Related to ilr in rgr...