Poisson distributions

Foundations of Probability in Python

Alexander A. Ramírez M.

CEO @ Synergy Vision

Poisson modeling

Call center

Line in a Bank

Foundations of Probability in Python

Poisson distribution properties

Poisson mass function plot

Foundations of Probability in Python

Probability mass function (pmf)

Call center photo

Imagine you have 2.2 calls per minute.

Foundations of Probability in Python

Probability mass function (pmf) (Cont.)

$$ $$ Poisson Probability mass function

In Python we do the following:

# Import poisson
from scipy.stats import poisson
# Calculate the probability mass 
# with pmf
poisson.pmf(k=3, mu=2.2)
0.19663867170702193

mu parameter specifies the mean of successful events.

Foundations of Probability in Python

pmf examples

Poisson Probability mass function

# Calculate pmf of 0
poisson.pmf(k=0, mu=2.2)
0.11080315836233387

# Calculate pmf of 6
poisson.pmf(k=6, mu=2.2)
0.01744840480280308
Foundations of Probability in Python

Different means

Poisson Probability mass function for different mu values

Foundations of Probability in Python

Cumulative distribution function (cdf)

Cumulative distribution function

# Calculate cdf of 2
poisson.cdf(k=2, mu=2.2)
0.6227137499963162

# Calculate cdf of 5
poisson.cdf(k=5, mu=2.2)
0.9750902496952996
Foundations of Probability in Python

Survival function and percent point function (ppf)

Survival function plot

# Calculate sf of 2
poisson.sf(k=2, mu=2.2)
0.3772862500036838

Percent point function plot

# Calculate ppf of 0.5
poisson.ppf(q=0.5, mu=2.2)
2.0
Foundations of Probability in Python

Sample generation (rvs)

# Import poisson, matplotlib.pyplot, and seaborn
from scipy.stats import poisson
import matplotlib.pyplot as plt
import seaborn as sns
# Create the sample using poisson.rvs()
sample = poisson.rvs(mu=2.2, size=10000, random_state=13)
# Plot the sample
sns.distplot(sample, kde=False)
plt.show()
Foundations of Probability in Python

Sample generation (Cont.)

Poisson probability mass function plot

Foundations of Probability in Python

Let's practice with Poisson

Foundations of Probability in Python

Preparing Video For Download...