[SciPy-user] Gamma distribution questions

Stephen Walton stephen.walton at csun.edu
Thu Sep 29 13:42:25 CDT 2005


Robert Kern wrote, way back on September 8:

>Currently, the fit() method of distributions is broken. There's a
>problem with the way it passes arguments to the nnlf() method; that
>problem seems to apply to all distributions.
>
I actually fixed this, kind of, some time ago.  See

http://www.scipy.net/roundup/scipy/issue230

With this fix, I can do the following:

import scipy as S
x=S.stats.lognorm.rvs(0.75,loc=5,scale=3,size=(500,))
(shape,ppcc)=S.stats.ppcc_plot(x,0.1,4,dist='lognorm')
plot(shape,ppcc)     # Notice nice local maximum near shape=0.75
(osm,osr),(scale,loc,r)=S.stats.probplot(x,sparams=0.75,dist='lognorm',fit=1)
# Returns scale and loc which are tolerably close to 3 and 5, respectively.
plot(osm, osr)         # Notice this is fairly linear

However,

S.stats.ppcc_max(x,(0.1,4.),dist='lognorm')

seems to return nonsense with this test data (-5 or -6), although it 
produces the correct value with some real data I have.

>There is also a problem
>with distributions like Gamma which are intrinsically positive; all of
>the distribution objects take a loc parameter. For intrinsically
>positive variates like Gamma, this really should be fixed to 0 all of
>the time.
>  
>
I think I disagree.  I have sunspot group area data which are more or 
less lognormally (or perhaps weibull_min) distributed but which 
definitely have a nonzero loc parameter.

When will this parameter fitting capability be in "new scipy" and in 
what form?  What can I do to help?

Steve Walton

P.S.  Does anyone read the Bug Tracker entries at scipy.org?  My 
morestats.py fix is over three months old.




More information about the SciPy-user mailing list