G01BKF (PDF version)
G01 Chapter Contents
G01 Chapter Introduction
NAG Library Manual

NAG Library Routine Document


Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

G01BKF returns the lower tail, upper tail and point probabilities associated with a Poisson distribution.

2  Specification


3  Description

Let X denote a random variable having a Poisson distribution with parameter λ >0. Then
ProbX=k=e-λλkk! ,  k=0,1,2,
The mean and variance of the distribution are both equal to λ.
G01BKF computes for given λ and k the probabilities:
PLEK=ProbXk PGTK=ProbX>k PEQK=ProbX=k .
The method is described in Knüsel (1986).

4  References

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

5  Parameters

1:     RLAMDA – REAL (KIND=nag_wp)Input
On entry: the parameter λ of the Poisson distribution.
Constraint: 0.0<RLAMDA106.
2:     K – INTEGERInput
On entry: the integer k which defines the required probabilities.
Constraint: K0.
3:     PLEK – REAL (KIND=nag_wp)Output
On exit: the lower tail probability, ProbXk.
4:     PGTK – REAL (KIND=nag_wp)Output
On exit: the upper tail probability, ProbX>k.
5:     PEQK – REAL (KIND=nag_wp)Output
On exit: the point probability, ProbX=k.
6:     IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is 0. When the value -1​ or ​1 is used it is essential to test the value of IFAIL on exit.
On exit: IFAIL=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry IFAIL=0 or -1, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
On entry,RLAMDA0.0.
On entry,K<0.
On entry,RLAMDA>106.

7  Accuracy

Results are correct to a relative accuracy of at least 10-6 on machines with a precision of 9 or more decimal digits, and to a relative accuracy of at least 10-3 on machines of lower precision (provided that the results do not underflow to zero).

8  Further Comments

The time taken by G01BKF depends on λ and k. For given λ, the time is greatest when kλ, and is then approximately proportional to λ.

9  Example

This example reads values of λ and k from a data file until end-of-file is reached, and prints the corresponding probabilities.

9.1  Program Text

Program Text (g01bkfe.f90)

9.2  Program Data

Program Data (g01bkfe.d)

9.3  Program Results

Program Results (g01bkfe.r)

G01BKF (PDF version)
G01 Chapter Contents
G01 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012