[SciPy-dev] Problem with F distribution, or with me? - ticket 422 might apply for discrete distributions

josef.pktd@gmai... josef.pktd@gmai...
Tue Aug 26 20:31:49 CDT 2008

On Tue, Aug 26, 2008 at 8:18 PM,  <josef.pktd@gmail.com> wrote:

> Can somebody run:
> stats.zipf.pmf(range(10),1.5)
> stats.zipf.cdf(10,1.5)
> stats.zipf.cdf(range(10),1.5)
> I get
>>>> stats.zipf.cdf(10,1.5)
> Traceback (most recent call last):
>  File "<stdin>", line 1, in ?
>  File "C:\Josef\_progs\Subversion\scipy_trunk\dist\Programs\Python24\Lib\site-p
> ackages\scipy\stats\distributions.py", line 3549, in cdf
>    place(output,cond,self._cdf(*goodargs))
>  File "C:\Josef\_progs\Subversion\scipy_trunk\dist\Programs\Python24\Lib\site-p
> ackages\scipy\stats\distributions.py", line 3458, in _cdf
>    return self._cdfvec(k,*args)
>  File "C:\Programs\Python24\Lib\site-packages\numpy\lib\function_base.py", line
>  1092, in __call__
>    raise ValueError, "mismatch between python function inputs"\
> ValueError: mismatch between python function inputs and received arguments
> but this might be, because I am running either an older version of
> scipy or from my own faulty (?) build from subversion.
> If the current version still has this error, then I think it is
> related to the generic calculation of the cdf,
> similar to ticket 422, changeset 3797 for the moment calculation.
> In my tests I get many value errors, but again I don't know whether it
> is my version/setup, whether the parameters are not ruled out but
> don't make sense, or whether there is actually a bug somewhere.
> Josef

in changeset 3797 this was added to the continuous random variable:
315	        self.generic_moment.nin = self.numargs+1 # Because of the
*args argument
316	        # of _mom0_sc, vectorize cannot count the number of
arguments correctly.
in current trunk these are lines 318 and 319

I don't understand the details of numpy and vectorize, but I think
that the same problem with the number
of arguments also applies to the generic calculation for the discrete
distribution, i.e. lines

3401 	            self._ppf = new.instancemethod(sgf(_drv_ppf,otypes='d'),
3402 	                                           self, rv_discrete)
3403 	            self._pmf = new.instancemethod(sgf(_drv_pmf,otypes='d'),
3404 	                                           self, rv_discrete)
3405 	            self._cdf = new.instancemethod(sgf(_drv_cdf,otypes='d'),
3406 	                                           self, rv_discrete)

since all _drv_??? methods also use the *args argument and the
exception message I get looks the same as in ticket 422.


More information about the Scipy-dev mailing list