Bijectors.jl
This package implements functionality for transforming random variables to Euclidean space (and back).
For example, consider a random variable $X \sim \mathrm{Beta}(2, 2)$, which has support on $(0, 1)$:
using Bijectors
x = rand(Beta(2, 2))0.4443026765111612In this case, the logit function is used as the transformation:
\[Y = \mathrm{logit}(X) = \log\left(\frac{X}{1 - X}\right).\]
We can construct this function
b = bijector(Beta(2, 2))Bijectors.Logit{Float64, Float64}(0.0, 1.0)and apply it to x:
y = b(x)-0.22371772977480217You can also obtain the log absolute determinant of the Jacobian of the transformation:
y, ladj = with_logabsdet_jacobian(b, x)(-0.22371772977480217, 1.3987807601261406)