Open mbojan opened 1 month ago
Hi Mbojan, the problem is with the mu vector. The mu must be a unit vector, so the coordinates you give, c(0,0,0), do not lie on the sphere. However, I noticed that you have a point. When k = 0, it still doe not work. We will see this. If you want to sample from a uniform on the sphere of any dimension you may try this
x <- matrnorm(n, p) ## p is the dimensionality of the sphere x <- x / sqrt( rowsums(x^2) )
Thanks @statlink . I'm going through somebody else's code that is couple of years old and it trips on that call from issue description so I presumed there was some change in recent years (?). Thanks for the suggestion. You're right that it is much simpler in the uniform case.
We also thank you @mbojan for noticing the problem with k=0.
Describe the bug Can't sample uniformly using
rvmf()
To Reproduce
but this works
Expected behavior
Works.
Desktop (please complete the following information):