alr: alr The additive log-ratio transformation

View source: R/normalization.R

alrR Documentation

alr The additive log-ratio transformation

Description

The additive log-ratio transformation for compositional data (not necessarily closed/normalized!)

Usage

alr(x, ...)

## Default S3 method:
alr(
  x,
  divcomp = 1,
  base = exp(1),
  removeDivComp = TRUE,
  tol = .Machine$double.eps
)

## S3 method for class 'matrix'
alr(
  x,
  mar = 2,
  divcomp = 1,
  base = exp(1),
  removeDivComp = TRUE,
  tol = .Machine$double.eps
)

## S3 method for class 'data.frame'
alr(x, mar = 2, ...)

Arguments

x

a numeric data vector containing components of a composition

...

additional arguments

divcomp

index of the divisor component

base

base of log to use, default is natural log

removeDivComp

remove divisor component from the resulting data

tol

machine tolerance for a zero count, default is machine tol (.Machine$double.eps)

Details

The alr transformation is computed as: x[i] = log ( x[i] / x[D] )

Value

alr transformed x

Examples

# vector examples:
alr(norm_to_total(1:10))
alr(1:10)

# matrix examples:
dmat <- matrix(exp(rnorm(110)), 10)
alr(dmat, 1)
alr(dmat, 2)

zdk123/compPLS documentation built on April 24, 2022, 2:44 p.m.