Chapter 4

```{r setup, include=FALSE} knitr::opts_chunk$set(echo = FALSE) ``` ```{r, echo=F, message=F, warning=F} library(readr) library(openintro) data(COL) ``` # Poisson distribution ## Poisson distribution - The **Poisson distribution** is often useful for estimating the number of rare events in a large population over a short unit of time for a fixed population if the individuals within the population are independent. - The **rate** for a Poisson distribution is the average number of occurrences in a mostly-fixed population per unit of time, and is typically denotes by $\mathbf{\lambda}$. - Using the rate, we can describe the probability of observing exactly $k$ rare events in a single unit of time. P(observe $k$ rare events) = $\frac{\lambda^k e^{-\lambda}}{k!}$, where $k$ may take a value 0, 1, 2, and so on, and $k!$ represents $k$-factorial. The letter $e \approx 2.718$ is the base of the natural logarithm. The mean and standard deviation of this distribution are $\lambda$ and $\sqrt{\lambda}$, respectively. ## Practice \alert{Suppose that in a rural region of a developing country electricity power failures occur following a Poisson distribution with an average of 2 failures every week. Calculate the probability that in a given week the electricity fails only once.} ## Practice \alert{Suppose that in a rural region of a developing country electricity power failures occur following a Poisson distribution with an average of 2 failures every week. Calculate the probability that in a given week the electricity fails only once.} Given $\lambda = 2.$ ## Practice \alert{Suppose that in a rural region of a developing country electricity power failures occur following a Poisson distribution with an average of 2 failures every week. Calculate the probability that in a given week the electricity fails only once.} Given $\lambda = 2.$ \begin{align*} \text{P(only 1 failure in a week)} &= \frac{2^1 \times e^{-2}}{1!} \end{align*} ## Practice \alert{Suppose that in a rural region of a developing country electricity power failures occur following a Poisson distribution with an average of 2 failures every week. Calculate the probability that in a given week the electricity fails only once.} Given $\lambda = 2.$ \begin{align*} \text{P(only 1 failure in a week)} &= \frac{2^1 \times e^{-2}}{1!}\\ &= \frac{2 \times e^{-2}}{1} \end{align*} ## Practice \alert{Suppose that in a rural region of a developing country electricity power failures occur following a Poisson distribution with an average of 2 failures every week. Calculate the probability that in a given week the electricity fails only once.} Given $\lambda = 2.$ \begin{align*} \text{P(only 1 failure in a week)} &= \frac{2^1 \times e^{-2}}{1!}\\ &= \frac{2 \times e^{-2}}{1}\\ &= 0.27 \end{align*} ## Practice \alert{Suppose that in a rural region of a developing country electricity power failures occur following a Poisson distribution with an average of 2 failure every week. Calculate the probability that on a given \underline{day} the electricity fails three times} ## Practice \alert{Suppose that in a rural region of a developing country electricity power failures occur following a Poisson distribution with an average of 2 failure every week. Calculate the probability that on a given \underline{day} the electricity fails three times} We are given the weekly failure rate, but to answer this question we need to first calculate the average rate of failure on a given day: $\lambda_{day} = \frac{2}{7} = 0.2857$. Note that we are assuming that the probability of power failure is the same on any day of the week, i.e. we assume independence. ## Practice \alert{Suppose that in a rural region of a developing country electricity power failures occur following a Poisson distribution with an average of 2 failure every week. Calculate the probability that on a given \underline{day} the electricity fails three times} We are given the weekly failure rate, but to answer this question we need to first calculate the average rate of failure on a given day: $\lambda_{day} = \frac{2}{7} = 0.2857$. Note that we are assuming that the probability of power failure is the same on any day of the week, i.e. we assume independence. \begin{align*} \text{P(3 failures on a given day)} &= \frac{0.2857^3 \times e^{-0.2857}}{3!} \end{align*} ## Practice \alert{Suppose that in a rural region of a developing country electricity power failures occur following a Poisson distribution with an average of 2 failure every week. Calculate the probability that on a given \underline{day} the electricity fails three times} We are given the weekly failure rate, but to answer this question we need to first calculate the average rate of failure on a given day: $\lambda_{day} = \frac{2}{7} = 0.2857$. Note that we are assuming that the probability of power failure is the same on any day of the week, i.e. we assume independence. \begin{align*} \text{P(3 failures on a given day)} &= \frac{0.2857^3 \times e^{-0.2857}}{3!} \\ &= \frac{0.2857^3 \times e^{-0.2857}}{6} \end{align*} ## Practice \alert{Suppose that in a rural region of a developing country electricity power failures occur following a Poisson distribution with an average of 2 failure every week. Calculate the probability that on a given \underline{day} the electricity fails three times} We are given the weekly failure rate, but to answer this question we need to first calculate the average rate of failure on a given day: $\lambda_{day} = \frac{2}{7} = 0.2857$. Note that we are assuming that the probability of power failure is the same on any day of the week, i.e. we assume independence. \begin{align*} \text{P(3 failures on a given day)} &= \frac{0.2857^3 \times e^{-0.2857}}{3!} \\ &= \frac{0.2857^3 \times e^{-0.2857}}{6} \\ &= 0.0029 \end{align*} ## Is it Poisson? - A random variable may follow a Poisson distribution if the event being considered is rare, the population is large, and the events occur independently of each other. - However we can think of situations where the events are not really independent. For example, if we are interested in the probability of a certain number of weddings over one summer, we should take into consideration that weekends are more popular for weddings. - In this case, a Poisson model may sometimes still be reasonable if we allow it to have a different rate for different times; we could model the rate as higher on weekends that on weekdays. - The idea of modeling rates for a Poisson distribution against a second variable (day of the week) forms the foundation of some more advanced methods called **generalized linear models**. There are beyond the scope of this course, but we will discuss a foundation of linear models in Chapters 7 and 8. ## Practice \alert{A random variable that follows which of the following distributions can take on values other than positive integers?} A) Poisson B) Negative binomial C) Binomial D) Normal E) Geometric ## Practice \alert{A random variable that follows which of the following distributions can take on values other than positive integers?} A) Poisson B) Negative binomial C) Binomial D) \alert{Normal} E) Geometric