clr: Centered log ratio transform

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

View source: R/compositions.R

Description

Compute the centered log ratio transform of a (dataset of) composition(s) and its inverse.

Usage

1
2
3
          clr( x,... )
          clrInv( z,... )
          

Arguments

x

a composition or a data matrix of compositions, not necessarily closed

z

the clr-transform of a composition or a data matrix of clr-transforms of compositions, not necessarily centered (i.e. summing up to zero)

...

for generic use only

Details

The clr-transform maps a composition in the D-part Aitchison-simplex isometrically to a D-dimensonal euclidian vector subspace: consequently, the transformation is not injective. Thus resulting covariance matrices are always singular.
The data can then be analysed in this transformation by all classical multivariate analysis tools not relying on a full rank of the covariance. See ilr and alr for alternatives. The interpretation of the results is relatively easy since the relation between each original part and a transformed variable is preserved.
The centered logratio transform is given by

clr(x) := (\emph{ln} \bold{x} - mean(\emph{ln} \bold{x]) ) } The image of the \code{clr} is a vector with entries summing to 0. This hyperplane is also called the clr-plane.

Value

clr gives the centered log ratio transform, clrInv gives closed compositions with the given clr-transform

Author(s)

K.Gerald v.d. Boogaart http://www.stat.boogaart.de

References

Aitchison, J. (1986) The Statistical Analysis of Compositional Data, Monographs on Statistics and Applied Probability. Chapman & Hall Ltd., London (UK). 416p.

See Also

ilr,alr,apt

Examples

1
2
3
4
5
6
(tmp <- clr(c(1,2,3)))
clrInv(tmp)
clrInv(tmp) - clo(c(1,2,3)) # 0
data(Hydrochem)
cdata <- Hydrochem[,6:19]
pairs(clr(cdata),pch=".") 

Example output

Loading required package: tensorA

Attaching package: 'tensorA'

The following object is masked from 'package:base':

    norm

Loading required package: robustbase
Loading required package: energy
Loading required package: bayesm
Welcome to compositions, a package for compositional data analysis.
Find an intro with "? compositions"


Attaching package: 'compositions'

The following objects are masked from 'package:stats':

    cor, cov, dist, var

The following objects are masked from 'package:base':

    %*%, scale, scale.default

[1] -0.59725316  0.09589402  0.50135913
attr(,"orig")
      missingType
       NMV BDT MAR MNAR SZ Err
  [1,]   3   0   0    0  0   0
attr(,"class")
[1] "rmult"
Warning messages:
1: In structure(c(), class = c(class(x), class(y))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
2: In structure(c(), class = c(class(x), class(y))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
[1] 0.1666667 0.3333333 0.5000000
attr(,"class")
[1] acomp
Warning message:
In structure(c(), class = c(class(x), class(y))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
[1] 0.3333333 0.3333333 0.3333333
attr(,"class")
[1] acomp
Warning messages:
1: In structure(c(), class = c(class(x), class(y))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
2: In structure(c(), class = c(class(x), class(y))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
3: In structure(c(), class = c(class(x), class(y))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
Warning messages:
1: In structure(c(), class = c(class(x), class(y))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
2: In structure(c(), class = c(class(x), class(y))) :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.

compositions documentation built on May 30, 2017, 3:25 a.m.