[SciPy-User] scale parameter at 0

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[SciPy-User] scale parameter at 0

Mainak Jas
Hi everyone,

I was wondering if anyone had an insight into what happens in scipy when the scale parameter becomes 0. In particular, I was looking into lévy stable distribution. If we do in scipy:

>>> from scipy.stats import levy_stable
>>> levy_stable.rvs(alpha=0.99, beta=1, scale=0, loc=1, size=5)

I get:

>>> array([ 1.,  1.,  1.,  1.,  1.])

But when I look in wikipedia, it tells me that the scale parameter should be greater than 0. Maybe it's a more general question for all distributions, but I'm interested in this one particularly. Why doesn't scipy throw an error when scale parameter is 0?

Thanks.

Best regards,
Mainak

_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: scale parameter at 0

josef.pktd
On Sun, May 28, 2017 at 7:58 PM, Mainak Jas <[hidden email]> wrote:

> Hi everyone,
>
> I was wondering if anyone had an insight into what happens in scipy when the
> scale parameter becomes 0. In particular, I was looking into lévy stable
> distribution. If we do in scipy:
>
>>>> from scipy.stats import levy_stable
>>>> levy_stable.rvs(alpha=0.99, beta=1, scale=0, loc=1, size=5)
>
> I get:
>
>>>> array([ 1.,  1.,  1.,  1.,  1.])
>
> But when I look in wikipedia, it tells me that the scale parameter should be
> greater than 0. Maybe it's a more general question for all distributions,
> but I'm interested in this one particularly. Why doesn't scipy throw an
> error when scale parameter is 0?

scale defines the spread of the distribution, and is equal to the
standard deviation in the normal distribution.

As the scale goes to zero, the distribution collapses to a single
point, i.e. a Dirac measure. Whether that makes numerical sense for a
distribution depends on the floating point computation details.

In general it can still be useful to allow for the degenerate case
with scale=0, but I don't remember much discussion about it. From what
I remember scale=0 produces for many methods the correct limit for
scale -> 0, then there is no real reason to exclude it.
(A long time ago there was a discussion about adding a degenerate one
point distribution, but it doesn't fit well in any of the current base
classes.)

Josef


>
> Thanks.
>
> Best regards,
> Mainak
>
> _______________________________________________
> SciPy-User mailing list
> [hidden email]
> https://mail.python.org/mailman/listinfo/scipy-user
>
_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: scale parameter at 0

Mainak Jas
Hi Josef,

scale defines the spread of the distribution, and is equal to the
standard deviation in the normal distribution.

As the scale goes to zero, the distribution collapses to a single
point, i.e. a Dirac measure. Whether that makes numerical sense for a
distribution depends on the floating point computation details.

In general it can still be useful to allow for the degenerate case
with scale=0, but I don't remember much discussion about it. From what
I remember scale=0 produces for many methods the correct limit for
scale -> 0, then there is no real reason to exclude it.
(A long time ago there was a discussion about adding a degenerate one
point distribution, but it doesn't fit well in any of the current base
classes.)

Thanks a lot for the explanation. However, in this particular case for the
lévy stable distribution, I am not sure if it produces the correct limit for
scale -> 0. I worked out the Math with a colleague which I provide here:
https://www.overleaf.com/read/qgwtvtrkcrqc. Please let me know if we
missed something.

Mainak
 
Josef


>
> Thanks.
>
> Best regards,
> Mainak
>
> _______________________________________________
> SciPy-User mailing list
> [hidden email]
> https://mail.python.org/mailman/listinfo/scipy-user
>
_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user


_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: scale parameter at 0

Daπid

On 29 May 2017 at 17:03, Mainak Jas <[hidden email]> wrote:
I worked out the Math with a colleague which I provide here:
https://www.overleaf.com/read/qgwtvtrkcrqc. Please let me know if we
missed something.

You are using a property of the symetric stable distribution, but you consider beta = 1, which is asymmetric.

/David.


_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: scale parameter at 0

Mainak Jas
On Mon, May 29, 2017 at 5:33 PM, Daπid <[hidden email]> wrote:

On 29 May 2017 at 17:03, Mainak Jas <[hidden email]> wrote:
I worked out the Math with a colleague which I provide here:
https://www.overleaf.com/read/qgwtvtrkcrqc. Please let me know if we
missed something.

You are using a property of the symetric stable distribution, but you consider beta = 1, which is asymmetric.

Yes, but the symmetric stable distribution can be expressed in terms of the positive stable distribution (which is asymmetric) according to Equation (2)

Mainak
 
/David.


_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user



_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user
Loading...