[SciPy-User] scipy.stats.invnorm - rename to invgauss?

35 views
Skip to first unread message

Matthew Brett

unread,
Apr 7, 2010, 2:45:03 PM4/7/10
to SciPy Users List
Hi,

I was caught in the same trap as another innocent, in thinking that
scipy.stats.invnorm was the inverse of the normal distribution:

http://bytes.com/topic/python/answers/478142-scipy-numpy-inverse-cumulative-normal

In my desire to improve the docstring, I started looking; after a
while I found this:

http://en.wikipedia.org/wiki/Inverse_Gaussian_distribution

- and that seems to fit the invnorm code.

A Google search for 'inverse normal distribution' does not include the
page above in the first 20 hits, but does find the inverse of the
normal distribution, and this:

http://en.wikipedia.org/wiki/Normal-inverse_Gaussian_distribution

I wonder whether it would be good to rename scipy.stats.invnorm to
scipy.stats.invgauss ? Maybe with a deprecation warning to invnorm?

Best,

Matthew
_______________________________________________
SciPy-User mailing list
SciPy...@scipy.org
http://mail.scipy.org/mailman/listinfo/scipy-user

josef...@gmail.com

unread,
Apr 7, 2010, 3:05:43 PM4/7/10
to SciPy Users List
On Wed, Apr 7, 2010 at 2:45 PM, Matthew Brett <matthe...@gmail.com> wrote:
> Hi,
>
> I was caught in the same trap as another innocent, in thinking that
> scipy.stats.invnorm was the inverse of the normal distribution:
>
> http://bytes.com/topic/python/answers/478142-scipy-numpy-inverse-cumulative-normal
>
> In my desire to improve the docstring, I started looking; after a
> while I found this:
>
> http://en.wikipedia.org/wiki/Inverse_Gaussian_distribution
>
> - and that seems to fit the invnorm code.
>
> A Google search for 'inverse normal distribution' does not include the
> page above in the first 20 hits, but does find the inverse of the
> normal distribution, and this:
>
> http://en.wikipedia.org/wiki/Normal-inverse_Gaussian_distribution
>
> I wonder whether it would be good to rename scipy.stats.invnorm to
> scipy.stats.invgauss ?  Maybe with a deprecation warning to invnorm?

in general I wouldn't mind, but for naming consistency I prefer the current name

distributions created by some transformation of the normal distribution:

>>> [i for i in dir(stats) if 'norm' in i and isinstance(getattr(stats,i), stats.distributions.rv_generic)]
['foldnorm', 'halfnorm', 'invnorm', 'lognorm', 'norm', 'powerlognorm',
'powernorm', 'truncnorm']

I don't think the confusion persists very long, invnorm is a
distribution, the inverse function of the cdf of the normal
distribution is a function or in our case a method (ppf).

Josef

josef...@gmail.com

unread,
Apr 7, 2010, 3:11:02 PM4/7/10
to SciPy Users List
On Wed, Apr 7, 2010 at 3:05 PM, <josef...@gmail.com> wrote:
> On Wed, Apr 7, 2010 at 2:45 PM, Matthew Brett <matthe...@gmail.com> wrote:
>> Hi,
>>
>> I was caught in the same trap as another innocent, in thinking that
>> scipy.stats.invnorm was the inverse of the normal distribution:
>>
>> http://bytes.com/topic/python/answers/478142-scipy-numpy-inverse-cumulative-normal
>>
>> In my desire to improve the docstring, I started looking; after a
>> while I found this:
>>
>> http://en.wikipedia.org/wiki/Inverse_Gaussian_distribution
>>
>> - and that seems to fit the invnorm code.
>>
>> A Google search for 'inverse normal distribution' does not include the
>> page above in the first 20 hits, but does find the inverse of the
>> normal distribution, and this:
>>
>> http://en.wikipedia.org/wiki/Normal-inverse_Gaussian_distribution
>>
>> I wonder whether it would be good to rename scipy.stats.invnorm to
>> scipy.stats.invgauss ?  Maybe with a deprecation warning to invnorm?
>
> in general I wouldn't mind, but for naming consistency I prefer the current name
>
> distributions created by some transformation of the normal distribution:
>
>>>> [i for i in dir(stats) if 'norm' in i and isinstance(getattr(stats,i), stats.distributions.rv_generic)]
> ['foldnorm', 'halfnorm', 'invnorm', 'lognorm', 'norm', 'powerlognorm',
> 'powernorm', 'truncnorm']
>
> I don't think the confusion persists very long, invnorm is a
> distribution, the inverse function of the cdf of the normal
> distribution is a function or in our case a method (ppf).

