
Last chance! 50% off unlimited learning
Sale ends in
Compute the centered default transform of a (data set of) compositions or amounts (or its inverse).
cdt(x,...)
# S3 method for default
cdt( x ,...)
# S3 method for acomp
cdt( x ,...)
# S3 method for rcomp
cdt( x ,...)
# S3 method for aplus
cdt( x ,...)
# S3 method for rplus
cdt( x ,...)
# S3 method for rmult
cdt( x ,...)
# S3 method for ccomp
cdt( x ,...)
# S3 method for factor
cdt( x ,...)
# S3 method for data.frame
cdt( x ,...)
cdtInv(x,orig=gsi.orig(x),...)
# S3 method for default
cdtInv( x ,orig=gsi.orig(x),...)
# S3 method for acomp
cdtInv( x ,orig=gsi.orig(x),...)
# S3 method for rcomp
cdtInv( x ,orig=gsi.orig(x),...)
# S3 method for aplus
cdtInv( x ,orig=gsi.orig(x),...)
# S3 method for rplus
cdtInv( x ,orig=gsi.orig(x),...)
# S3 method for rmult
cdtInv( x ,orig=gsi.orig(x),...)
# S3 method for ccomp
cdtInv( x ,orig=gsi.orig(x),...)
# S3 method for factor
cdtInv( x ,orig=gsi.orig(x),...)
# S3 method for data.frame
cdtInv( x ,orig=gsi.orig(x),...)
a classed (matrix of) amount or composition, to be transformed with its
centered 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 cdt/Inv transformation is tried with it; for factors,
cdt expands the factor in indicator values for each category, or vice-versa.)
generic arguments past to underlying functions.
a compositional object which should be mimicked
by the inverse transformation. It is used to determine the
backtransform to be used and eventually to
reconstruct the names of the parts. It is the generic
argument. Typically this argument is extracted from x
,
but if this fails you can give the data set that
has be transformed in the first place.
A corresponding matrix or vector containing the transforms. (Exception: cdt.data.frame can return a data.frame if the input has no "origClass"-attribute)
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 a unique transform expressing the geometry
in a linear subspace, keeping the relation to the variables. This
unique transformation is computed by cdt
. For
acomp
the transform is clr
, for
rcomp
it is cpt
, for
aplus
it is ilt
, and for
rplus
it is iit
. Each component of the result
is identified with a unit vector in the direction of the corresponding
component of the original composition or amount. Keep in mind that the
transform is not necessarily surjective and thus variances in the
image space might be singular.
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, 10.1016/j.cageo.2006.11.017.
# NOT RUN {
# the cdt is defined by
cdt <- function(x) UseMethod("cdt",x)
cdt.default <- function(x) x
cdt.acomp <- clr
cdt.rcomp <- cpt
cdt.aplus <- ilt
cdt.rplus <- iit
# }
# NOT RUN {
x <- acomp(1:5)
(ds <- cdt(x))
cdtInv(ds,x)
(ds <- cdt(rcomp(1:5)))
cdtInv(ds,rcomp(x))
data(Hydrochem)
x = Hydrochem[,c("Na","K","Mg","Ca")]
y = acomp(x)
z = cdt(y)
y2 = cdtInv(z,y)
par(mfrow=c(2,2))
for(i in 1:4){plot(y[,i],y2[,i])}
# }
Run the code above in your browser using DataLab