Hypergeometric CDF
p = distfun_hygecdf(x,M,k,N) p = distfun_hygecdf(x,M,k,N,lowertail)
a matrix of doubles, the number of successful draws in the experiment. x belongs to the set [0,min(k,N)]
a matrix of doubles, the total size of the population. M belongs to the set {0,1,2,3........}
a matrix of doubles, the number of successful states in the population. k belongs to the set {0,1,2,3,.......M-1,M}
a matrix of doubles, the total number of draws in the experiment. N belongs to the set {0,1,2,3.......M-1,M}
a 1-by-1 matrix of booleans, the tail (default lowertail=%t). If lowertail is true (the default), then considers P(X<=x) otherwise P(X>x).
a matrix of doubles, the probability.
Computes the cumulative distribution function of the Hypergeometric distribution function.
Any scalar input argument is expanded to a matrix of doubles of the same size as the other input arguments.
// Tests with all the arguments scalar computed = distfun_hygecdf(20,80,50,30) expected = 0.7974774 // Test with x expanded computed = distfun_hygecdf([20 17],80,50,30) expected = [0.7974774 0.2746181] // Test with M expanded computed = distfun_hygecdf(20,[80 100],50,30) expected = [0.7974774 0.9921915] // Test with x,N expanded computed = distfun_hygecdf([20 17],80,[50 60],30) expected = [0.7974774 0.0041404] // Test with all the arguments expanded copmuted = distfun_hygecdf([20 17 15],[100 80 90],[50 60 70],[30 20 18]) expected = [0.9921915 0.9375322 0.8279598] // See upper tail p = distfun_hygecdf(20,80,50,30) lt_expected = 0.7974774 q = distfun_hygecdf(20,80,50,30,%f) ut_expected = 0.2025226 p+q // Plot the function scf(); x = (0:30)'; y = distfun_hygecdf(x,80,50,30); distfun_plotintcdf(x,y); xtitle("Hypergeometric CDF"); legend("M=80,k=50,N=30","in_upper_left"); | ![]() | ![]() |
http://en.wikipedia.org/wiki/Hypergeometric_distribution