Dear Community,
I’m trying to square section 11.3 and 11.4 in the manual but need some help.
Section 11.4 11.4 Unit vectors and rotations | Stan User’s Guide
tells me to represent the variable as unit_vector[2]
and then use atan2
of the components to represent the angle.
Section 11.3 11.3 Transforming to unconstrained parameters | Stan User’s Guide tells me that the transformation in question (from the real line to the unit circle) is using an auxiliary variable approach described in Marsaglia (1972).
Following the link of Marsaglia (1972), he describes how this works for a sphere in 3 and 4 dimension, but I fail to understand how the method works for a unit circle (and the general case).
If somebody please could elaborate on how this transformation works, and point me to the relevant implementation in the source code, I would be very grateful.
Best regards
Jon