# Poisson Distribution - Errors in Text

> This document is written in *R*.
>
> ***GitHub***: https://github.com/czs108

## Background

> In a certain long document there is an *average* of **0.5** typographical errors per **100** words of text.

## Question A

> What is the *mean* number of words between errors?

\begin{equation}
Mean = \frac{1}{0.5} \times 100 = 200
\end{equation}

## Question B

> What is the probability of finding **4** errors in a text of length **500** words?

\begin{equation}
\lambda = 0.5 \times \frac{500}{100} = 2.5
\end{equation}

\begin{equation}
\begin{split}
P(X = 4) &= \frac{e^{-\lambda} \cdot {\lambda}^{4}}{4!} \\
    &= \frac{e^{-2.5} \cdot {2.5}^{4}}{4!}
\end{split}
\end{equation}

Use the `dpois` function.


```R
dpois(x=4, lambda=2.5)
```

## Question C

> What is the probability of there being *at least* **300** words before the *1st* error?

\begin{equation}
\lambda = 0.5 \times \frac{300}{100} = 1.5
\end{equation}

\begin{equation}
\begin{split}
P(X = 0) &= \frac{e^{-\lambda} \cdot {\lambda}^{0}}{0!} \\
    &= e^{-1.5}
\end{split}
\end{equation}


```R
dpois(x=0, lambda=1.5)
```


0.22313016014843


Use the `exp` function.


```R
exp(-1.5)
```


0.22313016014843


## Question D

> What is the *minimum* number of words in which the probability of finding an error is *at least* **90%**?

We know that

\begin{equation}
P(X = 1) \geq 0.9
\end{equation}

So

\begin{equation}
P(X = 0) < 0.1
\end{equation}

Assume $n$ is the number of words.

\begin{equation}
\lambda = 0.5 \times \frac{n}{100}
\end{equation}

\begin{equation}
\begin{split}
P(X = 0) &= \frac{e^{-\lambda} \cdot {\lambda}^{0}}{0!} \\
    &= e^{-\lambda} \\
    &< 0.1
\end{split}
\end{equation}

Then we get

\begin{equation}
\ln 0.1 = -2.3
\end{equation}


```R
log(0.1)
```


-2.30258509299405


When $-\lambda < -2.3$, $P(X = 0) < 0.1$.

So $\lambda > 2.3$

\begin{equation}
n = 200 \times \lambda > 460
\end{equation}

## Question E

> How many words would there be on a page, if the probability of **0** errors on a page was **20%**?

Assume $n$ is the number of words on a page.

\begin{equation}
\lambda = 0.5 \times \frac{n}{100}
\end{equation}

\begin{equation}
\begin{split}
P(X = 0) &= \frac{e^{-\lambda} \cdot {\lambda}^{0}}{0!} \\
    &= e^{-\lambda} \\
    &= 0.2
\end{split}
\end{equation}

Then we get

\begin{align}
\ln 0.2 = -\lambda \\
\lambda = 1.609
\end{align}


```R
-log(0.2)
```


1.6094379124341


\begin{equation}
n = 200 \times \lambda = 322
\end{equation}

## Question F

> What is the probability of there being *at least* **2000** words before there are **10** errors?

\begin{equation}
\lambda = 0.5 \times \frac{2000}{100} = 10
\end{equation}

\begin{equation}
\begin{split}
P(X \leq 9) &= \sum_{i=0}^{9} P(X = i) \\
    &= \sum_{i=0}^{9} \frac{e^{-10} \cdot {10}^{i}}{i!}
\end{split}
\end{equation}


```R
sum(dpois(x=c(0:9), lambda=10))
```


0.457929714471852


Or use the `ppois` function.


```R
ppois(q=9, lambda=10)
```


0.457929714471852


8deb79b77b9213abedcf4e063f673efa1e34e132
ipynb
Jupyter Notebook
exercises/Poisson Distribution - Errors in Text.ipynb
czs108/Probability-Theory-Exercises
60c6546db1e7f075b311d1e59b0afc3a13d93229
MIT
exercises/Poisson Distribution - Errors in Text.ipynb
czs108/Probability-Theory-Exercises
60c6546db1e7f075b311d1e59b0afc3a13d93229
MIT
exercises/Poisson Distribution - Errors in Text.ipynb
czs108/Probability-Theory-Exercises
60c6546db1e7f075b311d1e59b0afc3a13d93229
MIT
2022-03-21T05:04:07.000Z
2022-03-21T05:04:07.000Z
Qwen/Qwen-72B
1. YES
2. YES