alr: Additive Log-Ratio (alr) transformation

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

Description

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

Usage

1
alr(xx, j = NULL, ifclose = FALSE, ifwarn = TRUE)

Arguments

xx

a n by p matrix to be additively log ratioed. 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.

j

the index number of the element in the range [1:p] to be used as the divisor, j, must be defined, there is no default index.

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 an additive 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. An additive log-ratio is one procedure for removing closure effects, others are centred log-ratios (clr) and isometric log-ratios (ilr).

Care should be taken in selecting the variable, index = j, for use as the divisor. Variables lacking sufficient significant figures in their quantification, or variables measured at close to their measurement detection limits, should be avoided.

The name of the divisor, j, retrieved from the matrix column names is displayed.

It is worth noting that when the alr transform is undertaken with a geochemically conservative element selected as the divisor and two elements are then displayed in an x-y plot the result is a Pearce Element Ratio plot (Pearce, 1968) with log scaling.

Value

x

a n by (p-1) matrix of additively log-ratioed values, the j-th column of the matrix being dropped.

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.

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.

Pearce, T.H., 1968. A contribution to the theory of variation diagrams. Contributions to Mineralogy and Petrolgy, 19(2):142-157.

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 alr transform, use Pb [j = 6] as the divisor,
## note necessity of converting percent Fe to mg/kg
sind.mat[, 2] <- sind.mat[, 2] * 10000
temp <- alr(sind.mat, 6)
temp

## Clean-up
rm(sind.mat)
rm(temp)

Example output

Loading required package: MASS
Loading required package: fastICA
  ** Are the data/parts all in the same measurement units? **
  The divisor is Pb 
          Zn       Fe       Mn         Cd         Cu
N01 1.568616 7.677864 4.189655 -2.5257286  0.3364722
N02 1.272966 7.429945 4.094345 -3.1498830  0.2513144
N03 1.945910 8.141287 5.021685 -2.3025851  0.6931472
N04 1.714798 7.561237 4.353856 -2.8903718  0.5108256
N05 1.648659 7.461640 4.234107 -2.9957323  0.5877867
N06 1.287854 7.189168 4.154969 -2.5902672  0.2231436
N07 1.312186 7.341391 4.326967 -2.6390573  0.3566749
N08 1.189584 7.191860 3.614771 -2.8622009  0.0000000
N09 2.696877 8.028346 4.715518 -1.8971200  1.6739764
N10 2.197225 8.339859 4.193435 -2.7725887  0.3184537
N11 2.047693 8.236156 4.471639 -2.3025851  1.0116009
N12 2.953173 7.882315 4.685213 -1.6094379  1.8191584
N13 4.085042 7.964774 4.669709 -0.9444616  3.6607086
N14 1.673976 7.549609 4.148412 -3.4011974  0.6359888
N15 4.720481 8.010064 4.778189 -0.4744580  4.1828980
N16 4.248495 8.246040 4.029806 -0.9480394  4.1149638
N17 1.791759 7.488573 4.300681 -2.9957323  0.0000000
N18 1.011601 6.968380 3.792676 -3.6888795 -0.3746934
N19 1.280934 7.154615 3.713572 -3.9120230 -0.3566749
N20 1.011601 7.388122 3.709499 -2.4849066  0.5108256
N21 1.321756 7.307649 3.075775 -2.7080502  0.8109302
N22 1.937471 8.279235 4.732062 -2.6508918  0.6632942
N23 2.317291 7.722792 5.390255 -2.1644348  0.8472979
N24 1.829500 7.608565 4.312347 -2.6703099  0.5260931
N25 2.079442 8.191463 4.499810 -2.3025851  0.8329091

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

Related to alr in rgr...