5
$\begingroup$

Can any one point me to a research article or post the actual algorithm to generate random numbers from the multivariate normal distribution in spherical coordinates?

I need both $N_p(0,I_p)$ , the standard multivariate normal case in spherical coordinates and $N_p(0,\Sigma)$ where $\Sigma \neq I_p$

$\endgroup$
6
  • 1
    $\begingroup$ You need to explain first what you want to do. Are you looking to draw samples that are normal distributed in Euclidean x-y-z space and convert the result into spherical coordinates? Or are you interested in drawing samples from a normal distribution in r-phi-theta space? The two are fundamentally different and, in fact, the latter doesn't make much sense because phi and theta are periodic variables and so having a normal distribution in these variables makes not much sense because $p(\phi)$ must equal $p(\phi+2\pi)$ but this is of course inconsistent with the normal distribution. $\endgroup$
    – Wolfgang Bangerth
    Jul 19, 2012 at 22:50
  • $\begingroup$ @Wolfgang Bangerth , i think daek's method is what i need , but i'm not 100% sure yet math.wsu.edu/faculty/genz/papers/mvncmp/mvncmp.html $\endgroup$
    – pyCthon
    Jul 22, 2012 at 16:38
  • 1
    $\begingroup$ THe problem is poorly posed. Do you need $N_p(0,I_p)$? Do you need $N_p(0,\Sigma)$ with $\Sigma \neq I_p$? Do you need $N_p(\mu,\Sigma)$? $\endgroup$
    – StasK
    Aug 6, 2012 at 18:47
  • $\begingroup$ I do not understand the emphasis on spherical coordinates. Is there anything the matter with generating a variable from $N(0,\Sigma)$ and converting it to spherical coordinates? $\endgroup$
    – whuber
    Aug 7, 2012 at 16:09
  • 1
    $\begingroup$ Given that even the input to the $\mathcal{N}_p(\mu,\Sigma)$ problem is $O(p^2)$ and the conversion from Cartesian to spherical coordinates is $O(p)$, the time needed for conversion is inconsequential except for small $p$. $\endgroup$
    – whuber
    Aug 8, 2012 at 15:23

2 Answers 2

2
$\begingroup$

This book has this reference to this book here. Not exactly cheap, but I think it's the one you are looking for. ;)

$\endgroup$
0
9
+25
$\begingroup$

Given how easy it is to generate the normal variates, I would do just that, and then convert to the spherical coordinates directly.

If you need $N_p(0,I_p)$, where $p$ is the dimension, then in spherical coordinates, $r\sim \chi^2_p = \Gamma(p/2,1/2)$, and the angles are all independent of each other and the length, with uniform distribution on their respective ranges $[0,\pi)$ for the first one (the one that goes with the cosine only), $[0,2\pi)$ for the remaining ones. If $p$ is even, $p=2m$, you can generate $r_p = \sum_{k=1}^{m} (-\frac12) \ln U_k$, $U_k \sim \mbox{i.i.d. } U[0,1]$. If $p$ is odd, $p=2m+1$, then you need to add another square of a normal to this (see above how to generate them), $r_p = r_{p-1} + z^2$, $z\sim N(0,1)$.

$\endgroup$
4
  • $\begingroup$ can you show the proof for $r\sim \chi^2_p = \Gamma(p/2,1/2)$ ? $\endgroup$
    – pyCthon
    Aug 11, 2012 at 19:31
  • $\begingroup$ also the link you posted is for the uni-variate Gaussian $\endgroup$
    – pyCthon
    Aug 11, 2012 at 23:08
  • $\begingroup$ Take a look: en.wikipedia.org/wiki/… $\endgroup$
    – Zen
    Aug 13, 2012 at 2:36
  • $\begingroup$ @zen I know that but that doesn't answer my original question $\endgroup$
    – pyCthon
    Aug 14, 2012 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.