Inverse Log-Ratio transformations for interval responses
Source:R/transformation_functions.R
inv_log_ratio_transformations.Rd
Transform unbounded data back to the simplex space using either Isometric Log-Ratio (ILR)
or Sum Log-Ratio (SLR) inverse transformations as described in Smithson & Broomell (2024).
These transformations are the inverse of the ilr()
and slr()
transformations.
Inverse ILR
The inverse ILR transformation equations are: $$x_1 = \frac{\exp(\sqrt{2} x_{loc})}{\exp(\sqrt{2} x_{loc}) + \exp(\sqrt{\frac{3}{2}} x_{wid} + \frac{x_{loc}}{\sqrt{2}}) + 1}$$ $$x_2 = \frac{\exp(\sqrt{\frac{3}{2}} x_{wid} + \frac{x_{loc}}{\sqrt{2}})}{\exp(\sqrt{2} x_{loc}) + \exp(\sqrt{\frac{3}{2}} x_{wid} + \frac{x_{loc}}{\sqrt{2}}) + 1}$$ $$x_3 = \frac{1}{\exp(\sqrt{2} x_{loc}) + \exp(\sqrt{\frac{3}{2}} x_{wid} + \frac{x_{loc}}{\sqrt{2}}) + 1}$$
Inverse SLR
The inverse SLR transformation equations are: $$x_1 = \frac{\exp(x_{loc})}{(\exp(x_{loc}) + 1)(\exp(x_{wid}) + 1)}$$ $$x_2 = \frac{\exp(x_{wid})}{\exp(x_{wid}) + 1}$$ $$x_3 = \frac{1}{(\exp(x_{loc}) + 1)(\exp(x_{wid}) + 1)}$$
where \((x_{loc}, x_{wid})\) are the unbounded interval location and width and \((x_1, x_2, x_3)\) is the resulting interval response in the simplex format.
Value
A numeric vector containing a 2-simplex or a dataframe where each of the rows consists of such a vector.
References
Smithson, M., & Broomell, S. B. (2024). Compositional data analysis tutorial. Psychological Methods, 29(2), 362–378.
Examples
# Inverse ILR transformation
bvn <- data.frame(rbind(c(0, .2), c(-2, .4)))
inv_ilr(bvn)
#> x_1 x_2 x_3
#> 1 0.30510538 0.3897892 0.3051054
#> 2 0.04059715 0.2725466 0.6868563
# Inverse SLR transformation
inv_slr(bvn)
#> x_1 x_2 x_3
#> 1 0.2250830 0.5498340 0.2250830
#> 2 0.0478376 0.5986877 0.3534747