help ilr

Title

ilr -- Command to compute a isometric log-ratio (ILR) transformation on a set of variables

Syntax

ilr varlist

Description

ilr computes a isometric log-ratio (ILR) transformation on a set of variables (n>2). ILR transformation is a mathematical technique used in compositional data analysis. Compositional data are parts of a whole and carry relative information, typically constrained by a constant sum, such as 100% or 1440 (e.g. the minutes in a day). This type of data often arises in economics, environmental science, ecology, and other fields.

Compositional data have a closure problem, meaning that the data are not free to vary independently and standard statistical techniques cannot be applied directly. The ILR transformation is one of several methods designed to overcome this issue by transforming the compositional data into unconstrained, real-valued coordinates. The ILR transformation maintains the relative information in the data but represents it in a Euclidean space, where the usual assumptions of statistical analysis (like normality, constant variance, etc.) are more appropriate. This transformation is an isometric transformation, which means it preserves the geometry of the data.

The ILR transformation involves taking logarithms of ratios of the parts. For a D-part composition, the ILR coordinates are defined as follows: z_i = sqrt(i / (i + 1)) * log(x_i / (prod(j = i+1 to D) x_j)^(1 / (i + 1)) for i = 1, ..., D - 1 where z represents the set of variables and D the dimensional Euclidean space.

ilr checks the sum of varlist adds up to the same number (at 0.0001 precision level) and reports an error if it is not the case.

Remarks

The ilr command creates a set of new variables for each var in varlist at the end of the dataset following the naming var_ilr`N', where N is equal to the number of variables in the composition minus one.

The programme is not executed if less than three variables are listed in varlist.

Example

use http://fmwww.bc.edu/repec/bocode/g/gdp.dta, clear

Isometric log-ratio (ILR) transformation of the components agriculture industry services

. ilr agriculture industry services

Author

Giacomo Zanello

University of Reading

Reading, UK

If you use the command, please consider citing this software as follows:

Giacomo Zanello, 2024. "ilr: Command to compute a isometric log-ratio (ILR) transformation on a set of variables" Statistical Software Components, Boston College Department of Economics.

Last updated

1 February 2024