Greenacre 2023 - Logratios ALR CLR ILR and Log-Contrasts

Summary

Pairwise logratios (LR), additive logratios (ALR, fixed reference part) and centred logratios (CLR, divide by geometric mean) all have dimension and are linear in . CLR is exactly isometric to the full logratio geometry but not coherent; ALR is coherent but only approximately isometric; ILR is both but needs ratios of geometric means that are hard to interpret.

Overview

Zeros prevent logarithms, so every logratio transform needs zero replacement or a different tool (see Greenacre 2023 - Wide Data, Zeros and Quasi-Coherence).

Main Content

Pairwise logratio (Eq. 2)

, . There are unique LRs (Tellus: ), linearly interrelated with rank . LRs map to .

Additive logratio, ALR (Eq. 3)

, : logratios with a common denominator (the reference). There are possible ALRs. If has very low variance, ALRs are practically up to a near-constant. Wide data sets often contain such a near-constant reference.

Centred logratio, CLR (Eq. 4)

with geometric mean . . The CLRs sum to zero so have rank ; they live in (Eq. 5). Euclidean distances on CLRs equal those on all LRs, so the CLR transformation is isometric.

Log-contrast

with (ensures scale invariance). LR and ALR have coefficients on two parts; a CLR has on part and on the others. If compositions are predictors or responses, all logratio transformations generate the same log-contrasts, so the choice among them is driven by interpretability, with LR/ALR being the most attractive.

Isometry and ILR

Logratio geometry: the set of distances between cases based on all LRs. A set of transformed variables is isometric if it reproduces this geometry exactly up to scale. ILRs use orthogonal log-contrasts. Example with parts A,B,C,D,E: (coefficients , sum 0); -type contrast of A vs B, etc. (Eq. 6 matrix: rows , , , up to normalisation) giving a dendrogram of balances. equals the average of the six LRs between {A,B} and {C,D,E}.

Dispersion in compositions (Aitchison)

The variation matrix , , and covariances of LRs follow from it: . Total logratio variability .

Greenacre’s version, , divides by again (weights ); weights on parts can be unequal. Distances are defined as averages rather than sums so they are comparable across numbers of parts (Sec. 3.9).

Transform# variablesCoherent?Isometric?Needs
LR (all pairs)yesyes (by definition)selection of subset
ALR (reference)yesapprox. (quasi)choice of reference
CLR (rank )no (uses all parts)yessingular covariance
ILR / pivotnoyesorthonormal basis; ratios of geometric means
SLR (amalgamation)anywith respect to additionsnot a log-contrastsubject-matter amalgams

Examples

Python: ALR, CLR and ILR in numpy

import numpy as np
x = np.array([[0.5, 0.3, 0.2], [0.2, 0.3, 0.5]])          # compositions (rows sum to 1)
alr = np.log(x[:, :-1] / x[:, [-1]])                        # reference = last part
clr = np.log(x) - np.log(x).mean(axis=1, keepdims=True)
# one ILR basis: balance {1,2 | 3} and {1 | 2}
V = np.array([[1/np.sqrt(6), 1/np.sqrt(6), -2/np.sqrt(6)],
              [1/np.sqrt(2), -1/np.sqrt(2), 0]])
ilr = clr @ V.T
# CLR distances equal the "all-LR" distances (isometry)
d_clr = np.linalg.norm(clr[0] - clr[1])

Connections

Logratio response models: Greenacre 2023 - Compositional Outcome Models in PyMC and Dirichlet alternatives Tsagris 2018 - Dirichlet Regression with Zeros - Overview.

See Also

Greenacre 2023 - Aitchison CoDA 40 Years On - Overview