Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''
- Poisson distribution is used to describe the number of times a certain event occurs within a fixed time or space interval.
- The Poisson distribution is defined by the rate parameter, symbolized by the Greek letter lambda, λ.
- Lambda represents the expected value — or the average value — of the distribution.
- '''
- import scipy.stats as stats
- # average number of calls in our call center between 9am and 10am to be 15 calls - second parameter
- # What is the probability that we would see exactly 15 calls in that time frame? - first parameter
- # second parameter: Poisson distributed” with lambda = 15 (average)
- prob_15 = stats.poisson.pmf(15, 15)
- print(prob_15)
- # probability we would get between 7 and 9 calls?
- prob_7_to_9 = stats.poisson.pmf(7, 15) + stats.poisson.pmf(8, 15) + stats.poisson.pmf(9, 15)
- print(prob_7_to_9)
- # for a range of values use cdf
- # probability of observing more than 20 calls - use 1 minus
- prob_more_than_20 = 1 - stats.poisson.cdf(20, 15)
- print(prob_more_than_20)
- # probability of observing between 17 to 21 calls
- prob_17_to_21 = stats.poisson.cdf(21, 15) - stats.poisson.cdf(16, 15)
- print(prob_17_to_21)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement