Poisson Distribution

M.Ramya

 Poisson Distribution

The Poisson Distribution is a discrete probability distribution used to estimate the number of times an event might occur within a fixed interval of time or space.

For example, if a person eats twice a day on average, we can use the Poisson distribution to calculate the probability that they will eat three times in a day.

Parameters:

  • lam (λ): The expected number of occurrences (rate), e.g., 2 in the above scenario.

  • size: The number of random values to generate (i.e., the shape of the returned array).

Program:

Generate a random sample of size 10 from a Poisson distribution with an average occurrence of 2:

from numpy import random

x = random.poisson(lam=2, size=10)

print(x)

Output:

[4 2 4 2 1 1 3 1 1 3]

This will output an array of random numbers following the Poisson distribution.

Visualizing the Poisson Distribution

Let’s explore how the Poisson distribution looks with a simple example.

Program:

from numpy  import andom

import matplotlib.pyplot as plt

import seaborn as sns

sns.displot(random.poisson(lam=2, size=1000))

plt.show()

Difference Between Normal and Poisson Distribution

Normal Distribution: Continuous distribution, meaning it can take any value within a range.

Poisson Distribution: Discrete distribution, meaning it only takes non-negative integer values.

However, for large values of λ, the Poisson distribution starts to resemble the normal distribution. This is because as the mean (λ) increases, the distribution spreads out and becomes more symmetric, similar to the bell curve of the normal distribution.

Here’s an example that demonstrates this similarity:

Program:

from numpy import random

import matplotlib.pyplot as plt

import seaborn as sns

data = {
    "normal": random.normal(loc=50, scale=7, size=1000),
    "poisson": random.poisson(lam=50, size=1000)
}

sns.displot(data, kind="kde")

plt.show()

Difference Between Binomial and Poisson Distribution

Binomial Distribution: Models the number of successes in a fixed number of trials, with only two possible outcomes: success or failure.

Poisson Distribution: Models the number of occurrences of an event over a fixed interval; it has potentially unlimited outcomes (non-negative integers).

Interestingly, for very large n (number of trials) and very small p (probability of success), the binomial distribution closely approximates the Poisson distribution. In this case, the Poisson’s λ is approximately equal to n × p.

Program:

from numpy import random

import matplotlib.pyplot as plt

import seaborn as sns

data = {
    "binomial": random.binomial(n=1000, p=0.01, size=1000),
    "poisson": random.poisson(lam=10, size=1000)
}

sns.displot(data, kind="kde")

plt.show()

Tags
Our website uses cookies to enhance your experience. Learn More
Accept !

GocourseAI

close
send