Learn R Programming

compositions (version 2.0-2)

rcomp: Compositions as elements of the simplex embedded in the D-dimensional real space

Description

A class providing a way to analyse compositions in the philosophical framework of the Simplex as subset of the \(R^D\).

Usage

rcomp(X,parts=1:NCOL(oneOrDataset(X)),total=1,warn.na=FALSE,
                detectionlimit=NULL,BDL=NULL,MAR=NULL,MNAR=NULL,SZ=NULL)

Arguments

X

composition or dataset of compositions

parts

vector containing the indices xor names of the columns to be used

total

the total amount to be used, typically 1 or 100

warn.na

should the user be warned in case of NA,NaN or 0 coding different types of missing values?

detectionlimit

a number, vector or matrix of positive numbers giving the detection limit of all values, all columns or each value, respectively

BDL

the code for 'Below Detection Limit' in X

SZ

the code for 'Structural Zero' in X

MAR

the code for 'Missing At Random' in X

MNAR

the code for 'Missing Not At Random' in X

Value

a vector of class "rcomp" representing a closed composition or a matrix of class "rcomp" representing multiple closed compositions, by rows.

Missing Policy

Missing and Below Detecion Limit Policy is explained in deeper detail in compositions.missing.

Details

Many multivariate datasets essentially describe amounts of D different parts in a whole. This has some important implications justifying to regard them as a scale on its own, called a "composition". The functions around the class "rcomp" follow the traditional (often statistically inconsistent) approach regarding compositions simply as a multivariate vector of positive numbers summing up to 1. This space of D positive numbers summing to 1 is traditionally called the D-1-dimensional simplex.

The compositional scale was in-depth analysed by Aitchison (1986) and he found serious reasons why compositional data should be analysed with a different geometry. The functions around the class "acomp" follow his approach. However the Aitchison approach based on log-ratios is sometimes criticized (e.g. Rehder and Zier, 2002). It cannot deal with absent parts (i.e. zeros). It is sensitive to large measurement errors in small amounts. The Aitchison operations cannot represent simple mixture of different compositions. The used transformations are not uniformly continuous. Straight lines and ellipses in Aitchison space look strangely in ternary diagrams. As all uncritical statistical analysis, blind application of logratio-based analysis is sometimes misleading. Therefore it is sometimes useful to analyse compositional data directly as a multivariate dataset of portions summing to 1. However a clear warning must be given that the utilisation of almost any kind of classical multivariate analysis introduce some kinds of artifacts (e.g. Chayes 1960) when applied to compositional data. So, extra care and considerable expert knowlegde is needed for the proper interpretation of results achieved in this non-Aitchison approach. The package tries to lead the user around these artifacts as much as possible and gives hints to major pitfalls in the help. However meaningless results cannot be fully avoided in this (rather inconsistent) approach.

A side effect of the procedure is to force the compositions to sum to one, which is done by the closure operation clo .

The classes rcomp, acomp, aplus, and rplus are designed in a fashion as similar as possible, in order to allow direct comparison between results achieved by the different approaches. Especially the acomp logistic transforms clr, alr, ilr are mirrored by analogous linear transforms cpt, apt, ipt in the rcomp class framework.

References

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

Rehder, S. and U. Zier (2001) Letter to the Editor: Comment on ``Logratio Analysis and Compositional Distance'' by J. Aitchison, C. Barcel\'o-Vidal, J.A. Mart\'in-Fern\'a ndez and V. Pawlowsky-Glahn, Mathematical Geology, 33 (7), 845-848.

Zier, U. and S. Rehder (2002) Some comments on log-ratio transformation and compositional distance, Terra Nostra, Schriften der Alfred Wegener-Stiftung, 03/2003

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.

See Also

cpt, apt, ipt, acomp, rplus, princomp.rcomp, plot.rcomp, boxplot.rcomp, barplot.rcomp, mean.rcomp, var.rcomp, variation.rcomp, cov.rcomp, msd, convex.rcomp, +.rcomp

Examples

Run this code
# NOT RUN {
data(SimulatedAmounts)
plot(rcomp(sa.tnormals))
# }

Run the code above in your browser using DataLab