The Poisson distribution

Introduction to Statistics in Python

Maggie Matsui

Content Developer, DataCamp

Poisson processes

  • Events appear to happen at a certain rate, but completely at random
  • Examples
    • Number of animals adopted from an animal shelter per week
    • Number of people arriving at a restaurant per hour
    • Number of earthquakes in California per year
  • Time unit is irrelevant, as long as you use the same unit when talking about the same situation

  Dog in animal shelter with family

Introduction to Statistics in Python

Poisson distribution

  • Probability of some # of events occurring over a fixed period of time
  • Examples
    • Probability of $\ge$ 5 animals adopted from an animal shelter per week
    • Probability of 12 people arriving at a restaurant per hour
    • Probability of $\lt$ 20 earthquakes in California per year
Introduction to Statistics in Python

Lambda ($\lambda$)

  • $\lambda$ = average number of events per time interval
    • Average number of adoptions per week = 8

 

Poisson distribution with lambda = 8

Introduction to Statistics in Python

Lambda is the distribution's peak

 

3 Poisson distributions: one with lambda = 1, one with lambda = 5, and one with lambda = 8

Introduction to Statistics in Python

Probability of a single value

If the average number of adoptions per week is 8, what is $P(\text{\# adoptions in a week} = 5)$?

from scipy.stats import poisson

poisson.pmf(5, 8)
0.09160366
Introduction to Statistics in Python

Probability of less than or equal to

If the average number of adoptions per week is 8, what is $P(\text{\# adoptions in a week} \le 5)$?

from scipy.stats import poisson
poisson.cdf(5, 8)
0.1912361
Introduction to Statistics in Python

Probability of greater than

If the average number of adoptions per week is 8, what is $P(\text{\# adoptions in a week} \gt 5)$?

1 - poisson.cdf(5, 8)
0.8087639

If the average number of adoptions per week is 10, what is $P(\text{\# adoptions in a week} \gt 5)$?

1 - poisson.cdf(5, 10)
0.932914
Introduction to Statistics in Python

Sampling from a Poisson distribution

from scipy.stats import poisson
poisson.rvs(8, size=10)
array([ 9,  9,  8,  7, 11,  3, 10,  6,  8, 14])
Introduction to Statistics in Python

The CLT still applies!

Distribution of sample means from Poisson distribution with lambda = 8. Resembles the normal distribution

Introduction to Statistics in Python

Let's practice!

Introduction to Statistics in Python

Preparing Video For Download...