Documentation |
Quantile function of the hypergeometric distribution
This functionality does not run in MATLAB.
stats::hypergeometricQuantile(N, X, n)
stats::hypergeometricQuantile(N, X, n) returns a procedure representing the quantile function (discrete inverse) of the cumulative distribution function stats::hypergeometricCDF(N, X, n). For 0 ≤ x ≤ 1, k = stats::hypergeometricQuantile(N, X, n)(x) is the smallest nonnegative integer satisfying
.
The procedure f:=stats::hypergeometricQuantile(N, X, n) can be called in the form f(x) with arithmetical expressions x. The return value of f(x) is either a natural number between 0 and min(X, n), or a symbolic expression:
If x is a real number satisfying 0 ≤ x ≤ 1, 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, then in some cases a symbolic result will be returned:
0 will be returned if either any of x, n or X is zero or if n = 1 and or if X = 1 and .
1 will be returned if n = 1 and or if X = 1 and .
n will be returned if X = N - 1 and or if X = N and x > 0.
X will be returned if n = N - 1 and or if n = N and x > 0.
n - 1 will be returned if X = N - 1 and provided that n is symbolic, whereas X - 1 will be returned if n = N - 1 and provided that X is symbolic.
Finally min(X, n) will be returned if x = 1.
The symbolic call stats::hypergeometricQuantile(N, X, n)(x) is returned by f(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 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: Note that if floating-point arguments are passed to the quantile function f, the result is computed with floating-point arithmetic. This is faster than using exact arithmetic, but the result is subject to internal round-off errors. In particular, round-off may be significant for arguments x close to 1. Cf. Example 4. |
The quantile value k = stats::hypergeometricQuantile(N, X, n)(x) satisfies
,
where cdf = stats::hypergeometricCDF(N, X, n).
The function is sensitive to the environment variable DIGITS which determines the numerical working precision.
We evaluate the quantile function with N = 50, X = 30 and n = 10 at some points:
f := stats::hypergeometricQuantile(50, 30, 10): f(0), f((2/3)^30), f(PI/10), f(0.5), f(1 - 1/10^10)
With cdf = stats::hypergeometricCDF(N, X, n), the quantile value f(x) satisfies the inequalities cdf(f(x) - 1) < x ≤ cdf(f(x)):
x := 0.7: f(x)
stats::hypergeometricCDF(50, 30, 10)(float(f(x) - 1)), x, stats::hypergeometricCDF(50, 30, 10)(float(f(x)))
delete f, x:
We use symbolic arguments:
f := stats::hypergeometricQuantile(N, X, n): f(x), f(9/10)
When N, X and n evaluate to suitable numbers, the function f starts to produce quantile values:
N := 500: X := 80: n := 18: f(1/2), f(999/1000), f(1 - 1/10^10), f(1 - 1/10^80)
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::hypergeometricQuantile(N, X, n): f(0), f(1)
X := N - 1: f(n/N), f(7/10)
assume(x > n/N): f(0.5), f(x)
delete f, X, x:
If floating-point arguments are passed to the quantile function, the result is computed with floating-point arithmetic. This is faster than using exact arithmetic, but the result is subject to internal round-off errors:
f := stats::hypergeometricQuantile(10000, 2000, 30): f(1 - 1/10^18) <> f(float(1 - 1/10^18))
delete f:
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 |