Function Reference: hygecdf

statistics: p = hygecdf (x, m, k, n)
statistics: p = hygecdf (x, m, k, n, "upper")

Hypergeometric cumulative distribution function (CDF).

For each element of x, compute the cumulative distribution function (CDF) of the hypergeometric distribution with parameters m, k, and n. The size of p is the common size of x, m, k, and n. A scalar input functions as a constant matrix of the same size as the other inputs.

This is the cumulative probability of obtaining not more than x marked items when randomly drawing a sample of size n without replacement from a population of total size m containing k marked items. The parameters m, k, and n must be positive integers with k and n not greater than m.

[…] = hygecdf (x, m, k, n, "upper") computes the upper tail probability of the hypergeometric distribution with parameters m, k, and n, at the values in x.

Further information about the hypergeometric distribution can be found at https://en.wikipedia.org/wiki/Hypergeometric_distribution

See also: hygeinv, hygepdf, hygernd, hygestat

Source Code: hygecdf

Example: 1

 

 ## Plot various CDFs from the hypergeometric distribution
 x = 0:60;
 p1 = hygecdf (x, 500, 50, 100);
 p2 = hygecdf (x, 500, 60, 200);
 p3 = hygecdf (x, 500, 70, 300);
 plot (x, p1, "*b", x, p2, "*g", x, p3, "*r")
 grid on
 xlim ([0, 60])
 legend ({"m = 500, k = 50, n = 100", "m = 500, k = 60, n = 200", ...
          "m = 500, k = 70, n = 300"}, "location", "southeast")
 title ("Hypergeometric CDF")
 xlabel ("values in x (number of successes)")
 ylabel ("probability")

                    
plotted figure