But from http://en.wikipedia.org/wiki/Inverse_Gaussian_distribution
it looks like it's not a inverse transformation. In that case a
different name might reduce some confusion.

I will look at what invnorm really is, (I don't know)

Josef

Matthew Brett

unread,
Apr 9, 2010, 3:38:04 PM4/9/10
to SciPy Users List
Hi,

> But from http://en.wikipedia.org/wiki/Inverse_Gaussian_distribution
> it looks like it's not a inverse transformation. In that case a
> different name might reduce some confusion.
>
> I will look at what invnorm really is, (I don't know)

My impression is that the accepted name for this distribution is
'inverse Gaussian' or 'Wald' - but I don't think anyone else calls it
the 'inverse normal' - I am happy to be corrected if I am wrong.

Given that 'inverse normal' confused both of us, in different ways, do
you agree that a switch would be good?

See you,

josef...@gmail.com

unread,
Apr 9, 2010, 5:55:07 PM4/9/10
to SciPy Users List
On Fri, Apr 9, 2010 at 3:38 PM, Matthew Brett <matthe...@gmail.com> wrote:
> Hi,
>
>> But from http://en.wikipedia.org/wiki/Inverse_Gaussian_distribution
>> it looks like it's not a inverse transformation. In that case a
>> different name might reduce some confusion.
>>
>> I will look at what invnorm really is, (I don't know)
>
> My impression is that the accepted name for this distribution is
> 'inverse Gaussian' or 'Wald' - but I don't think anyone else calls it
> the 'inverse normal' - I am happy to be corrected if I am wrong.
>
> Given that 'inverse normal' confused both of us, in different ways, do
> you agree that a switch would be good?

I agree with the switch, I forgot to reply

I had checked Johnson, Kotz and Balakrishnan, and they have 3 or 4
parameterizations of the Inverse Gaussian, one of them is Wald, I
haven't checked yet if scale is a missing parameter in their version.

According to JKB, Tweedie called it the inverse gaussian because the
cumulants of IG and normal are (somehow) inversely related. But it is
not a transformation as e.g. lognorm.
(IG as abbreviation is confusing because I have seen IG for inverse
gamma or something like this.)

Numpy.random has this distribution available as wald, invnorm.rvs =
np.random.wald
My impression is InverseGaussian is the main name, in indices I saw
"Wald (see Inverse Gaussian)".

So the main question is whether to call it invgauss or wald, assuming
nobody objects to a renaming to clarify this.
I still want to compare parameterizations, but I'm in favor of renaming it.

Josef

Jarrod Millman

unread,
Feb 22, 2011, 7:05:35 PM2/22/11
to SciPy Users List
Hi,

I just hit this when doing some coding. Any objections to me
submitting a patch to rename to invgauss and deprecating 'invnorm'?

Best,

Jarrod

josef...@gmail.com

unread,
Feb 22, 2011, 7:23:50 PM2/22/11
to SciPy Users List

thanks, Ralf has already done it for 0.9

http://projects.scipy.org/scipy/ticket/1172

Josef

Jarrod Millman

unread,
Feb 23, 2011, 12:45:48 AM2/23/11
to SciPy Users List
On Tue, Feb 22, 2011 at 4:23 PM, wrote:
> thanks, Ralf has already done it for 0.9
>
> http://projects.scipy.org/scipy/ticket/1172

Thanks,

Reply all
Reply to author
Forward
0 new messages