after seen this example, I've a doubt. Is the probability of be diagnosed HIV positive given the positive ELISA reading dependent of the incidence rate (p)? Why should it be?

$$P(\text{HIV positive }| \text{ positive ELISA reading}) = \frac{p\times.977} {p\times.977 + (1-p)\times.074}$$

p <- c(.003, .005, .01, .05, .10, .2, .3, .4 , .5)
prob <- p*.977 / (p*.977 + (1-p)*.074)


          p  prob
 [1,] 0.003 0.038
 [2,] 0.005 0.062
 [3,] 0.010 0.118
 [4,] 0.050 0.410
 [5,] 0.100 0.595
 [6,] 0.200 0.767
 [7,] 0.300 0.850
 [8,] 0.400 0.898
 [9,] 0.500 0.930

2 Answers 2


If I'm interpreting your question correctly, then yes, the probability of actually having HIV given that you have a getting a positive ELISA test for HIV is dependent on the incidence rate of HIV within the population.

This happens because of false negatives and false positives. No test is perfect, and sometimes it will say you are negative when you are in fact positive, while other times it will say you are positive when you are in fact negative.

If the Elisa Test shows up positive, there are two ways for that to happen - either you are positive (probability $p$) and the test is accurate (probability $.977$ in your example), or you are negative (probability $1-p$) and the test gives a false positive (probability $1-.926=.074$ in your example).

So $P(\text{positive ELISA}) = .977p + .074(1-p)$.

If $p$ is really small, then it's much more likely that you got a false positive (assuming you were randomly selected for the test). As $p$ gets larger, then it becomes more likely that you do have the disease and the test result is accurate.

Here's a thought experiment to help you understand. Take 100 slips of paper and mark an $x$ on one of them to indicate a person with a disease. Get a coin to simulate a test with a 50% accuracy rate (50% of the time it will show heads, indicating presence of disease, 50% of the time it will show tails, indicating no disease). Now, randomly select one of the slips of paper and flip the coin. If a heads comes up, what is more likely - that I picked the one paper with $x$ on it and the test was accurate or I picked one of the 99 papers without an $x$ and the test was inaccurate?

Do the same but with 99 papers with $x$ on them and 1 without.

As a side note, this is part of why doctors generally don't just indiscriminately have their patients take HIV tests (or tests for other rare diseases). It is much more likely that a random patient would not have the disease and get a false positive than have the disease and get a true positive. Doctors first identify a patient as "high risk" and therefore much more likely to have the disease in question, and THEN they have them take the test.



The probability of being a true positive given a true test is known as the "Positive Predictive Value" (PPV). The formula you provided above is a specific form of the more general formula for PPV:

$$PPV= \frac{prevalence\times sensitivity} {prevalence\times sensitivity + (1-prevalence)\times(1-specificity)}$$

Essentially, the lower the prevalence of disease, the more likely any given positive test is a false positive. I find the easiest way to conceptualize this is to think about the extremes - if there is only one person infected with a disease in the entire world, there will be a huge number of false positive tests, so the probability of any given positive test meaning your infected will be quite small. Similarly, if nearly everyone is infected, a positive test is extremely indicative of actual infection.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.