hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_stat_prob_poisson (g01bk)


    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example


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


[plek, pgtk, peqk, ifail] = g01bk(rlamda, k)
[plek, pgtk, peqk, ifail] = nag_stat_prob_poisson(rlamda, k)


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_stat_prob_poisson (g01bk) computes for given λ and k the probabilities:
plek=ProbXk pgtk=ProbX>k peqk=ProbX=k .  
The method is described in Knüsel (1986).


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


Compulsory Input Parameters

1:     rlamda – double scalar
The parameter λ of the Poisson distribution.
Constraint: 0.0<rlamda106.
2:     k int64int32nag_int scalar
The integer k which defines the required probabilities.
Constraint: k0.

Optional Input Parameters


Output Parameters

1:     plek – double scalar
The lower tail probability, ProbXk.
2:     pgtk – double scalar
The upper tail probability, ProbX>k.
3:     peqk – double scalar
The point probability, ProbX=k.
4:     ifail int64int32nag_int scalar
ifail=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

Errors or warnings detected by the function:
On entry,rlamda0.0.
On entry,k<0.
On entry,rlamda>106.
An unexpected error has been triggered by this routine. Please contact NAG.
Your licence key may have expired or may not have been installed correctly.
Dynamic memory allocation failed.


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).

Further Comments

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


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

fprintf('g01bk example results\n\n');

rlamda =    [0.75  9.2  34  175];
k = int64([3     12   25  175]);

fprintf('  rlamda     k     plek      pgtk      peqk\n');
for i=1:4
  [plek, pgtk, peqk, ifail] = ...
  g01bk(rlamda(i), k(i));

  fprintf('%8.3f%6d%10.5f%10.5f%10.5f\n', rlamda(i), k(i), plek, pgtk, peqk);

g01bk example results

  rlamda     k     plek      pgtk      peqk
   0.750     3   0.99271   0.00729   0.03321
   9.200    12   0.86074   0.13926   0.07755
  34.000    25   0.06736   0.93264   0.02140
 175.000   175   0.52009   0.47991   0.03014

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

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