hygepdf
statistics: y = hygepdf (x, m, k, n)
statistics: y = hygepdf (…, "vectorexpand"
)
Hypergeometric probability density function (PDF).
For each element of x, compute the probability density function (PDF) of the hypergeometric distribution with parameters m, k, and n. The size of y 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 probability of obtaining 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.
If the optional parameter vectorexpand
is provided, x may be an
array with size different from parameters m, k, and n
(which must still be of a common size or scalar). Each element of x
will be evaluated against each set of parameters m, k, and
n in columnwise order. The output y will be an array of size
r x s
, where r = numel (m)
, and
s = numel (x)
.
Further information about the hypergeometric distribution can be found at https://en.wikipedia.org/wiki/Hypergeometric_distribution
See also: hygecdf, hygeinv, hygernd, hygestat
Source Code: hygepdf
## Plot various PDFs from the hypergeometric distribution x = 0:60; y1 = hygepdf (x, 500, 50, 100); y2 = hygepdf (x, 500, 60, 200); y3 = hygepdf (x, 500, 70, 300); plot (x, y1, "*b", x, y2, "*g", x, y3, "*r") grid on xlim ([0, 60]) ylim ([0, 0.18]) legend ({"m = 500, k = 50, μ = 100", "m = 500, k = 60, μ = 200", ... "m = 500, k = 70, μ = 300"}, "location", "northeast") title ("Hypergeometric PDF") xlabel ("values in x (number of successes)") ylabel ("density") |