[Scipy-tickets] [SciPy] #793: scipy.stats.distribution: problem with self.a, self.b if they depend on parameters

SciPy scipy-tickets@scipy....
Tue Nov 18 09:31:31 CST 2008

#793: scipy.stats.distribution: problem with self.a, self.b if they depend on
 Reporter:  josefpktd    |       Owner:  somebody
     Type:  defect       |      Status:  new     
 Priority:  normal       |   Milestone:          
Component:  scipy.stats  |     Version:          
 Severity:  normal       |    Keywords:          
 I obtain an error if I evaluate genextreme.ppf with multiple parameters
 at the same time, for traceback see below.

 The direct reason for this is that genextreme._argcheck sets self.a to the
 same dimension as c (i.e. number of parameter tuples), which breaks
 reshaping using valarray in the generic ppf of rv_continuous.

 (Similar genpareto._argcheck sets self.b as function of the parameters)

 I don't think the module can handle correctly cases where multiple
 parameters tuples are used and the support of the distribution is
 parameter dependent. This needs further checking and some documentation.

 For now, it is better to get some exception than incorrect or unintended
 But I didn't test whether all generic methods that use the parameter
 dependent support actually fail.

 I think, the current tests only verify cases with one parameter tuple at a

 >>> c=2.62;stats.genextreme.ppf(0.5,np.array([[c],[c+0.5]]))
 Traceback (most recent call last):
   File "<pyshell#427>", line 1, in <module>
   File "C:\Josef\_progs\building\scipy\scipy-trunk-
 packages\scipy\stats\distributions.py", line 610, in ppf
     cond = cond0 & cond1
   File "C:\Josef\_progs\building\scipy\scipy-trunk-
 packages\scipy\stats\distributions.py", line 229, in valarray
     out = reshape(repeat([value],product(shape,axis=0),axis=0),shape)
   File "C:\Programs\Python25\lib\site-packages\numpy\core\fromnumeric.py",
 line 145, in reshape
     return reshape(newshape, order=order)
 ValueError: total size of new array must be unchanged

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

More information about the Scipy-tickets mailing list