Learn R Programming

geostats (version 1.6)

alr: additive logratio transformation

Description

Maps compositional data from an \(n\)-dimensional simplex to an (\(n-1\))-dimensional Euclidean space with Aitchison's additive logratio transformation.

Usage

alr(dat, inverse = FALSE)

Value

If inverse=FALSE, returns an \((n-1) \times m\)

matrix of logratios; otherwise returns an \((n+1) \times m\)

matrix of compositional data whose columns add up to 1.

Arguments

dat

an \(n\) column data frame or matrix

inverse

if TRUE, applies the inverse alr tranformation

Examples

Run this code
xyz <- rbind(c(0.03,99.88,0.09),
             c(70.54,25.95,3.51),
             c(72.14,26.54,1.32))
colnames(xyz) <- c('a','b','c')
rownames(xyz) <- 1:3
uv <- alr(xyz)
XYZ <- alr(uv,inverse=TRUE)
xyz/XYZ

Run the code above in your browser using DataLab