# Sensitivity and specificity of a repeated test

Consider the following situation.

There is an epidemic and a person has probability $$0.01$$ of having the disease. The authorities decide to test the population, but the test is not completely reliable. The sensitivity of the test is $$0.98$$ and its specificity is $$0.95$$. Given that Patrick was tested positive for the disease, what is the probability that Patrick has the disease?

In drawing up a simple probability tree, one can arrive at the answer of $$0.165$$.

However, it is the next part that stumps me.

Patrick wants a second opinion, so he does an independent repetition of the test (regardless of Patrick's disease status, outcomes of the tests are independent). In the second test, he was tested positive again. What is the probability that Patrick has the disease?

I thought that since the tests are independent, it is like he never went for the first test, so the answer should still be $$0.165$$.

However, the correct answer is $$0.795$$.

I am not sure how to approach the second part of the question. If, say, I wish to use a probability tree again, how would I do it this time?

It is precisely because they are independent that the probabilities can change.

Consider the most extremely dependent case for contrast: the second opinion is not really a second opinion, but just a new person telling Patrick the same results. Then Patrick doesn't really have any new information, which means the probabilities are unchanged.

Look at the following composite test: Take the original test and a second, identical but independent, test and consider the composite test as positive iff both tests come back positive. What is the specificity of this new test? It's $$1-(1-0.95)(1-0.95)=0.9975$$. And what's the sensitivity? It's $$0.98\cdot0.98=0.9604$$. This is, in effect, the test that Patrick has done, and it has come back positive. That new, higher specificity greatly increases his chances of being sick compared to what a positive result in the original test did.

• Thank you for your comment :) However, I don't think I have learnt how to calculate sensitivity and specificity (I just take the values as given in the question), so this is something new for me. May I ask, if the sensitivity of the 2nd test is, effectively, the square of the sensitivity of the first, then why is the new specificity not calculated in the same way i.e. $0.95^2$? Actually, what is the logic you used in calculating the new sensitivity and specificity? Commented Nov 21, 2019 at 13:52
• @EthanMark You have to think about what sensitivity and specificity mean. Sensitivity is the probability that a sick person tests positive. If we require both small tests to be positive for the big test to be considered positive, then the probability for the big test to be positive (on a sick person) is the probability that the first test is positive multiplied with the probability that the second test is positive. As for specificity, this is the probability that a healthy person tests negative. Same thing there: write down what exactly that means in terms of the small tests, and calculate. Commented Nov 21, 2019 at 14:06
• However, for a healthy person to test negative, there are more options. Either of the tests could be negative, or both of them. If you calculate this probability properly, you get $0.95+0.95-0.95^2$. Alternatively, you can think "a person tests negative iff he doesn't test positive". If you take this approach, the result $1-(1-0.95)(1-0.95)$ drops out. The two expressions evaluate to the same value, of course. Commented Nov 21, 2019 at 14:10
• Oh. I get it now! The specificity part was pretty straightforward, but the sensitivity part was a headache. Thank you for your help! Don't know how people can be not confused by this. Commented Nov 21, 2019 at 14:23

Another way to see it is with Bayes Theorem.

Calling $$D$$ the disease and $$T$$ the test, the probability of having the disease given a positive test (also called Positive Predictive Value, PPV) is $$\mathrm{PPV} = P(D^+|T^+) = \frac{\mathbf{Se} \cdot \mathbf{Pr}}{ \mathbf{Se} \cdot \mathbf{Pr} + (1 - \mathbf{Sp}) (1 - \mathbf{Pr}) }$$

where $$\mathbf{Se}$$ and $$\mathbf{Sp}$$ are respectively Sensitivity and Specificity and $$\mathbf{Pr}$$ is the prior probability (NB: if $$\mathbf{Pr}$$ is the prevalence in a sample, PPV simply reduces to $$\frac{\mathrm{TP}}{\mathrm{TP} + \mathrm{FP}}$$; you can verify it substituting $$\mathbf{Pr} = \frac{\mathrm{P}}{\mathrm{P}+\mathrm{N}} = \frac{\mathrm{TP}+\mathrm{FN}}{\mathrm{TP}+\mathrm{FN}+\mathrm{TN}+\mathrm{FP}}$$).

This is because, with Bayes

$$P(D^+|T^+) = \frac{ P(T^+|D^+) P(D^+)}{ P(T^+) }$$

$$P(T^+|D^+)$$ is the Sensitivity $$\mathbf{Se}$$ because it is the probability of a positive test given the disease, i.e. $$\frac{\mathrm{TP}}{\mathrm{TP}+\mathrm{FN}}$$ (True Positive Rate, TPR, the $$y$$ axis in a ROC curve).

$$P(D^+)$$ is the prior probability of having the disease so $$P(D^+)=\mathbf{Pr}$$.

$$P(T^+)$$ is the overall probability of having a positive test, so $$P(T^+)=P(T^+|D^+)P(D^+)+P(T^+|D^-)P(D^-)$$. We already know that $$P(T^+|D^+)=\mathbf{Se}$$ and $$P(T^+|D^-)$$ is obviously $$1-\mathbf{Sp}$$ because it is the probability of a positive test given the absence of disease (False Positive Rate, FPR, i.e. the $$x$$ axis of a ROC curve). Finally $$P(D^-)=1-P(D^+)$$.

After the first positive test, Patrick has a prior probability $$P(D^+)=\mathbf{Pr}=0.165$$ so, calculating the PPV we obtain

$$\mathrm{PPV} = P(D^+|T^+) = \frac{.99 \cdot .165}{ .99 \cdot .165 + (1 - .95) (1 - .165) } = 0.795$$

You could solve it without figuring out the sensitivity and specificity of the repeated test. Just multiply pre-test odds 0.01/(1-0.01) with the squared likelihood ratio (19.6) you will get 3.88 as the post-test odds. The squaring of the likelihood ratio is due to doing two tests in succession. Then just convert odds to probability: P = 3.88/(1+3.88) = 0.795