I was reading about Bayes' Theorem and ran across this example on Wikipedia.
\begin{align} P(\text{User}\mid\text{+}) &= \frac{P(\text{+}\mid\text{User}) P(\text{User})}{P(\text{+}\mid\text{User}) P(\text{User}) + P(\text{+}\mid\text{Non-user}) P(\text{Non-user})} \\[8pt] &= \frac{0.99 \times 0.005}{0.99 \times 0.005 + 0.01 \times 0.995} \\[8pt] &\approx 33.2\% \end{align}Suppose a drug test is 99% sensitive and 99% specific. That is, the test will produce 99% true positive results for drug users and 99% true negative results for non-drug users. Suppose that 0.5% of people are users of the drug. If a randomly selected individual tests positive, what is the probability that he is a user?
I understand that, given you tested positive, the probability you take a drug increases. But what happens if you get tested again? Assuming the tests are independent, how would you update your probability if you again tested positive? With more and more positive tests, would the probability you take the drug approach 100%?
extra: How are the probabilities of false results handled in real life tests?
Bayesian updating is relatively straightforward. If you test again and get positive results, then:
$$P(\mathrm{User}|++)=\frac{P(\mathrm{User})P(++|\mathrm{User})}{P(\mathrm{User})P(++|\mathrm{User})+P(\mathrm{\neg User})P(++|\mathrm{\neg User})}$$
If we assume independent tests, then this becomes:
$$P(\mathrm{User}|++)=\frac{P(\mathrm{User})P(+|\mathrm{User})^2}{P(\mathrm{User})P(+|\mathrm{User})^2+(1-P(\mathrm{User}))P(+|\mathrm{\neg User})^2}=\frac{0.005\times 0.99^2}{0.005\times 0.99^2+.995\times 0.01^2} \approx 98\%$$