[Scipy-tickets] [SciPy] #1131: Scipy Stats ppf for Lognormal fails on array-like 'loc' or 'scale'

SciPy Trac scipy-tickets@scipy....
Mon Mar 15 15:32:52 CDT 2010


#1131: Scipy Stats ppf for Lognormal fails on array-like 'loc' or 'scale'
---------------------------------------------------+------------------------
 Reporter:  catintp                                |       Owner:  somebody
     Type:  defect                                 |      Status:  new     
 Priority:  normal                                 |   Milestone:  0.8.0   
Component:  scipy.stats                            |     Version:  0.7.0   
 Keywords:  ppf, parameters, loc, scale, mismatch  |  
---------------------------------------------------+------------------------

Comment(by josefpktd):

 just to check the other methods

 isf works (strangely, because it is defined similarly to ppf)

 {{{

 >>> res=stats.lognorm.isf(np.linspace(0,1,10), np.linspace(0.5,5,10),
 loc=np.arange(10))
 >>> res
 array([        Inf,  4.38935741,  5.14893566,  5.36660065,  5.41804016,
         5.65761811,  6.22145286,  7.04694218,  8.00411597,  0.        ])

 >>> stats.lognorm.isf(0.5*np.ones(10), np.linspace(0.5,5,10),
 loc=np.arange(10))
 array([  1.,   2.,   3.,   4.,   5.,   6.,   7.,   8.,   9.,  10.])
 >>> stats.lognorm.isf(0.5*np.ones(10), np.linspace(0.5,5,10),
 scale=np.arange(10))
 array([ NaN,   1.,   2.,   3.,   4.,   5.,   6.,   7.,   8.,   9.])
 >>> stats.lognorm.cdf(np.arange(10), np.linspace(0.5,5,10),
 scale=np.arange(10))
 array([ NaN,  0.5,  0.5,  0.5,  0.5,  0.5,  0.5,  0.5,  0.5,  0.5])
 }}}

 no problem with cdf pdf, sf
 {{{
 >>> res=stats.lognorm.cdf(np.linspace(0,5,10), np.linspace(0.5,5,10),
 loc=np.arange(10))
 >>> res=stats.lognorm.pdf(np.linspace(0,5,10), np.linspace(0.5,5,10),
 loc=np.arange(10))
 >>> res=stats.lognorm.sf(np.linspace(0,5,10), np.linspace(0.5,5,10),
 loc=np.arange(10))
 }}}

 known problem with stats and array location
 {{{
 >>> res=stats.lognorm.stats(np.linspace(0.5,5,10), loc=np.arange(10))
 Traceback (most recent call last):
   File "<pyshell#34>", line 1, in <module>
     res=stats.lognorm.stats(np.linspace(0.5,5,10), loc=np.arange(10))
   File "c:\josef\_progs\subversion\scipy-
 trunk_after\trunk\dist\scipy-0.8.0.dev6156.win32\programs\python25\lib
 \site-packages\scipy\stats\distributions.py", line 850, in stats
     if np.isinf(mu):
 ValueError: The truth value of an array with more than one element is
 ambiguous. Use a.any() or a.all()
 }}}

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


More information about the Scipy-tickets mailing list