-
Book Overview & Buying
-
Table Of Contents
R for Data Science Cookbook
By :
Poisson distribution is best to use when expressing the probability of events occurring with a fixed time interval. These events are assumed to happen with a known mean rate, λ, and the event of the time is independent of the last event. Poisson distribution can be applied to examples such as incoming calls to customer service. In this recipe, we will demonstrate how to generate samples from Poisson distribution.
In this recipe, you need to prepare your environment with R installed.
Please perform the following steps to generate sample data from Poisson distribution:
Similar to normal distribution, we can use rpois to generate samples from Poisson distribution:
> set.seed(123) > poisson <- rpois(1000, lambda=3)
You can then plot sample data from a Poisson distribution into a histogram:
> hist(poisson, main="A histogram of a Poisson distribution")

Figure 5: A histogram of a Poisson distribution
You can then obtain the height...
Change the font size
Change margin width
Change background colour