nag_prob_hypergeom_vector (g01slc) returns a number of the lower tail, upper tail and point probabilities for the hypergeometric distribution.
Let
denote a vector of random variables having a hypergeometric distribution with parameters
,
and
. Then
where
,
and
.
nag_prob_hypergeom_vector (g01slc) 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
Section 2.6 in the g01 Chapter Introduction for further information.
- 1:
ln – IntegerInput
On entry: the length of the array
n.
Constraint:
.
- 2:
n[ln] – const IntegerInput
On entry: , the parameter of the hypergeometric distribution with , , for .
Constraint:
, for .
- 3:
ll – IntegerInput
On entry: the length of the array
l.
Constraint:
.
- 4:
l[ll] – const IntegerInput
On entry: , the parameter of the hypergeometric distribution with , .
Constraint:
.
- 5:
lm – IntegerInput
On entry: the length of the array
m.
Constraint:
.
- 6:
m[lm] – const IntegerInput
On entry: , the parameter of the hypergeometric distribution with , .
Constraint:
.
- 7:
lk – IntegerInput
On entry: the length of the array
k.
Constraint:
.
- 8:
k[lk] – const IntegerInput
On entry: , the integer which defines the required probabilities with , .
Constraint:
.
- 9:
plek[] – doubleOutput
-
Note: the dimension,
dim, of the array
plek
must be at least
.
On exit: , the lower tail probabilities.
- 10:
pgtk[] – doubleOutput
-
Note: the dimension,
dim, of the array
pgtk
must be at least
.
On exit: , the upper tail probabilities.
- 11:
peqk[] – doubleOutput
-
Note: the dimension,
dim, of the array
peqk
must be at least
.
On exit: , the point probabilities.
- 12:
ivalid[] – IntegerOutput
-
Note: the dimension,
dim, of the array
ivalid
must be at least
.
On exit:
indicates any errors with the input arguments, with
- No error.
On entry, | , |
or | , |
or | , |
or | . |
On entry, | is too large to be represented exactly as a real number. |
On entry, | the variance (see Section 3) exceeds . |
- 13:
fail – NagError *Input/Output
-
The NAG error argument (see
Section 3.6 in the Essential Introduction).
Not applicable.
The time taken by nag_prob_hypergeom_vector (g01slc) to calculate each probability depends on the variance (see
Section 3) and on
. For given variance, the time is greatest when
(
the mean), and is then approximately proportional to the square-root of the variance.