TransformVariables.jl
TransformVariables.jl copied to clipboard
UnitVector only transforms to positive hemisphere
The current UnitVector transformation currently transforms an n-1 dimensional vector to an n dimensional unit vector. However, upon transformation, all resulting unit vectors lie on the "hemi-hypersphere", where the final dimension is strictly positive. This is a problem for any applications where the unit vectors across the whole sphere are needed (e.g. directional/orientational statistics)
Stan handles the unit vector transform with a simple trick. I've implemented a version of this with an explanation here and would be happy to adapt it for this package if you're willing.
Thanks. Can you please help me with pointing out where this is in the Stan docs?
Sure, you can find it at https://mc-stan.org/docs/2_21/reference-manual/unit-vector-section.html