corrects limits for bisection in discrete ppf, use .a and .b instead of .invcdf_a, .invcdf_b
make hypergeom.a always non-negative
test runs without errors with changes on top of scipy 0.11rc2
BUG: incorrect limits in discrete ppf, fixes ticket:1802, see also ti…
It seems that the fix has some additional problem. For e.g., stats.hypergeom.ppf(0.02, 32335, 32335, 895) no longer works
BUG: remove two sources of endless loop (self.a==self.b, and initial …
…a,b are not integer valued)
TST: add test for .a == .b case
REF: add check that updating doesn't stop to prevent endless loops
The last commit raises a RuntimeError if the updating in the bisection stops. Added as a safeguard, even if it should never be reached if the code is correct.
I guess RuntimeError is the right exception, is it?
tested on scipy 0.9.0 without any of the other changes. In the original case of ticket:1802 an exception would be raised now instead of the endless loop.
Note: pull request needs a test run with the current scipy master, since I never run the master version.
RuntimeError is ok, fix works fine also with master.
Question on the tickets: 1802 still has some unfixed issues listed (spd.hypergeom.pmf(0, 32335, 0, 895) --> nan, etc.), while 1803 seems fixed. You description in PR title says to close 1802 and leave 1803 open though?
spd.hypergeom.pmf(0, 32335, 0, 895) --> nan
Never mind, see ticket 1806 now. Close both 1802 and 1803 then?
Yes, close both. Initially I wanted to keep 1803 open for further improvements but I think it should work well enough now. The only thing left would be improving sf/isf, but that's not directly relevant for this changes.
one cleanup I forgot: invcdf_a and invcdf_b can also be remove from the rv_discrete.__init__ . They are not used anymore
OK, merged in 951dffc. Thanks Josef.