# Bayesian Probability Drug Testing: what happens if you test again?

I was reading about Bayes' Theorem and ran across this example on Wikipedia.

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?

\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}

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?

Assuming that the two tests are (conditionally)independent and identically distributed for the same patient, then using $U$ for user $P_k$ for positive.

$$\mathsf P(U\mid P_1,P_2) =\dfrac{\mathsf P(P_1\mid U)^2~\mathsf P(U)}{\mathsf P(P_1\mid U)^2~\mathsf P(U)+\mathsf P(P_1\mid U^\complement)^2~\mathsf P(U^\complement)} =$$

Remark: However, it is implausible that the tests will be independent given the same patient; if the patient's toxicology profile does not change between tests, then the tests will be inclined towards giving the same reading.

$$\mathsf P(U\mid P_1,P_2) =\dfrac{\mathsf P(P_1,P_2\mid U)~\mathsf P(U)}{\mathsf P(P_1,P_2\mid U)~\mathsf P(U)+\mathsf P(P_1,P_2\mid U^\complement)~\mathsf P(U^\complement)}$$

For instance: suppose I have a colour test for "its green" that always gives positive for green smarties, negative results for red, but is uncertain when testing blue and give positive half the time. From a bag with equal amounts of each colour I extract one smartie, test it twice, and get two positive "its green" results.

The probability of a positive for one test given not-green is $\tfrac 14$. the probability of double positive given not-green is $\tfrac 18$.

$$\mathsf P(P_1\mid R\cup B) = \mathsf P(P_1\mid R)\mathsf P(R\mid R\cup B)+\mathsf P(P_1\mid B)\mathsf P(B\mid R\cup B) =0\cdot \tfrac 12+\tfrac 12\tfrac 12$$

$$\mathsf P(P_1,P_2\mid R\cup B) = \mathsf P(P_1,P_2\mid R)\mathsf P(R\mid R\cup B)+\mathsf P(P_1,P_2\mid B)\mathsf P(B\mid R\cup B) = 0\cdot \tfrac 12+\tfrac 14\tfrac 12$$

Clearly my "its green" tests are is not independent when applied to the same (not-green) smartie.

• (+1) Although I answered the OP's question assuming Independence, it's far more likely that the test-retest correspondence will be very close. I suspect most inaccuracies in a test stem from variability between individuals, not variability within an individual. – user237392 Sep 16 '16 at 3:57

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\%$$

In real life:

It can depend on the nature of the test. Some tests may be looking for a specific compound/virus in your bloodstream. Depending on the detected concentration of that compound/virus, the test will return positive or negative. This type of test could possibly be repeated to increase accuracy.

On the other hand, there are tests that always return the same result because they look for one specific thing that doesn't change in between tests. As an example, consider a test that looks for the presence of several symptoms (e.g. chest pain, dizziness, etc). The test may suggest, based on the symptoms, that the patient has a certain chance of having a disease. The test could be repeated, but the input will not change. The test will take the same factors into consideration and therefore return the same probability. In this case, repetition does not help.

Using that information and going back to your first question, "Assuming the tests are independent, how would you update your probability if you again tested positive?", it will depend on the specifics of the test. If the test can be repeated and is independent, you would apply Bayes' Rule a second time (now you have new initial probabilities - the 0.5% would change).

• (+1) for mentioning the difference between withing and between subjects variability. Very important in biomedical area. – user237392 Sep 16 '16 at 3:58