clr: Centred Log-Ratio (clr) transformation

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

View source: R/clr.R

Description

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

Usage

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

Arguments

xx

a n by p matrix to be log centred. 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/parts 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. A centred log-ratio is one procedure for removing closure effects, others are additive log-ratios (alr) and isometric log-ratios (ilr).

Value

x

a n by p matrix of log-centred values.

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 clr transform is suitable for the study of correlation coefficients and subsequent multivariate data analyses. However, for the calculation of Mahalanobis distances, which require matrix inversion, ilr should be used. Furthermore, in some cases it is preferable to use an ilr transform prior to undertaking a Principal Component or Factor Analysis, however, a clr transform is often sufficient.

The ifclose option can be useful if a petrochemical ternary system is under investigation. A data subset for a ternary system may be closed and transformed for investigation in x-y plots and comparison with the inferences that may be drawn from a classical ternary diagram display. Ternary plots are not included in this release of 'rgr', their use is discouraged as they do not reveal the true inter-component relationships. However, their use as classification tools is acknowledged where a user's data may be compared to data for known rock types and processes, etc. R users interested in ternary and classification diagrams rather than exploratory data analysis should investigate GCDkit (ver 2.3, R 2.7.0 2008/05/11) by Janousek, Farrow, Erban and Smid. See also Janousek et al. (2006).

Author(s)

Robert G. Garrett

References

Aitchison, J., 1984. The statistical analysis of geochemical compositions. Mathematical Geology, 16(6):531-564.

Aitchison, J., 1986. The Statistical Analysis of Compositional data. Chapman and Hall, London, U.K., 416 p.

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.

Janousek, V., Farrow, C.M. and Erban, V., 2006. Interpretation of whole-rock geochemical data in igneous geochemistry introducing Geochemical Data Toolkit (GCDkit). Journal of Petrology, 47(6):1255-1259.

Reimann, C., Filzmoser, P., Garrett, R. and Dutter, R., 2008. Statistical Data Analysis Explained: Applied Environmental Statistics with R. Wiley, 362 p.

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Make test data available
data(sind)
sind.mat <- as.matrix(sind[, -c(1:3)])

## Undertake clr transform, note necessity
## of converting percent Fe to mg/kg
sind.mat[, 2] <- sind.mat[, 2] * 10000
temp <- clr(sind.mat)
temp

## Clean-up and detach test data
rm(sind.mat)
rm(temp)

Example output

Loading required package: MASS
Loading required package: fastICA
  ** Are the data all in the same measurement units? **
             Zn       Fe        Mn        Cd         Cu        Pb
N01 -0.30586371 5.803384 2.3151751 -4.400208 -1.5380074 -1.874480
N02 -0.37681539 5.780164 2.4445635 -4.799664 -1.3984666 -1.649781
N03 -0.30399723 5.891380 2.7717778 -4.552492 -1.5567602 -2.249907
N04 -0.16025911 5.686180 2.4787982 -4.765429 -1.3642319 -1.875058
N05 -0.17408469 5.638897 2.4113632 -4.818476 -1.2349567 -1.822743
N06 -0.42295698 5.478356 2.4441579 -4.301078 -1.4876677 -1.710811
N07 -0.47084063 5.558364 2.5439398 -4.422084 -1.4263521 -1.783027
N08 -0.33275163 5.669524 2.0924358 -4.384537 -1.5223357 -1.522336
N09  0.16061056 5.492080 2.1792519 -4.433386 -0.8622899 -2.536266
N10  0.15116054 6.293795 2.1473714 -4.818653 -1.7276103 -2.046064
N11 -0.19639101 5.992072 2.2275549 -4.546669 -1.2324829 -2.244084
N12  0.33143583 5.260578 2.0634761 -4.231175 -0.8025784 -2.621737
N13  0.84574692 4.725478 1.4304135 -4.183757  0.4214133 -3.239295
N14 -0.09382169 5.781811 2.3806137 -5.168996 -1.1318094 -1.767798
N15  1.18428523 4.473869 1.2419936 -4.010654  0.6467022 -3.536196
N16  0.96661755 4.964163 0.7479284 -4.229917  0.8330862 -3.281878
N17  0.02754589 5.724360 2.5364674 -4.759946 -1.7642136 -1.764214
N18 -0.27324645 5.683533 2.5078289 -4.973727 -1.6595408 -1.284847
N19 -0.03247004 5.841211 2.4001682 -5.225427 -1.6700788 -1.313404
N20 -0.67758914 5.698932 2.0203087 -4.174097 -1.1783644 -1.689190
N21 -0.31292086 5.672973 1.4410983 -4.342727 -0.8237465 -1.634677
N22 -0.22272375 6.119040 2.5718669 -4.811087 -1.4969008 -2.160195
N23 -0.03490901 5.370592 3.0380546 -4.516635 -1.5049024 -2.352200
N24 -0.10486605 5.674199 2.3779809 -4.604676 -1.4082727 -1.934366
N25 -0.13739817 5.974623 2.2829700 -4.519425 -1.3839306 -2.216840

rgr documentation built on May 2, 2019, 6:09 a.m.

Related to clr in rgr...