alr: Additive log ratio transformation

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/alr.R

Description

Aitchison's additive log ratio tranformation for compositional data

Usage

1
alr(form, data, group = NULL)

Arguments

form

a formula which specifies the denominator variable as the response

data

a data frame in which the data is stored

group

if not NULL then a character string specifying the name of the grouping variable

Details

This function will give a warning if zeros are present because the transformed data will have -Infs.

Value

a data frame with the ALR transformation applied to data. Each row in the data frame is standardized with respect to a specific variable by dividing by that variable. The logarithms of the resulting ratios are returned. If a grouping variable is specified, then this is preserved.

Author(s)

James M. Curran

References

Aitchison, J. (1986). “The Statistical Analysis of Compositional Data”, Chapman and Hall, reprinted in 2003 with additional material by The Blackburn Press

See Also

clr

Examples

1
2
3
4
5
6
7
8
data(bottle.df)

## transform with respect to manganese
alr(Mn~., bottle.df, "Number")

## transform the data with respect to barium, but removing the
## grouping in column 1
alr(Ba~., bottle.df[,-1])

jmcurran/Hotelling documentation built on Sept. 12, 2021, 6:12 p.m.