naginterfaces.library.stat.prob_​hypergeom_​vector

naginterfaces.library.stat.prob_hypergeom_vector(n, l, m, k)[source]

prob_hypergeom_vector returns a number of the lower tail, upper tail and point probabilities for the hypergeometric distribution.

For full information please refer to the NAG Library document for g01sl

https://support.nag.com/numeric/nl/nagdoc_30.2/flhtml/g01/g01slf.html

Parameters
nint, array-like, shape

, the parameter of the hypergeometric distribution.

lint, array-like, shape

, the parameter of the hypergeometric distribution.

mint, array-like, shape

, the parameter of the hypergeometric distribution.

kint, array-like, shape

, the integer which defines the required probabilities.

Returns
plekfloat, ndarray, shape

, the lower tail probabilities.

pgtkfloat, ndarray, shape

, the upper tail probabilities.

peqkfloat, ndarray, shape

, the point probabilities.

ivalidint, ndarray, shape

indicates any errors with the input arguments, with

No error.

On entry, .

On entry, , or, .

On entry, , or, .

On entry, , or, , or, , or, .

On entry, is too large to be represented exactly as a real number.

On entry, the variance (see Notes) exceeds .

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

Warns
NagAlgorithmicWarning
(errno )

On entry, at least one value of , , or was invalid, or the variance was too large.

Check for more information.

Notes

Let denote a vector of random variables having a hypergeometric distribution with parameters , and . Then

where , and .

The hypergeometric distribution may arise if in a population of size a number are marked. From this population a sample of size is drawn and of these are observed to be marked.

The mean of the distribution , and the variance .

prob_hypergeom_vector computes for given , , and the probabilities: , and using an algorithm similar to that described in Knüsel (1986) for the Poisson distribution.

The input arrays to this function are designed to allow maximum flexibility in the supply of vector arguments by re-using elements of any arrays that are shorter than the total number of evaluations required. See the G01 Introduction for further information.

References

Knüsel, L, 1986, Computation of the chi-square and Poisson distribution, SIAM J. Sci. Statist. Comput. (7), 1022–1036