Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

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 X$X$ denote a random variable having a Poisson distribution with parameter λ$\lambda$ ( > 0)$\left(>0\right)$. 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 λ$\lambda$.
nag_stat_prob_poisson (g01bk) computes for given λ$\lambda$ and k$k$ the probabilities:
 plek = Prob{X ≤ k} pgtk = Prob{X > k} peqk = Prob{X = k} .
$plek=Prob{X≤k} 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 λ$\lambda$ of the Poisson distribution.
Constraint: 0.0 < rlamda106$0.0<{\mathbf{rlamda}}\le {10}^{6}$.
2:     k – int64int32nag_int scalar
The integer k$k$ which defines the required probabilities.
Constraint: k0${\mathbf{k}}\ge 0$.

None.

None.

### Output Parameters

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

## Error Indicators and Warnings

Errors or warnings detected by the function:
ifail = 1${\mathbf{ifail}}=1$
 On entry, rlamda ≤ 0.0${\mathbf{rlamda}}\le 0.0$.
ifail = 2${\mathbf{ifail}}=2$
 On entry, k < 0${\mathbf{k}}<0$.
ifail = 3${\mathbf{ifail}}=3$
 On entry, rlamda > 106${\mathbf{rlamda}}>{10}^{6}$.

## Accuracy

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

The time taken by nag_stat_prob_poisson (g01bk) depends on λ$\lambda$ and k$k$. For given λ$\lambda$, the time is greatest when kλ$k\approx \lambda$, and is then approximately proportional to sqrt(λ)$\sqrt{\lambda }$.

## 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

```