BUG: incorrect limits in discrete ppf, fixes ticket:1802, see also ticket:1803 #394

Closed
wants to merge 4 commits into
from

Projects

None yet

3 participants

@josef-pkt
Member

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

@rajkrpan
rajkrpan commented Jan 3, 2013

It seems that the fix has some additional problem. For e.g., stats.hypergeom.ppf(0.02, 32335, 32335, 895) no longer works

@josef-pkt
Member

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.

@rgommers
Member
rgommers commented Jan 5, 2013

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?

@rgommers
Member
rgommers commented Jan 5, 2013

Never mind, see ticket 1806 now. Close both 1802 and 1803 then?

@josef-pkt
Member

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

@rgommers
Member
rgommers commented Jan 5, 2013

OK, merged in 951dffc. Thanks Josef.

@rgommers rgommers closed this Jan 5, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment