Dear All, I implemented an algorithm for (uniform) random rotations. In order to test it, I can apply it to a unit vector (0,0,1) in Cartesian coordinates. The result is supposed to be a set of random, uniformly distributed, points on a sphere (not the point of the algorithm, but a way to test it). This is what the points look like when I plot them, but other then eyeballing them, can anyone suggest a test to ensure that I am really generating uniform random points on a sphere? Many thanks Lorenzo
Test for Random Points on a Sphere
5 messages · Lorenzo Isella, R. Michael Weylandt, Nordlund, Dan (DSHS/RDA) +2 more
On Fri, Oct 5, 2012 at 5:39 PM, Lorenzo Isella <lorenzo.isella at gmail.com> wrote:
Dear All, I implemented an algorithm for (uniform) random rotations. In order to test it, I can apply it to a unit vector (0,0,1) in Cartesian coordinates. The result is supposed to be a set of random, uniformly distributed, points on a sphere (not the point of the algorithm, but a way to test it). This is what the points look like when I plot them, but other then eyeballing them, can anyone suggest a test to ensure that I am really generating uniform random points on a sphere? Many thanks
Gut says to divide the surface into n bits of equal area and see if the points appear uniformly in those using something chi-squared-ish, but I'm not aware of a canonical way to do so. Cheers, Michael
Lorenzo
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
-----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- project.org] On Behalf Of R. Michael Weylandt Sent: Friday, October 05, 2012 11:17 AM To: Lorenzo Isella Cc: r-help at r-project.org Subject: Re: [R] Test for Random Points on a Sphere On Fri, Oct 5, 2012 at 5:39 PM, Lorenzo Isella <lorenzo.isella at gmail.com> wrote:
Dear All, I implemented an algorithm for (uniform) random rotations. In order to test it, I can apply it to a unit vector (0,0,1) in
Cartesian
coordinates. The result is supposed to be a set of random, uniformly distributed,
points
on a sphere (not the point of the algorithm, but a way to test it). This is what the points look like when I plot them, but other then eyeballing them, can anyone suggest a test to ensure that I am really generating uniform random points on a sphere? Many thanks
Gut says to divide the surface into n bits of equal area and see if the points appear uniformly in those using something chi-squared-ish, but I'm not aware of a canonical way to do so. Cheers, Michael
Lorenzo
I would be more inclined to use a method which is known to produce a points uniformly distributed on the surface of a sphere and not worry about testing your results. You might find the discussion at the following link useful. http://mathworld.wolfram.com/SpherePointPicking.html Hope this is helpful, Dan Daniel J. Nordlund Washington State Department of Social and Health Services Planning, Performance, and Accountability Research and Data Analysis Division Olympia, WA 98504-5204
"Lorenzo Isella" <lorenzo.isella at gmail.com> writes:
Dear All, I implemented an algorithm for (uniform) random rotations. In order to test it, I can apply it to a unit vector (0,0,1) in Cartesian coordinates. The result is supposed to be a set of random, uniformly distributed, points on a sphere (not the point of the algorithm, but a way to test it). This is what the points look like when I plot them, but other then eyeballing them, can anyone suggest a test to ensure that I am really generating uniform random points on a sphere?
There is a substantial literature on this topic and more than one (metaphorical?) direction you could follow. I suggest you Google 'directional statistics' and start reading. Visit http://www.rseek.org and enter 'directional statistics' in the search box and click on the search button to see if there is something in R to meet your needs. A post to r-sig-geo might get more helpful responses once you can focus the question a bit more. HTH, Chuck
Many thanks Lorenzo
Charles C. Berry Dept of Family/Preventive Medicine cberry at ucsd edu UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20121007/55a0c955/attachment.pl>