[Numpy-discussion] bug in stats.binom? Or is it just me.

JJ josh8912 at yahoo.com
Tue Jul 11 19:00:47 CDT 2006


Am I using the wrong syntax for the binom.ppf command, or is there a bug?

>>> stats.binom.ppf(.975,100,.5)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib64/python2.4/site-packages/scipy/stats/distributions.py", line
3590, in ppf
    insert(output,cond,self._ppf(*goodargs) + loc)
  File "/usr/lib64/python2.4/site-packages/numpy/lib/function_base.py", line
501, in insert
    return _insert(arr, mask, vals)
TypeError: array cannot be safely cast to required type
>>>
-----------------
The info pages for binom.ppf state that:
binom.ppf(q,n,pr,loc=0)
        - percent point function (inverse of cdf --- percentiles)
So I would expect binom.ppf to take three variables.

I expected the function to return a number, such as is done in matlab:
N = 100
alpha = 0.05
p1 = 0.30
cutoff = binoinv(1-alpha, N, p1)

cutoff =

    38
Any suggestions?  


JJ






More information about the Numpy-discussion mailing list