![]() ![]() Vector sphere = mapFromDiskToSphereSurface(disk) Īnd here the R-Code to run it: library(cmdstanr)Ĭmdstan_model("stanCode_3dSphereOriginalMarsagliaMethod.stan") Vector disk = mapFromGaussianToDisk(pGaussian) Vector mapFromDiskToSphereSurface( // marsaglia transform sensu marsaglia 1972 (doi: 10.1214/aoms/1177692644) () Vector mapFromGaussianToDisk( // inverse marsaglia-polar-transform sensu I will come up with a stan implementation when I come back from work But it can be mapped to a standard-normal which serves as the unconstrained representation. This is because since they are close together on the sphere, they have similar posterior density, which allows the sampler to freely travel along the patch in unconstrained space (the disk circumferene in the marsaglia method).Įdit: note of course a disk cannot be an unconstrained representation in Stan. Therefore although the points are not close together in unconstrained space, there is always a path that the sampler can use to travel between these points. The reason is that all points near the pole are arranged in a single continuous patch of space in the unconstrained representation (in the marsaglia method this patch of space is the circumference of the disk). It does arise near the pole, but it isn’t nearly as problematic near a pole as near a seam. Therefore the “points close on the sphere are not close in unconstrained space” problem arises less than in the polar parameterisation. Unlike the polar method, there is no “seam” on the sphere surface, and there is only one “pole” (where we are standing), rather than two. This means that all points near the edge are very close to each other. This gives us a rough intuition of how the transform works: Points in the center of the disk are on the opposite side of the sphere, points very close to the edge of the disk are very close to us on our side of the sphere. The part of your field of view that is covered by the sphere has the shape of a filled disk. Logically, the sphere fills exactly 50% of you field of view. Imagine you’re standing on/embedded into the surface of the sphere and you have 360° surround vision. The marsaglia method mapps a filled circle to a sphere-surface. In the 3d case however, it does have an advantage, which I’m going to explain now. For the 2d-case it wouldnt offer any advantage over a polar parameterisation (which in 2d is just encoding the position on the circle as an angle from 0 to 2pi). It is applicable to 3d-spheres, not sure if it also works in higher dimensionality. Using this method in Stan (I will come up with a stan implementation when I come back from work) would have some nice properties. I’ve been thinking more about the method introduced in the marsaglia paper (which I’m going to call the marsaglia method, hopefully not confusing anyone due to the previous use of this word for Stan’s current method). project these samples to a 2d-standard normal.sample a uniformly filled 2d-circle via rejection sampling from a uniform square.It has nothing to do with spheres, but is a method to create a 2d standard-normal by: The marsaglia-polar-transform is something different. Maybe the stan manual should refer to this paper instead of the one by Marsaglia? Maybe we should call the method used by Stan the Muller method? In the paper Marsaglia notes that there was an earlier paper from Muller which discussed this method. The method stan uses is one of the three methods reviewed at the beginning of the Marsaglia paper. ![]() I don’t see why the Stan manual refers to marsaglia, it seems to me like two completely different methods. Use jacobian corrections to ensure they are uniformly distributed.Create a vector of longiture and latitude describing coordinates on a sphere.(this distribution already looks almost like a sphere-surface even before projecting on the sphere surface) What I called “sphere method” is what I introduced In the other thread and is basically identical to what Stan does except I start with a different prior so the sampler doesnt go near (0,0,0). Divide the vectors by their length to project them onto the 3d-sphere surface.Generate a 3d-multivariate standard normal distribution.The method that Stan uses for unit vectors, as far as I know, is: A method to map these vectors to the surface of a 3d sphere such that they are uniformly distributed on the sphere.A rejection sampling step to create 2d-vectors distributed uniformly over the interior of a circle with radius 1.I assume this new one is what we call “marsaglia method”. He first reviews 3 previous methods of producing points on a 3d-sphere, then proposes a new one. It’s open access Choosing a Point from the Surface of a Sphere
0 Comments
Leave a Reply. |