inv_ilr {intervalpsych} | R Documentation |
Inverse Log-Ratio transformations for interval responses
Description
Transform unbounded data back to the simplex space using either Isometric Log-Ratio (ILR)
or Sum Log-Ratio (SLR) inverse transformations, as described by Smithson & Broomell (2024).
These transformations are the inverse transformations of ilr()
and slr()
.
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.
Usage
inv_ilr(bvn)
inv_slr(bvn)
Arguments
bvn |
A numeric vector containing an unbounded interval location and width or a dataframe where each of the rows consists of such a vector. |
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.
See Also
Examples
# Generate some unbounded data
bvn <- data.frame(rbind(c(0, .2), c(-2, .4)))
# Inverse ILR transformation
inv_ilr(bvn)
# Inverse SLR transformation
inv_slr(bvn)