[Stable]

Poisson distributions are frequently used to model counts.

dist_poisson(lambda)

Arguments

lambda

vector of (non-negative) means.

Details

We recommend reading this documentation on https://pkg.mitchelloharawild.com/distributional/, where the math will render nicely.

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)} $$

See also

Examples

dist <- dist_poisson(lambda = c(1, 4, 10))

dist
#> <distribution[3]>
#> [1] Pois(1)  Pois(4)  Pois(10)
mean(dist)
#> [1]  1  4 10
variance(dist)
#> [1]  1  4 10
skewness(dist)
#> [1] 1.0000000 0.5000000 0.3162278
kurtosis(dist)
#> [1] 1.00 0.25 0.10

generate(dist, 10)
#> [[1]]
#>  [1] 0 1 1 0 2 0 0 1 0 1
#> 
#> [[2]]
#>  [1] 7 5 3 7 4 3 6 5 2 3
#> 
#> [[3]]
#>  [1]  8 10 15 10  8  7  9  7  7  5
#> 

density(dist, 2)
#> [1] 0.183939721 0.146525111 0.002269996
density(dist, 2, log = TRUE)
#> [1] -1.693147 -1.920558 -6.087977

cdf(dist, 4)
#> [1] 0.99634015 0.62883694 0.02925269

quantile(dist, 0.7)
#> [1]  1  5 12