Skip to contents

Poisson distributions are frequently used to model counts.

Usage

Poisson(lambda)

Arguments

lambda

The shape parameter, which is also the mean and the variance of the distribution. Can be any positive number.

Value

A Poisson object.

Details

We recommend reading this documentation on https://alexpghayes.github.io/distributions3/, where the math will render with additional detail.

In the following, let \(X\) be a Poisson random variable with parameter lambda = \(\lambda\).

Support: \(\{0, 1, 2, 3, ...\}\)

Mean: \(\lambda\)

Variance: \(\lambda\)

Probability mass function (p.m.f):

$$ P(X = k) = \frac{\lambda^k e^{-\lambda}}{k!} $$

Cumulative distribution function (c.d.f):

$$ P(X \le k) = e^{-\lambda} \sum_{i = 0}^{\lfloor k \rfloor} \frac{\lambda^i}{i!} $$

Moment generating function (m.g.f):

$$ E(e^{tX}) = e^{\lambda (e^t - 1)} $$

Examples


set.seed(27)

X <- Poisson(2)
X
#> [1] "Poisson(lambda = 2)"

random(X, 10)
#>  [1] 5 0 4 1 1 1 0 0 1 1

pdf(X, 2)
#> [1] 0.2706706
log_pdf(X, 2)
#> [1] -1.306853

cdf(X, 4)
#> [1] 0.947347
quantile(X, 0.7)
#> [1] 3

cdf(X, quantile(X, 0.7))
#> [1] 0.8571235
quantile(X, cdf(X, 7))
#> [1] 7