# pwlr: Pairwise log ratio transform In compositions: Compositional Data Analysis

## Description

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

## Usage

 1 2 3  pwlr( x, as.rmult=FALSE, as.data.frame=!as.rmult, ...) pwlrInv( z, orig=gsi.orig(z)) 

## Arguments

 x a composition, not necessarily closed z the pwlr-transform of a composition, thus a [D(D-1)/2]-dimensional real vector, or a matrix with such many columns as.rmult logical; should the output be produced as an rmult object? as.data.frame logical; should be as a data.frame? if both are false, rmult will be taken ... currently unused orig the original composition, to check consistency and recover component names

## Details

The pwlr-transform maps a composition in the $D$-part Aitchison-simplex isometrically to a $D(D-1)/2$ dimensonal euclidian vector, computing each possible logratio (accounting for the fact that $log(A/B)=-log(B/A)$, and therefore only one of them is necessary). The data can then be analysed in this transformation by multivariate analysis tools not relying on the invertibility of the covariance function. The interpretation of the results is relatively simple, since each component captures the behaviour of the simple ratio between two party. However redundance between them is extremely high, and any of alr, clr or ilr transformations may be preferred in most applications.

The pairwise logratio transform is given by

pwlr(x)_{ij} := \ln(x_i/x_j)

.

The inverse requires some explanation, because of the redundance between pwlr scores. Note that for any three components $A,B,C$ it holds that $log(A/C)=log(A/B)+log(B/C)$. So, any vector of $D(D-1)/2$ coefficients will not be necessarily a valid pwlr-transformed composition: if these coefficients do not satisfy that kind of relations, the vector is, strictly speaking, not a pwlr and should not be inverted. Nevertheless, the function gives a least-squares inversion, as proposed by Tolosana-Delgado and von Eynatten (2009).

## Value

pwlr gives the pairwise log ratio transform; accepts a compositional dataset pwlrInv gives a closed composition with the given wplr-transform; accepts a dataset

## References

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

Tolosana-Delgado, R. and H. von Eynatten (2009); Grain-size control on petrographic composition of sediments: compositional regression and rounded zeroes. Mathematical Geosciences: 41(8): 869-886. doi: 10.1007/s11004-009-9216-6.

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

## Examples

 1 2 (tmp <- pwlr(c(1,2,3))) pwlrInv(tmp) 

### Example output

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’:

%*%, norm, scale, scale.default

2.1      3.1       3.2
1 0.6931472 1.098612 0.4054651
[,1]      [,2]      [,3]
[1,] 0.1666667 0.3333333  0.5
attr(,"class")
[1] acomp


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