IMG_2991.jpeg
Document Details

Uploaded by QuieterEarthArt25
University of Surrey
Full Transcript
# The Poisson Distribution ## Introduction The Poisson distribution is a discrete probability distribution that expresses the probability of a given number of events occurring in a fixed interval of time or space if these events occur with a known constant mean rate and independently of the time s...
# The Poisson Distribution ## Introduction The Poisson distribution is a discrete probability distribution that expresses the probability of a given number of events occurring in a fixed interval of time or space if these events occur with a known constant mean rate and independently of the time since the last event. **Requirements:** * The data are counts of events. * All events are independent. * The average rate of events is constant. **Probability mass function:** $P(X = k) = \frac{e^{-\lambda} \lambda^k}{k!}$ where: * $P(X = k)$ is the probability of k events occurring in an interval * $\lambda$ is the average number of events per interval * $e$ is Euler's number (approximately 2.71828) * $k!$ is the factorial of k **Example:** Let's say that the average number of goals scored in a soccer match is 2.5. What is the probability of scoring exactly 5 goals in a match? $\lambda = 2.5$ $k = 5$ $P(X = 5) = \frac{e^{-2.5} 2.5^5}{5!} = 0.0668$ ## Poisson Distribution in Python We can use the `poisson.pmf` function from the `scipy.stats` module to calculate Poisson probabilities in Python. ```python import numpy as np import matplotlib.pyplot as plt form scipy.stats import poisson # Generate a Poisson distribution with mu = 5 mu = 5 x = np.arange(poisson.ppf(0.01, mu), poisson.ppf(0.99, mu)) plt.plot(x, poisson.pmf(x, mu), 'bo', ms=8) plt.vlines(x, 0, poisson.pmf(x, mu), colors='b', lw=5, alpha=0.5) plt.ylabel('Probability') plt.xlabel('Number of Events') plt.title('Poisson Distribution with mu=5') plt.show() ``` **Explanation:** * First, we import the necessary libraries: `numpy` for numerical operations, `matplotlib.pyplot` for plotting, and `poisson` from `scipy.stats` for the Poisson distribution. * Then, we set the mean (mu) of the Poisson distribution to 5. * We create an array `x` of values for which we want to plot the PMF. We use the `poisson.ppf` function to get the quantiles of the distribution, which gives us a range of values that cover most of the probability mass. * We plot the PMF using `plt.plot` to create a scatter plot of the probabilities for each value in `x`. * We also use `plt.vlines` to draw vertical lines from the x-axis to the probability values, which makes the plot easier to read. * Finally, we add labels and a title to the plot and display it using `plt.show()`. ## Key Concepts ### Mean and Variance For a Poisson distribution, both the mean and variance are equal to $\lambda$. $E(X) = Var(X) = \lambda$ ### Additivity The sum of independent Poisson random variables is also a Poisson random variable. If $X_1, X_2,..., X_n$ are independent Poisson random variables with means $\lambda_1, \lambda_2,..., \lambda_n$, then $\sum_{i=1}^{n} X_i$ is a Poisson random variable with mean $\sum_{i=1}^{n} \lambda_i$. ### Relationship to Other Distributions * **Binomial Distribution:** The Poisson distribution can be used as an approximation to the binomial distribution when $n$ is large and $p$ is small ($np < 10$). * **Exponential Distribution:** The interarrival times between events in a Poisson process follow an exponential distribution. ## Applications * **Queuing Theory:** Modeling the number of customers arriving in a queue. * **Reliability:** Modeling the number of failures of a system. * **Epidemiology:** Modeling the number of disease cases in a population. * **Finance:** Modeling the number of trades in a stock.