Skip to contents

Create a ddf object for the Poisson distribution with the given parameters.

Usage

pois(lambda, eps = 1e-10, normalize = TRUE)

Source

In order to calculate a fitting cutoff, the quantile function stats::qpois() is used. stats::dpois() is then employed to calculate the distribution.

Arguments

lambda

A positive number, the expected rate of occurrences.

eps

A positive number, how close the distribution is approximated. See ‘Details.’ (default: 1e-10)

normalize

Logical, whether to normalize the approximated distribution. (default: TRUE)

Value

A ddf distribution as described above.

Details

The Poisson distribution models the number of occurrences of an event within a given time frame. For this, the events have to occur independently, must not be able to occur at the same instant and have to occur at a constant average rate, expressed by the parameter \(\lambda\).

It has support \(\mathbb{N}_0\) on which its probability mass function is given by $$p(k) = e^{-\lambda} \frac{\lambda^k}{k!}.$$

As the Poisson distribution has countably infinite support and this package only works with discrete distributions with finite support, the resulting ddf object can only approximate the Poisson distribution.

For this, the support is cut off at a large enough integer such that the overall probability is still close to 1. The cutoff is controlled via the eps argument which specifies how close the sum of all probabilities has to be to 1. The default value is 1e-10 since this is also the minimum accuracy required for creating valid ddf objects.

By default, i.e. unless normalize is set to FALSE, the specified accuracy won't raise any problems even when being larger than 1e-10 as the approximation is normalized at the end (that is, the approximating probabilities are divided by their sum). This ensures that the returned object is an actual distribution with its overall probability being precisely one.

See also

Examples

pois(0.3)
#> (Approximation of a) poisson distribution with lambda = 0.3 
#> 
#> Support:
#> [1] 0 1 2 3 4 5 6 7 8
#> 
#> Probabilities:
#> [1] 7.408182e-01 2.222455e-01 3.333682e-02 3.333682e-03 2.500261e-04
#> [6] 1.500157e-05 7.500784e-07 3.214622e-08 1.205483e-09
# A much more accurate approximation of the same distribution
pois(0.3, .Machine$double.eps)
#> (Approximation of a) poisson distribution with lambda = 0.3 
#> 
#> Support:
#>  [1]  0  1  2  3  4  5  6  7  8  9 10 11
#> 
#> Probabilities:
#>  [1] 7.408182e-01 2.222455e-01 3.333682e-02 3.333682e-03 2.500261e-04
#>  [6] 1.500157e-05 7.500784e-07 3.214622e-08 1.205483e-09 4.018277e-11
#> [11] 1.205483e-12 3.287682e-14