5
$\begingroup$
n=19227;k=6018;Nx=10^6;

NProbability[0 < var < 200, 
 var \[Distributed] HypergeometricDistribution[n, k, Nx]]

(*0.000330001*)

N[CDF[HypergeometricDistribution[n, k, Nx], 200], 50]

(*0.99999999999980234474426879880990803313584713194835*)

I don't understand whats going on. I'm evaluating the CDF in both cases but NProbability is clearly giving me the wrong answer. What do I do?

$\endgroup$

2 Answers 2

9
$\begingroup$

By default, NProbability is using machine precision. This appears to be insufficient.

n = 19227; k = 6018; Nx = 10^6;

NProbability[0 < var < 200, 
var \[Distributed] HypergeometricDistribution[n, k, Nx], 
WorkingPrecision -> 100]


(* 0.9999999999996478278860752197394699718947902541813213958530809968591816102668832791282320631069752714 *)
$\endgroup$
4
$\begingroup$

The latest line should be

n = 19227; k = 6018; Nx = 10^6;
N[CDF[HypergeometricDistribution[n, k, Nx], 200], 100] - 
 N[CDF[HypergeometricDistribution[n, k, Nx], 1], 100]

0.99999999999980234474426879880990803313584713194819457153196994629316 38734132748161581793705151966009

See Wiki for info.

$\endgroup$
1
  • $\begingroup$ @micado: Thank you. Fixed. $\endgroup$
    – user64494
    Commented Nov 14 at 18:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.