Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

stats::hypergeometricQuantile

Quantile 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.

Syntax

stats::hypergeometricQuantile(N, X, n)

Description

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).

Environment Interactions

The function is sensitive to the environment variable DIGITS which determines the numerical working precision.

Examples

Example 1

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) < xcdf(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:

Example 2

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:

Example 3

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:

Example 4

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:

Parameters

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

Return Values

procedure.

Was this topic helpful?