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)

Purpose

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

Syntax

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

Description

Let XX denote a random variable having a Poisson distribution with parameter λλ ( > 0)(>0). Then
Prob{X = k} = eλ(λk)/(k ! ),  k = 0,1,2,
Prob{X=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 kk the probabilities:
plek = Prob{Xk}
pgtk = Prob{X > k}
peqk = Prob{X = k} .
plek=Prob{Xk} pgtk=Prob{X>k} peqk=Prob{X=k} .
The method is 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

Parameters

Compulsory Input Parameters

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

Optional Input Parameters

None.

Input Parameters Omitted from the MATLAB Interface

None.

Output Parameters

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

Error Indicators and Warnings

Errors or warnings detected by the function:
  ifail = 1ifail=1
On entry,rlamda0.0rlamda0.0.
  ifail = 2ifail=2
On entry,k < 0k<0.
  ifail = 3ifail=3
On entry,rlamda > 106rlamda>106.

Accuracy

Results are correct to a relative accuracy of at least 10610-6 on machines with a precision of 99 or more decimal digits, and to a relative accuracy of at least 10310-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 kk. For given λλ, the time is greatest when kλkλ, and is then approximately proportional to sqrt(λ)λ.

Example

function nag_stat_prob_poisson_example
rlamda = 0.75;
k = int64(3);
[plek, pgtk, peqk, ifail] = nag_stat_prob_poisson(rlamda, k)
 

plek =

    0.9927


pgtk =

    0.0073


peqk =

    0.0332


ifail =

                    0


function g01bk_example
rlamda = 0.75;
k = int64(3);
[plek, pgtk, peqk, ifail] = g01bk(rlamda, k)
 

plek =

    0.9927


pgtk =

    0.0073


peqk =

    0.0332


ifail =

                    0



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–2013