## 11.3 Transforming to unconstrained parameters

Stan (inverse) transforms arbitrary points in $$\mathbb{R}^{K+1}$$ to points in $$S^K$$ using the auxiliary variable approach of . A point $$y \in \mathbb{R}^K$$ is transformed to a point $$x \in S^{K-1}$$ by $x = \frac{y}{\sqrt{y^{\top} y}}.$

The problem with this mapping is that it’s many to one; any point lying on a vector out of the origin is projected to the same point on the surface of the sphere. introduced an auxiliary variable interpretation of this mapping that provides the desired properties of uniformity; the reference manual contains the precise definitions used in the chapter on constrained parameter transforms.

#### Warning: undefined at zero!

The above mapping from $$\mathbb{R}^n$$ to $$S^n$$ is not defined at zero. While this point outcome has measure zero during sampling, and may thus be ignored, it is the default initialization point and thus unit vector parameters cannot be initialized at zero. A simple workaround is to initialize from a small interval around zero, which is an option built into all of the Stan interfaces.

### References

Muller, Mervin E. 1959. “A Note on a Method for Generating Points Uniformly on n-Dimensional Spheres.” Commun. ACM 2 (4): 19–20. https://doi.org/10.1145/377939.377946.