Why Use Log-Ratio Coordinates?
Cell-type proportions are constrained: they are nonnegative and sum to one. If one proportion rises, at least one other must fall, even when the underlying number of cells of that type has not decreased. This makes a change in a single proportion difficult to interpret in isolation. Log-ratio coordinates instead describe how the abundance of one cell type compares with another.
This tutorial develops additive log-ratio (ALR) and centered log-ratio (CLR) coordinates for strictly positive cell-type proportions. The introductory material on choosing the denominator for cell-type abundance motivates the choice of a reference part; here the focus is on the transformations, their geometry, and the meaning of condition contrasts expressed through them.
The positivity condition matters: the logarithm of a ratio is defined here only when both proportions are positive. The parts must also refer to the same set of cell types, defined in the same way, for every sample being compared. A change in the cell-type labels or grouping changes the composition itself, not just its coordinates.
Additive Log-Ratio Coordinates
Choose one part, say \(x_D\), as the denominator. The ALR representation consists of the \(D-1\) coordinates
Each coordinate is a log abundance ratio relative to the chosen denominator. A value of zero means the numerator and denominator proportions are equal. A positive value means the numerator part is larger; a negative value means it is smaller. Exponentiating an ALR coordinate returns the corresponding ratio, not either proportion by itself.
Although the proportions sum to one, their ratios contain enough information to recover the composition. If \(y_i=\log(x_i/x_D)\), then \(x_i/x_D=\exp(y_i)\). Since \(x_D\) is the remaining part, the proportions are
Thus ALR gives \(D-1\) unconstrained real-valued coordinates for a composition with \(D\) parts. The selected denominator affects the coordinate values: using a different denominator gives different coordinates, although it describes the same underlying composition.
Worked Example: Computing and Inverting ALR Coordinates
Suppose a hypothetical sample has proportions \(x_1=0.50\), \(x_2=0.30\), and \(x_3=0.20\), for three cell types. Use cell type 3 as the denominator.
The two ALR coordinates are
These values say that cell type 1 is 2.5 times as abundant as cell type 3, and cell type 2 is 1.5 times as abundant as cell type 3. To recover the composition, exponentiate the coordinates and normalize together with the denominator's implicit weight of 1:
The recovered values sum to one and match the starting proportions. The coordinates encode relative abundance; their inverse transformation supplies the common scale required to make the parts sum to one.
Centered Log-Ratio Coordinates and Their Geometry
CLR coordinates compare each part with the geometric mean of all parts. Define the geometric mean \(g(\mathbf{x})\) and the CLR coordinates \(z_i\) by
The CLR transformation treats the parts symmetrically: it does not designate one cell type as the denominator. Its coordinates satisfy \(\sum_i z_i=0\), so the \(D\) values are not independent. They lie in a \(D-1\)-dimensional plane in \(D\)-dimensional space.
This identity explains the geometry. A composition lives on the constrained simplex, while CLR maps it to a zero-sum plane. Differences in that plane retain the pairwise log ratios that describe relative abundance. The Aitchison distance between two positive compositions \(\mathbf{x}\) and \(\mathbf{w}\) is the Euclidean distance between their CLR vectors:
This distance measures the overall difference in relative abundances, rather than the ordinary Euclidean distance between raw proportions. CLR coordinates can be inverted by exponentiating and normalizing:
Adding the same constant to every \(z_i\) would leave these normalized values unchanged, but the CLR convention fixes that freedom by requiring the coordinates to sum to zero.
Worked Example: Computing CLR Coordinates
Use the hypothetical composition \((0.50,0.30,0.20)\). Its geometric mean is
The CLR coordinates, rounded to four significant figures, are
Their sum is approximately \(0.4757-0.0349-0.4408=0.0000\), subject to rounding. Cell type 1 is above the composition's geometric mean, while cell types 2 and 3 are below it. The difference \(z_1-z_3=0.9165\) is approximately \(\log(0.50/0.20)=0.9163\); the small discrepancy is rounding.
To check the inverse, exponentiating the unrounded CLR coordinates gives values proportional to \(x_1,x_2,x_3\). Normalizing those values by their sum recovers \((0.50,0.30,0.20)\). The common normalization is necessary because exponentiated coordinates are relative weights, not proportions that are guaranteed to sum to one before normalization.
Condition Contrasts as Changes in Relative Abundance
A condition contrast on a log-ratio coordinate compares the same ratio between conditions. For cell types \(i\) and \(j\), let \(\mathbf{x}^{(A)}\) and \(\mathbf{x}^{(B)}\) be the compositions under conditions A and B. The contrast is
It is a difference of log ratios, or equivalently the log of a ratio of ratios. A positive value means that cell type \(i\)'s abundance relative to cell type \(j\) is larger in condition B than in condition A. Exponentiating \(\Delta_{ij}\) gives the fold change in that relative abundance. It does not give the fold change in the absolute number of cells of type \(i\).
Worked Example: A Paired Condition Contrast for Two Cell Types
Consider three hypothetical donors measured under both conditions. For each donor, calculate the change from condition A to condition B in the log ratio of cell type 1 to cell type 3.
| Donor | Condition A proportions (types 1, 2, 3) | Condition B proportions (types 1, 2, 3) |
|---|---|---|
| 1 | (0.50, 0.30, 0.20) | (0.40, 0.40, 0.20) |
| 2 | (0.40, 0.40, 0.20) | (0.30, 0.50, 0.20) |
| 3 | (0.60, 0.25, 0.15) | (0.50, 0.35, 0.15) |
For donor 1, the type 1-to-type 3 ratio changes from \(0.50/0.20=2.5\) to \(0.40/0.20=2.0\). The contrast is
For donor 2, the ratio changes from \(0.40/0.20=2.0\) to \(0.30/0.20=1.5\), giving \(\Delta_{13,2}=\log(1.5/2.0)=\log(0.75)=-0.2877\). For donor 3, it changes from \(0.60/0.15=4.0\) to \(0.50/0.15=3.333\), giving \(\Delta_{13,3}=\log(3.333/4.0)=\log(0.8333)=-0.1823\).
The mean paired contrast across these three donors is
Exponentiating the mean gives \(\exp(-0.2310)=0.7938\). In this hypothetical set, the geometric mean of the donors' condition-specific type 1-to-type 3 ratios is about 0.794 times as large under condition B as under condition A. This descriptive contrast is in log-ratio units; it is not evidence by itself of a population-level condition effect. A formal analysis would need an appropriate model or uncertainty assessment for the donor-level contrasts. The paired calculation preserves the within-donor comparison, and it does not imply that the condition caused the observed difference.
How ALR and CLR Relate
ALR and CLR coordinates encode the same pairwise relative information, but organize it differently. For example, an ALR coordinate relative to part \(D\) is exactly the difference between CLR coordinates \(i\) and \(D\):
Consequently, a condition contrast in an ALR coordinate is also the difference between the corresponding condition changes in the two CLR coordinates. In the condition example, comparing types 1 and 3 can be calculated directly as an ALR change using type 3 as denominator, or as the difference between the changes in \(z_1\) and \(z_3\). Both give the same log-ratio contrast.
| Representation | What it emphasizes | Main consideration |
|---|---|---|
| ALR | Ratios of each numerator part to one selected denominator | The coordinates depend on the chosen denominator |
| CLR | Each part relative to the geometric mean of all parts | There are \(D\) coordinates, but they sum to zero and are linearly dependent |
| Raw proportions | The fraction of the total assigned to each part | Parts are constrained to sum to one, so a change in one part affects the others |
Raw proportions remain useful for describing the observed allocation of the total. Log-ratios are useful when the scientific question is explicitly comparative, such as whether one cell type has increased relative to another. Neither coordinate system turns a compositional comparison into an absolute cell-count comparison. The transformation also does not specify a sampling model or account automatically for donor variability.
Assumptions, Diagnostics, and Common Pitfalls
Before calculating or modeling these coordinates, check that each composition is positive, sums to one up to rounding, and uses the same cell-type partition across samples. If proportions were obtained from counts, confirm that the counts correspond to the same defined total for every composition. A mismatch in the set of parts makes the ratios difficult or impossible to compare meaningfully.
The coordinates are sensitive to the relative values of the parts. Inspect the original proportions alongside transformed values; an extreme log-ratio can flag a very small denominator or numerator and may dominate a summary. Also verify computations by checking that CLR coordinates sum to approximately zero and that inverse-transformed coordinates sum to one. For ALR, check that the reported denominator is the intended cell type and that inverse-transformed values reproduce the input composition.
- Wrong reasoning: “The proportion of cell type 1 rose, so its absolute abundance must have increased.” Correction: A proportion and a log-ratio describe relative allocation within the measured total. They do not establish a change in absolute cell number.
- Wrong reasoning: “A CLR coordinate is the log ratio to a fixed reference cell type.” Correction: Each CLR coordinate compares one part with the geometric mean of all parts; the difference between two CLR coordinates is their pairwise log ratio.
- Wrong reasoning: “A CLR vector has \(D\) independent measurements because it has \(D\) entries.” Correction: Its entries sum to zero, so only \(D-1\) dimensions are independent.
An exact zero makes a log-ratio involving that part undefined, so these formulas apply directly only to strictly positive compositions. Do not silently replace a zero with a positive value and interpret the result as if no additional assumption had been made. Coordinate choice cannot repair inconsistent cell-type definitions, sparse observations, or uncertainty in the underlying proportions.
Check Your Understanding
Answer each question using the definitions and identities above. Brief solutions follow the questions.
- For \((0.40,0.35,0.25)\), what is the ALR coordinate for type 1 using type 3 as denominator, and what does its exponentiated value mean?
- Why do CLR coordinates for a three-part composition have only two independent dimensions?
- A log ratio of type 1 to type 2 is \(\log(1.5)\) in condition A and \(\log(2.0)\) in condition B. Calculate the condition contrast and interpret its exponentiation.
- What is the difference between \(z_1\) and \(z_2\) in a CLR representation?
- Can these log-ratio formulas be applied directly if one cell-type proportion is exactly zero? Explain.
Solutions: (1) \(\log(0.40/0.25)=\log(1.6)=0.4700\). Its exponential, 1.6, is the type 1-to-type 3 proportion ratio. (2) The three coordinates sum to zero, so any two determine the third. (3) The contrast is \(\log(2.0)-\log(1.5)=\log(4/3)=0.2877\); exponentiating gives \(4/3\), so the relative abundance of type 1 versus type 2 is 1.333 times as large in B as in A. (4) \(z_1-z_2=\log(x_1/x_2)\). (5) No. The logarithm of a ratio containing zero is undefined, so the composition is outside the strictly positive setting of these formulas.