0

Abbreviate: $D =$ a person is diseased, $+ =$ the test is positive.
Assume: $\Pr(D) = 0.001, \; \Pr(+|D)=0.99, \; \Pr(+|D^C) = 0.01 \qquad ($$\iff$ $ \Pr(-|D^C) = 0.99).$

1. Use Bayes's Theorem: $\Pr(D|+) = 0.0 \; 90 \; 1639... \quad $ (confirmed; scroll down 30% hereof).

2. Quantify the above probabilities for 1000 people (per 1 and 2)
(Table herefrom. Green indicates True results, red False results).

$$\begin{array}{r|cc|c} &D &\lnot D &\text{Total}\\ \hline +&\color{green}{\Pr(D)\Pr(+|D)}&\color{red}{\Pr(D^C)\Pr(+|D^C)}&\text{add the 2 left entries}\\ - &\color{red}{\Pr(D)\Pr(-|D)}&\color{green}{\Pr(D^C)\Pr(-|D^C)}&\color{black}{\text{add the 2 left entries}}\\ \hline \text{Total}&\color{black}{1}&\color{black}{999}&\color{black}{1000} \end{array}$$

$$\begin{array}{r|cc|c} &D &\lnot D &\text{Total}\\ \hline +&\color{green}{1}&\color{red}{9.99}&10.99\\ - &\color{red}{\text{impertinent}}&\color{green}{\text{impertinent}}&\color{black}{\text{impertinent}}\\ \hline \text{Total}&\color{black}{1}&\color{black}{999}&\color{black}{1000} \end{array}$$

$3.$ So $\Pr(D|+) = \dfrac{ \color{green}{1} }{ 10.99 } = 0.0 \; 90 \; 9918... \quad $

Why do 1 and 3 differ starting at the ten-thousandth digit?

  • Your $9.9$ should be $9.99$. Also, your $1$ should be $0.99$. Too much rounding. – André Nicolas Feb 04 '16 at 04:26
  • @AndréNicolas I incorporated your first sentence. But why should my $1$ be $0.99$? –  Feb 04 '16 at 06:52
  • Only $99%$ of people with the disease test positive. The total $10000$ used by Adriano makes things more clear. – André Nicolas Feb 04 '16 at 07:05
  • 1
    Basically, the "impertinent" is not irrelevant, as it would show where the error lay. $;$ Since there is a non-zero something in the red "impertinent" cell, the cell above it can not contain $1$. $;$ It must be $1-\color{red}{\textsf{impertinent}}$. – Graham Kemp Feb 04 '16 at 07:33

2 Answers2

0

As mentioned in the comments, this is due to roundoff error. Try instead using $100000$ people:

$$\begin{array}{r|cc|c} &D &\lnot D &\text{Total}\\ \hline +&\color{green}{99}&\color{red}{999}&1098\\ - &\color{red}{1}&\color{green}{98901}&\color{black}{98902}\\ \hline \text{Total}&\color{black}{100}&\color{black}{99900}&\color{black}{100000} \end{array}$$

So: $$ \Pr[D \mid +] = \frac{99}{1098} = \frac{11}{122} = 0.090163934\ldots $$

Adriano
  • 41,576
  • Thanks; though I just corrected my OP, I do not see the 'roundoff' error. Why should my $1$ be $0.99$? –  Feb 04 '16 at 06:53
  • Because that entry in the table has a probability of: $$ \Pr[D \text{ and } +] = \Pr[D] \cdot \Pr[+ \mid D] = (0.001)(0.99) = 0.00099 $$ so multiplying by your total of $1000$ people yields $0.99$. – Adriano Feb 04 '16 at 12:05
0

Thanks to user 'Adriano' 's answer, I recognised the problem: I neglected to calculate precisely the four numbers in the middle entry which should instead be:

$$\begin{array}{r|cc|c} &D &\lnot D &\text{Total}\\ \hline +&\color{green}{0.99}&\color{red}{9.99}&10.98\\ - &\color{red}{ 0.01 }&\color{green}{989.01}&\color{black}{\text{989.02}}\\ \hline \text{Total}&\color{black}{1}&\color{black}{999}&\color{black}{1000} \end{array}$$

$3.$ So $\Pr(D|+) = \dfrac{ \color{green}{0.99} }{ 10.98 } = 0.0 \; 90 \; 1639344... \quad $