Documentation Center |
Probability function of the hypergeometric distribution
This functionality does not run in MATLAB.
stats::hypergeometricPF(N, X, n)
stats::hypergeometricPF(N, X, n) returns a procedure representing the probability function
for of the hypergeometric distribution with "population size" N, "success population size" X and "sample size" n.
The procedure f:=stats::hypergeometricPF(N, X, n) can be called in the form f(x) with arithmetical expressions x. The return value of f(x) is either a floating-point number, an exact numerical value, or a symbolic expression:
If x is a noninteger numerical value, f(x) returns 0 or 0.0, respectively.
If x is an integer or the floating-point equivalent of an integer, 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 = N, then f(x) = 1 for x = n and f(x) = 0 for x ≠ n. If n = N, then f(x) = 1 for x = X and f(x) = 0 for x ≠ X.
If X = N - 1, then for x = n, for x = n - 1 and f(x) = 0 for x ≠ n, n - 1.
If n = N - 1, then for x = X, for x = X - 1 and f(x) = 0 for x ≠ X, X - 1.
If X = 1, then for x = 0, for x = 1 and f(x) = 0 for x ≠ 0, 1.
If n = 1, then for x = 0, for x = 1 and f(x) = 0 for x ≠ 0, 1.
If X = 0 or n = 0, then f(x) = 1 for x = 0 and f(x) = 0 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::hypergeometricPF(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.
Note: If x is a floating-point 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, floating-point results are computed much faster than exact results. If floating-point approximations are desired, pass a floating-point number x to stats::hypergeometricPF.
The function is sensitive to the environment variable DIGITS which determines the numerical working precision.
We compute the probability function with N = 20, X = 4 and n = 3 at various points:
f := stats::hypergeometricPF(20, 4, 3): f(-infinity), f(0), f(1/2), f(1), f(2), f(4), f(infinity)
f(-0.2), f(0.0), f(0.7), f(1.0), f(2.0), f(2.7), f(3.0), f(4.0)
delete f:
We use symbolic arguments:
f := stats::hypergeometricPF(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, x:
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::hypergeometricPF(N, X, n): X := 1: f(-1), f(0), f(1), f(3/2), f(2), f(3)
X := N: f(-1), f(n), f(n + 1)
delete f, 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::hypergeometricPF(N, X, 5): f(2), f(4), f(5.0)
delete f, N, X:
N |
The "population size": an arithmetical expression representing a positive integer |
X |
The "success population size": an arithmetical expression representing a nonnegative integer |
n |
The "sample size": an arithmetical expression representing a nonnegative integer |