nag_poisson_dist (g01bkc) (PDF version)
g01 Chapter Contents
g01 Chapter Introduction
NAG Library Manual

NAG Library Function Document

nag_poisson_dist (g01bkc)

 Contents

    1  Purpose
    7  Accuracy

1  Purpose

nag_poisson_dist (g01bkc) returns the lower tail, upper tail and point probabilities associated with a Poisson distribution.

2  Specification

#include <nag.h>
#include <nagg01.h>
void  nag_poisson_dist (double rlamda, Integer k, double *plek, double *pgtk, double *peqk, NagError *fail)

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 λ.
nag_poisson_dist (g01bkc) 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  Arguments

1:     rlamda doubleInput
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 double *Output
On exit: the lower tail probability, ProbXk.
4:     pgtk double *Output
On exit: the upper tail probability, ProbX>k.
5:     peqk double *Output
On exit: the point probability, ProbX=k.
6:     fail NagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

6  Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.2.1.2 in the Essential Introduction for further information.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_INT_ARG_LT
On entry, k=value.
Constraint: k0.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
An unexpected error has been triggered by this function. Please contact NAG.
See Section 3.6.6 in the Essential Introduction for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 3.6.5 in the Essential Introduction for further information.
NE_REAL_ARG_GT
On entry, rlamda=value.
Constraint: rlamda106.
NE_REAL_ARG_LE
On entry, rlamda=value.
Constraint: rlamda>0.0.

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  Parallelism and Performance

Not applicable.

9  Further Comments

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

10  Example

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

10.1  Program Text

Program Text (g01bkce.c)

10.2  Program Data

Program Data (g01bkce.d)

10.3  Program Results

Program Results (g01bkce.r)


nag_poisson_dist (g01bkc) (PDF version)
g01 Chapter Contents
g01 Chapter Introduction
NAG Library Manual

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