[Scipy-tickets] [SciPy] #1530: Bugs in fit when moments are inf (cauchy, t(1)), scipy 0.9.0

SciPy Trac scipy-tickets@scipy....
Mon Oct 10 13:38:46 CDT 2011


#1530: Bugs in fit when moments are inf (cauchy, t(1)), scipy 0.9.0
------------------------------+---------------------------------------------
 Reporter:  gtg944q           |       Owner:  somebody   
     Type:  defect            |      Status:  new        
 Priority:  normal            |   Milestone:  Unscheduled
Component:  scipy.stats       |     Version:  0.9.0      
 Keywords:  cauchy fit stats  |  
------------------------------+---------------------------------------------

Comment(by kurisu):

 I have got some more observations which might be related:


 {{{
 In [1]: from scipy import stats

 In [2]: dist = stats.lognorm(0.23,scale=200)

 In [3]: samples = dist.rvs(size=100)

 In [4]: stats.lognorm.fit(samples)
 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-
 packages/scipy/optimize/optimize.py:280: RuntimeWarning: invalid value
 encountered in subtract
   and max(abs(fsim[0]-fsim[1:])) <= ftol):
 Out[4]: (1.0, 172.0422911659017, 21.077829650560751)

 In [5]: stats.lognorm._fitstart(samples)
 Out[5]: (1.0, 172.0422911659017, 21.077829650560751)

 In [6]: stats.lognorm.fit(samples,loc=0)
 /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-
 packages/scipy/stats/distributions.py:1038: RuntimeWarning: divide by zero
 encountered in log
   return log(self._pdf(x, *args))
 Out[6]: (0.22089394914559812, 0.017471808481871826, 201.82529106496099)

 In [7]: stats.lognorm.fit(samples,loc=0,floc=0)
 Out[7]: [2.2700403034686962, 0, 21.077829650560751]

 In [9]: scipy.__version__
 Out[9]: '0.9.0'

 }}}

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1530#comment:11>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list