g01bl returns the lower tail, upper tail and point probabilities associated with a hypergeometric distribution.
Syntax
C# |
---|
public static void g01bl( int n, int l, int m, int k, out double plek, out double pgtk, out double peqk, out int ifail ) |
Visual Basic |
---|
Public Shared Sub g01bl ( _ n As Integer, _ l As Integer, _ m As Integer, _ k As Integer, _ <OutAttribute> ByRef plek As Double, _ <OutAttribute> ByRef pgtk As Double, _ <OutAttribute> ByRef peqk As Double, _ <OutAttribute> ByRef ifail As Integer _ ) |
Visual C++ |
---|
public: static void g01bl( int n, int l, int m, int k, [OutAttribute] double% plek, [OutAttribute] double% pgtk, [OutAttribute] double% peqk, [OutAttribute] int% ifail ) |
F# |
---|
static member g01bl : n : int * l : int * m : int * k : int * plek : float byref * pgtk : float byref * peqk : float byref * ifail : int byref -> unit |
Parameters
- n
- Type: System..::..Int32On entry: the parameter of the hypergeometric distribution.Constraint: .
- l
- Type: System..::..Int32On entry: the parameter of the hypergeometric distribution.Constraint: .
- m
- Type: System..::..Int32On entry: the parameter of the hypergeometric distribution.Constraint: .
- k
- Type: System..::..Int32On entry: the integer which defines the required probabilities.Constraint: .
- plek
- Type: System..::..Double%On exit: the lower tail probability, .
- pgtk
- Type: System..::..Double%On exit: the upper tail probability, .
- peqk
- Type: System..::..Double%On exit: the point probability, .
- ifail
- Type: System..::..Int32%On exit: unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).
Description
Let denote a random variable 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 .
g01bl computes for given , ,
and the probabilities:
The method is similar to the method for the Poisson distribution described in Knüsel (1986).
References
Knüsel L (1986) Computation of the chi-square and Poisson distribution SIAM J. Sci. Statist. Comput. 7 1022–1036
Error Indicators and Warnings
Errors or warnings detected by the method:
On entry, .
On entry, , or .
On entry, , or .
On entry, , or , or , or .
On entry, n is too large to be represented exactly as a real number.
On entry, the variance (see [Description]) exceeds .
Accuracy
Results are correct to a relative accuracy of at least on machines with a precision of or more decimal digits, and to a relative accuracy of at least on machines of lower precision (provided that the results do not underflow to zero).
Parallelism and Performance
None.
Further Comments
The time taken by g01bl depends on the variance (see [Description]) and on . For given variance, the time is greatest when ( the mean), and is then approximately proportional to the square-root of the variance.
Example
This example reads values of , , and from a data file until end-of-file is reached, and prints the corresponding probabilities.
Example program (C#): g01ble.cs