idt: Isometric default transform

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

View source: R/compositions.R

Description

Compute the isometric default transform of a vector (or dataset) of compositions or amounts in the selected class.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
          idt(x,...)
          ## Default S3 method:
idt( x,... )
          ## S3 method for class 'acomp'
idt( x ,...)
          ## S3 method for class 'rcomp'
idt( x ,...)
          ## S3 method for class 'aplus'
idt( x ,...)
          ## S3 method for class 'rplus'
idt( x ,...)
          ## S3 method for class 'rmult'
idt( x ,...)
          ## S3 method for class 'ccomp'
idt( x ,...)
          ## S3 method for class 'factor'
idt( x ,...)
          ## S3 method for class 'data.frame'
idt( x ,...)
          idtInv(x,orig=gsi.orig(x),...)
          ## Default S3 method:
idtInv( x ,orig=gsi.orig(x),...)
          ## S3 method for class 'acomp'
idtInv( x ,orig=gsi.orig(x), V=gsi.getV(x),...)
          ## S3 method for class 'rcomp'
idtInv( x ,orig=gsi.orig(x), V=gsi.getV(x),...)
          ## S3 method for class 'aplus'
idtInv( x ,orig=gsi.orig(x),...)
          ## S3 method for class 'rplus'
idtInv( x ,orig=gsi.orig(x),...)
          ## S3 method for class 'ccomp'
idtInv( x ,orig=gsi.orig(x),...)
          ## S3 method for class 'rmult'
idtInv( x ,orig=gsi.orig(x),...)
          ## S3 method for class 'factor'
idtInv( x ,orig=gsi.orig(x), V=gsi.getV(x),...)
          ## S3 method for class 'data.frame'
idtInv( x , orig=gsi.orig(x), ...)

          

Arguments

x

a classed amount or composition, to be transformed with its isometric default transform, or its inverse; in case of the method for data.frame objects, the function attempts to track information about a previous class (in an attribute origClass, and if found, a transformation is tried with it; for factors, idt expands the factor according to the contrasts represented by V, or vice-versa.)

...

generic arguments past to underlying functions

orig

a compositional object which should be mimicked by the inverse transformation. It is the generic argument. Typically the orig argument is stored as an attribute in x and will be extracted automatically by this function; if this fails, orig can be set equal to the dataset that was transformed in the first place.

V

matrix of (transposed, inverted) logcontrasts; together with orig, it defines the back-transformation. Typically the V argument is stored as an attribute in x and will be extracted automatically by this function; if this fails, V must be manually set to the matrix V used in the idt/ilr/ipt calculations. Argument not used in amounts or counts geometries.

Details

The general idea of this package is to analyse the same data with different geometric concepts, in a fashion as similar as possible. For each of the four concepts there exists an isometric transform expressing the geometry in a full-rank euclidean vector space. Such a transformation is computed by idt. For acomp the transform is ilr, for rcomp it is ipt, for aplus it is ilt, and for rplus it is iit. Keep in mind that the transform does not keep the variable names, since there is no guaranteed one-to-one relation between the original parts and each transformed variable.
The inverse idtInv is intended to allow for an "easy" and automatic back-transformation, without intervention of the user. The argument orig (the one determining the behaviour of idtInv as a generic function) tells the function which back-transformation should be applied, and gives the column names of orig to the back-transformed values of x. Therefore, it is very conventient to give the original classed data set used in the analysis as orig.

Value

A corresponding matrix of row-vectors containing the transforms. (Exception: idt.data.frame can return a data.frame if the input has no "origClass"-attribute)

Author(s)

R. Tolosana-Delgado, K.Gerald v.d. Boogaart http://www.stat.boogaart.de

References

van den Boogaart, K.G. and R. Tolosana-Delgado (2008) "compositions": a unified R package to analyze Compositional Data, Computers & Geosciences, 34 (4), pages 320-338, doi: 10.1016/j.cageo.2006.11.017.

See Also

backtransform, cdt, ilr, ipt, ilt, cdtInv, ilrInv, iptInv, iltInv, iitInv

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 
# the idt is defined by
idt         <- function(x) UseMethod("idt",x)
idt.default <- function(x) x
idt.acomp   <- function(x) ilr(x) 
idt.rcomp   <- function(x) ipt(x) 
idt.aplus   <- ilt 
idt.rplus   <- iit 

## End(Not run)
idt(acomp(1:5))
idt(rcomp(1:5))
  data(Hydrochem)
  x = Hydrochem[,c("Na","K","Mg","Ca")]
  y = acomp(x)
  z = idt(y)
  y2 = idtInv(z,y)
  par(mfrow=c(2,2))
  for(i in 1:4){plot(y[,i],y2[,i])}

compositions documentation built on Jan. 5, 2022, 5:09 p.m.