# [SciPy-User] scale parameter at 0

5 messages
Open this post in threaded view
|
Report Content as Inappropriate

## [SciPy-User] scale parameter at 0

 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
Open this post in threaded view
|
Report Content as Inappropriate

## Re: scale parameter at 0

 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
Open this post in threaded view
|
Report Content as Inappropriate

## Re: scale parameter at 0

 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 thelévy stable distribution, I am not sure if it produces the correct limit forscale -> 0. I worked out the Math with a colleague which I provide here:https://www.overleaf.com/read/qgwtvtrkcrqc. Please let me know if wemissed 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
Open this post in threaded view
|
Report Content as Inappropriate

## Re: scale parameter at 0

 On 29 May 2017 at 17:03, Mainak Jas wrote:I worked out the Math with a colleague which I provide here:https://www.overleaf.com/read/qgwtvtrkcrqc. Please let me know if wemissed 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