[Numpy-discussion] Coverting ranks to a Gaussian

Keith Goodman kwgoodman@gmail....
Mon Jun 9 18:34:08 CDT 2008


Does anyone have a function that converts ranks into a Gaussian?

I have an array x:

>> import numpy as np
>> x = np.random.rand(5)

I rank it:

>> x = x.argsort().argsort()
>> x_ranked = x.argsort().argsort()
>> x_ranked
   array([3, 1, 4, 2, 0])

I would like to convert the ranks to a Gaussian without using scipy.
So instead of the equal distance between ranks in array x, I would
like the distance been them to follow a Gaussian distribution.

How far out in the tails of the Gaussian should 0 and N-1 (N=5 in the
example above) be? Ideally, or arbitrarily, the areas under the
Gaussian to the left of 0 (and the right of N-1) should be 1/N or
1/2N. Something like that. Or a fixed value is good too.


More information about the Numpy-discussion mailing list