Statistics & probability

Isometric log ratio balance calculator for compositional data

Isometric log-ratio coordinates represent relative information in a positive composition using an orthonormal contrast basis.

Your numbers

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

Isometric log-ratio coordinates represent relative information in a positive composition using an orthonormal contrast basis. The page closes positive rows, calculates CLR/ILRcoordinates, reconstructs compositions and compares Aitchison distances. It does not fit a Dirichlet regression or replace zero components with undisclosed pseudocounts.

THE FORMULAclosure(x)=x/Σx; clr(x)=log x−mean(log x); ilr(x)=B log x with B1=0andBBᵀ=I; inverse(y)=closure(exp(Bᵀy)).

A worked example

Using the stated Helmert contrasts, composition(1,2,4)has ILRcoordinates(−log2/√2,−3log2/√6)≈(−0.4901291,−0.8489285). Its reconstruction is(1/7,2/7,4/7), and its Aitchison distance from the uniform composition is√2log2≈0.9802581.

Good to know

1–300 compositions with2–12 positive parts. Close each row explicitly, use a named default orthonormal contrast basis or a supplied(D−1)×D log-contrast basis with B1=0 and BBᵀ=I; output ILR/CLR, inverse closure and distances to a chosen reference. No hidden zero replacement, negative parts, significance tests or basis-independent meaning assigned to individual ILR coordinates.

Relative information lives in a simplex

A composition describes parts relative to their total. Doubling every positive part preserves the composition even though the raw measurements change. Ordinary unconstrained Euclidean operations on percentages can mix total-size information with relative information or create invalid negative parts. Log-ratio geometry instead studies the relative relationships among strictly positive components.

Closing a positive row divides every component by its row total. The operation is explicit here rather than hidden behind a sum-to-one assumption. Closure does not repair incorrect part definitions: the same named components must be comparable across rows. A missing part, changing denominator or incompatible measurement basis alters the scientific meaning of the resulting ratios.

Isometric log ratio balance for compositional data(1,1,1)(1,2,4)Helmert ILRcoordinates(−0.490129,−0.848928)Inverse: (1/7,2/7,4/7)Distance≈0.980258
Scroll across to see the full diagram.
Using the stated Helmert contrasts, composition(1,2,4)has ILRcoordinates(−log2/√2,−3log2/√6)≈(−0.4901291,−0.8489285). Its reconstruction is(1/7,2/7,4/7), and its Aitchison distance from the uniform composition is√2log2≈0.9802581.

Compare this with the Dirichlet regression calculator for compositional proportions. Convert positive compositions into orthonormal log-ratio coordinates, reconstruct them and compare Aitchison distances using a declared contrast basis. Dirichlet regression fits covariate effects under a probability model; it does not provide the coordinate geometry, inverse transformation or basis validation.

Choose positive data and a declared basis

Every component must be strictly positive. A zero can mean true absence, detection censoring or rounding, and these meanings need different treatment. The calculator refuses zeros instead of inserting an arbitrary small constant. Extremely small positive parts also warrant attention because their logarithms can dominate coordinate differences, even when their percentages look negligible.

An ILRbasis consists of Dminus one orthonormal log contrasts for Dparts. Each row sums to zero, and distinct rows have zero inner product with unit norm. A named default Helmert basis makes the worked example reproducible. A user-supplied basis must satisfy the same algebraic checks; arbitrary contrast coefficients are not automatically an isometric coordinate system.

Calculate CLR and ILR coordinates

Centered log-ratio coordinates subtract the mean log component from every log component. Their sum is zero, so a D-component CLRvector lies in a Dminus one dimensional subspace. ILRcoordinates express that same relative point in an orthonormal basis with only Dminus one unconstrained coordinates, avoiding the redundant CLRdirection.

Individual ILRcoordinates depend on the chosen basis. A balance can compare one group of parts with another, but its sign and interpretation must be read from its contrast coefficients. Changing basis rotates or reflects the coordinate representation without changing Aitchison distances. A coordinate value is not an absolute amount or a regression effect merely because it is a real number.

Reconstruct the three-part worked example

The default first row is uniform, so all its log-ratio coordinates are zero. The second raw row is1,2,4and closes to1/7,2/7,4/7. With contrast rows(1,−1,0)/√2and(1,1,−2)/√6, its coordinates are−log2/√2and−3log2/√6, approximately−0.4901291and−0.8489285.

Multiply the two coordinate values by the transpose of the contrast basis, exponentiate the resulting three-component vector and close it. The reconstruction recovers the same component ratios1:2:4. Its distance from the uniform row is the Euclidean length of its ILRvector, √2log2, approximately0.9802581. The diagram connects these two representations of one relative change.

Read distances independently of coordinate choice

Aitchison distance between two compositions equals the Euclidean distance between their ILRvectors when the same orthonormal basis is used. It also equals the norm of the difference of their CLRvectors. This identity provides both an interpretation and an independent numerical cross-check: distances describe relative separation rather than a difference in total mass.

Changing every unit from grams to milligrams multiplies each raw composition by a positive scalar and leaves its coordinates unchanged. Permuting component labels while transforming the basis consistently also preserves distances. Applying the old basis to newly reordered columns changes the meaning of each balance and can produce a misleading comparison despite numerically valid coordinates.

Verify round trips and basis conditions

Check the row-sum and Gram-matrix residuals of a custom contrast basis before interpreting any output. The inverse transform should return the closed original composition within numerical precision. Independent implementations such as scikit-bio provide useful coordinate and inverse checks, but their default basis orientation must be matched before comparing individual signed coordinates.

Test proportional rows, uniform rows and several different positive scales of the same row. All should reconstruct appropriately and proportional rows should have zero distance. Compare a reference row with itself and verify a zero distance. These algebraic checks do not establish that selected parts form a meaningful whole or that missing and zero values were handled substantively correctly.

Keep transformations separate from statistical models

Dirichlet regression models a distribution over compositions as covariates change. ILRgeometry alone does not estimate such a model, test a hypothesis or produce a confidence region. A downstream regression or clustering method may use these coordinates, but that analysis needs its own assumptions and must retain the basis definition for interpretation.

Balances and inverse reconstruction belong on the same page because they are two directions of one coordinate mapping. Report the part ordering, closure convention, basis and treatment of unavailable components with any exported coordinates. A convenient numerical embedding should make the relative structure easier to inspect rather than conceal the modeling choices that created it.

A few questions, answered

Can I enter zero percentages?

No. Log ratios require strictly positive parts, and zero replacement needs a separately justified measurement or modeling rule.

Why do different ILRbases give different numbers?

Coordinate values depend on basis orientation. Aitchison distances remain unchanged under a valid orthonormal basis change.

Does multiplying a row by100change its coordinates?

No. Positive row scaling cancels in the log contrasts, so changing total units does not change the composition.

Is CLRanother separate analysis?

CLRis a related redundant coordinate representation. This page includes CLR,ILR,inverse reconstruction and distances together rather than treating them as unrelated calculators.

Find your calculator

Start typing to explore the library.