Learn

The Poisson distribution is a discrete probability distribution, so it can be described by a probability mass function and cumulative distribution function.

We can use the poisson.pmf() method in the scipy.stats library to evaluate the probability of observing a specific number given the parameter (expected value) of a distribution. For example, suppose that we expect it to rain 10 times in the next 30 days. The number of times it rains in the next 30 days is “Poisson distributed” with lambda = 10. We can calculate the probability of exactly 6 times of rain as follows:

import scipy.stats as stats
# expected value = 10, probability of observing 6
stats.poisson.pmf(6, 10)

Output:

0.06305545800345125

Like previous probability mass functions of discrete random variables, individual probabilities can be summed together to find the probability of observing a value in a range.

For example, if we expect it to rain 10 times in the next 30 days, the number of times it rains in the next 30 days is “Poisson distributed” with lambda = 10. We can calculate the probability of 12-14 times of rain as follows:

import scipy.stats as stats
# expected value = 10, probability of observing 12-14
stats.poisson.pmf(12, 10) + stats.poisson.pmf(13, 10) + stats.poisson.pmf(14, 10)

Output:

0.21976538076223123

### Instructions

1.

We are working in a call center, and we expect the average number of calls in our call center between 9am and 10am to be 15 calls. What is the probability that we would see exactly 15 calls in that time frame?

Uncomment prob_15 and assign this probability to the variable. Use the poisson.pmf() method.

Be sure to print prob_15.

2.

What is the probability we would get between 7 and 9 calls?

Save this probability to the variable prob_7_to_9 and then print prob_7_to_9. Be sure to use the poisson.pmf() method.