Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

BUG: incorrect limits in discrete ppf, fixes ticket:1802, see also ti…

…cket:1803
  • Loading branch information...
commit 804c17ff2e20521c2e94ced766a5e138d2303a3e 1 parent b69fe18
Josef Perktold authored
6 scipy/stats/distributions.py
View
@@ -5354,8 +5354,8 @@ def _drv2_moment(self, n, *args):
return tot
def _drv2_ppfsingle(self, q, *args): # Use basic bisection algorithm
- b = self.invcdf_b
- a = self.invcdf_a
+ b = self.b
+ a = self.a
if isinf(b): # Be sure ending point is > q
b = max(100*q,10)
while 1:
@@ -6661,7 +6661,7 @@ def _rvs(self, M, n, N):
def _argcheck(self, M, n, N):
cond = rv_discrete._argcheck(self,M,n,N)
cond &= (n <= M) & (N <= M)
- self.a = N-(M-n)
+ self.a = max(N-(M-n), 0)
self.b = min(n,N)
return cond
def _logpmf(self, k, M, n, N):
10 scipy/stats/tests/test_distributions.py
View
@@ -938,6 +938,16 @@ def test_norm_logcdf():
finally:
np.seterr(**olderr)
+def test_hypergeom_interval_1802():
+ #these two did not return in a reasonable time, if ever
+ assert_equal(stats.hypergeom.interval(.95, 187601, 43192, 757),
+ (152.0, 197.0))
+ assert_equal(stats.hypergeom.interval(.945, 187601, 43192, 757),
+ (152.0, 197.0))
+ #this was working also before
+ assert_equal(stats.hypergeom.interval(.94, 187601, 43192, 757),
+ (153.0, 196.0))
+
if __name__ == "__main__":
run_module_suite()
Please sign in to comment.
Something went wrong with that request. Please try again.