stats
::hypergeometricCDF
The (discrete) cumulative probability function of the hypergeometric distribution
MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
stats::hypergeometricCDF(N
, X
, n
)
stats::hypergeometricCDF(N, X, n)
returns
a procedure representing the probability function
of the hypergeometric distribution with “population size” N
,
“success population size” X
and “sample
size” n
.
The procedure f:=stats::hypergeometricCDF(N, X, n)
can
be called in the form f(x)
with arithmetical expressions x
.
The return value of f(x)
is either a floatingpoint
number, an exact numerical value, or a symbolic expression:
If x
is an integer, a rational or a floating
point number, while N
is a positive integer and
both X
and n
are nonnegative
integers, then an explicit numerical value is returned.
The function f
reacts to properties of identifiers
set via assume
.
If any of the parameters is symbolic with properties as follows, then 0, 1 or a symbolic result is returned:
If x < max(0, n + X  N), then f(x) = 0.
If x ≥ min(n, X), then f(x) = 1.
If X = N, then f(x) = 0 for x < n and f(x) = 1 for x ≥ n.
If n = N, then f(x) = 0 for x < X and f(x) = 1 for x ≥ X.
If X = N  1, then f(x) = 0 for x < n  1, for n  1 ≤ x < n and f(x) = 1 for x ≥ n.
If n = N  1, then f(x) = 0 for x < X  1, for X  1 ≤ x < X and f(x) = 1 for x ≥ X.
If X = 1, then for 0 ≤ x < 1 and f(x) = 1 for x ≥ 1.
If n = 1, then for 0 ≤ x < 1 and f(x) = 1 for x ≥ 1.
If X = 0 or n = 0, then f(x) = 1 for x ≥ 0.
If x
and all parameters but N
are
numerical and the assumption on N is assume(N > X)
,
then symbolic values are returned.
f(x)
returns the symbolic call stats::hypergeometricCDF(N,
X, n)(x)
in all other cases.
Numerical values for N
are only accepted
if they are positive integers.
Numerical values for X
are only accepted
if they are nonnegative integers.
Numerical values for n
are only accepted
if they are nonnegative integers.
If x
is a floatingpoint number, the result
is a floating number provided N, X and n are
numerical values. If x
is an exact value, the result
is a rational number.
Note that for large numbers, floatingpoint results are computed
much faster than exact results. If floatingpoint approximations are
desired, pass a floatingpoint number x
to stats::hypergeometricCDF
.
The function is sensitive to the environment variable DIGITS
which
determines the numerical working precision.
We compute the distribution function with N = 20, X = 4 and n = 3 at various points:
f := stats::hypergeometricCDF(20, 4, 3): f(1), f(0), f(1/2), f(1), f(2), f(PI), f(5)
f(infinity), f(infinity)
f(0.2), f(0.0), f(0.7), f(1.0), f(float(PI)), f(4.0)
delete f:
We use symbolic arguments:
f := stats::hypergeometricCDF(N, X, n): f(x), f(8), f(8.0)
When real numbers are assigned to N, X and n, the function f starts to produce explicit results if the argument is numerical:
N := 15: X := 6: n := 5: f(0), f(1), f(2.0), f(3.5), f(4)
delete f, N, X, n:
If one or more parameters are symbolic, usually a symbolic call is returned. Some combinations of symbolic and numeric values for N, X, n and x, however, may yield symbolic or numeric results:
f := stats::hypergeometricCDF(N, X, n): X := 1: f(1), f(0), f(1/2), f(0.5), f(3/2), f(2.0)
X := N  1: f(1), f(n1), f(n)
delete X:
If x and all parameters but N are numerical and N is assumed to be greater than X, a symbolic expression is returned:
X := 6: assume(N > X): f := stats::hypergeometricCDF(N, X, 5): f(1), f(2), f(3)
delete f, N, X:

The “population size”: an arithmetical expression representing a positive integer 

The “success population size”: an arithmetical expression representing a nonnegative integer 

The “sample size”: an arithmetical expression representing a nonnegative integer 