alr: Additive log ratio transform

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

View source: R/compositions.R

Description

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

Usage

1
2
3
          alr( x ,ivar=ncol(x), ... )
          alrInv( z, ...,orig=NULL)
          

Arguments

x

a composition, not necessarily closed

z

the alr-transform of a composition, thus a (D-1)-dimensional real vector

...

generic arguments. not used.

orig

a compositional object which should be mimicked by the inverse transformation. It is especially used to reconstruct the names of the parts.

ivar

The column to be used as denominator variable. Unfortunately not yet supported in alrInv. The default works even if x is a vector.

Details

The alr-transform maps a composition in the D-part Aitchison-simplex non-isometrically to a D-1 dimensonal euclidian vector, treating the last part as common denominator of the others. The data can then be analysed in this transformation by all classical multivariate analysis tools not relying on a distance. The interpretation of the results is relatively simple, since the relation to the original D-1 first parts is preserved. However distance is an extremely relevant concept in most types of analysis, where a clr or ilr transformation should be preferred.

The additive logratio transform is given by

alr(x)_i := \ln(x_i/x_D)

.

Value

alr gives the additive log ratio transform; accepts a compositional dataset alrInv gives a closed composition with the given alr-transform; accepts a dataset

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

clr,alr,apt, http://ima.udg.es/Activitats/CoDaWork03

Examples

1
2
3
4
5
6
(tmp <- alr(c(1,2,3)))
alrInv(tmp)
unclass(alrInv(tmp)) - clo(c(1,2,3)) # 0
data(Hydrochem)
cdata <- Hydrochem[,6:19]
pairs(alr(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] -1.0986123 -0.4054651
attr(,"class")
[1] "rmult"
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.1666667 0.3333333 0.5000000
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.
[1] 2.775558e-17 0.000000e+00 0.000000e+00
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 message:
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.