Categories &

Functions List

Function Reference: hygeinv

statistics: x = hygeinv (p, m, k, n)

Inverse of the hypergeometric cumulative distribution function (iCDF).

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

This is the number of drawn marked items x given a probability p, 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.

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: hygeinv

Example: 1

 

 ## Plot various iCDFs from the hypergeometric distribution
 p = 0.001:0.001:0.999;
 x1 = hygeinv (p, 500, 50, 100);
 x2 = hygeinv (p, 500, 60, 200);
 x3 = hygeinv (p, 500, 70, 300);
 plot (p, x1, "-b", p, x2, "-g", p, x3, "-r")
 grid on
 ylim ([0, 60])
 legend ({"m = 500, k = 50, n = 100", "m = 500, k = 60, n = 200", ...
          "m = 500, k = 70, n = 300"}, "location", "northwest")
 title ("Hypergeometric iCDF")
 xlabel ("probability")
 ylabel ("values in p (number of successes)")

                    
plotted figure