R Functions Related to Poisson Distributions

To find the Poisson probability of seeing exactly $x$ occurrences of some event within some well-defined interval where the mean number of occurrences in that interval is expected to be $\lambda$, we can use the following R function:

dpois

Usage
dpois(x, lambda = λ)

Example

The probability of seeing exactly $3$ blemishes on a randomly selected piece of sheet metal, when on average one expects 1.2 blemishes, could be calculated with the following:

> dpois(3, lambda = 1.2)
[1] 0.08674393

If one needs to find the probability that $x$ or fewer occurrences are seen when $\lambda$ are expected, one can use the related cumulative probability distribution function:

ppois

Usage
ppois(x, lambda = λ)

Examples

In a call center that gets on average 13 calls every hour, the probability that in a given $15$ minute period they will receive less than $6$ calls can be calculated with the following:

> ppois(5, lambda = 13/4)
[1] 0.8888132

R also has a function that lets you simulate random variables that follow a Poisson distribution:

rpois

Usage
rpois(n, lambda = λ)

Note: unlike the previous functions, here $n$ represents the number of realizations of your random variable you wish to produce.

Examples

Over the course of 15 weeks, every Saturday -- at the same time -- an individual stands by the side of a road and tallies the number of cars going by within a 120-minute window. Simulate a set of observations for this situation under the assumption that the mean number of cars that go by per hour is actually $52$.

> rpois(15, lambda=104)
 [1]  96 113 106 104 101  96  96 114 109  91  94  95 108 113 113