Image by Matt Buck, under Attribution-ShareAlike 2.0 Generic.

**Note:** Snout (Reckless Endangerment) has made some good arguments in the comment to this post. The gist is that HIV/AIDS denialists overestimate the false positive rate by assuming that the initial test is all there is, when in fact, it is just the beginning of the diagnostic process. Snout also points out that it is probably wrong to say that most people who get tested have been involved in some high-risk behavior, as a lot of screening goes on among e. g. blood donors etc. I have made some changes (indicated by del or ins tags) in this post because I find myself convinced by the arguments Snout made.

There have already been several intuitive introductions to Bayes’ theorem posted online, so there is little point in writing another one. Instead, let us apply elementary medical statistics and Bayes’ theorem to HIV tests and explode some of the flawed myths that HIV/AIDS denialists spread in this area.

The article will be separated into three parts: (1) introductory medical statistics (e. g. specificity, sensitivity, Bayes’ theorem etc.), (2) applying Bayes’ theorem to HIV tests to find the posterior probability of HIV infection given a positive test result in certain scenarios and (3) debunking HIV/AIDS denialist myths about HIV tests by exposing their faulty assumptions about medical statistics. For those that already grasp the basics of medical statistics, jump to the second section.

**(1) Introductory medical statistics**

A medical test usually return a positive or a negative result (or sometimes inconclusive). Among the positive results, there are true positives and false positives. Among the negative results, there are true negatives and false negatives.

True positive: positive test result and have the disease.

False positive: positive test result and do not have the disease

True negative: negative test result and do not have the disease.

False negative: negative test result and have the disease.

For the purpose of this discussion, will indicate a positive test, will indicate a negative test, will indicate having HIV and will indicate not having HIV.

is the probability of an event A, say, the probability that a fair dice will land on three. Conditional probabilities, such as , represents the probability of event A, given that event B has occurred. If A and B are statistically independent events, then , if (because the definition of has in the denominator).

Let us define some conditional probabilities that are relevant for HIV tests and Bayes theorem:

is the probability of obtaining a positive result, given that the person has HIV. This is known as the sensitivity. It is a measure of how good the test is at identifying individuals with HIV. It is the number of true positives divided by the sum of true positives and false negatives. A test that has a high sensitivity is unlikely to miss any individuals with the disease, and therefore has a low rate of false negatives.

is the probability of obtaining a negative test result if you do not have HIV. It is know as the specificity. It is a measure of how the test is at identifying people who do not have HIV. It is the number of true negatives divided by the sum of the true negatives and false positives. A test with a high sensitivity is unlikely to wrongfully identify individuals without HIV as HIV+.

Only having a high sensitivity or specificity is not enough. Any crank test that always returned a positive test result would have a sensitivity of 1 or if it always returned a negative result, it would have the specificity of 1. A valid medical test has both a high sensitivity and a high specificity.

is the prior probability of having HIV. That is, how likely is it that a random person pulled from the population has HIV? This is usually taken to be the prevalence (population base rate). There are roughly 315 million people living in the U. S. and 1.2 million of them have HIV. So the prevalence is 1.2 / 315, which we can round off to 0.4% (CDC, 2012b).

is the posteriori probability, that is, how likely is it that a given person has HIV after we have taken into account the base rate and updated it with the available evidence (i.e. result of HIV test). The posteriori probability is also know as the positive predictive value. The calculate the positive predictive value, one only needs to know three values: the specificity, the sensitivity and the prior probability. The formula, known as Bayes’ theorem, looks like this:

The numerator represents the number of true positives, and the denominator represents the sum of the true positives and false positives.

is calculated by as you either have or do not have HIV. is the false positive rate and is determined by as a positive is either a true positive or a false one.

**(2) Applying Bayes’ theorem to HIV tests**

Let us look at the sensitivities and specificities (for HIV-1) of selected rapid HIV tests (CDC, 2008).

Name of Rapid HIV test | Sensitivity (%) [95% CI] | Specificity (%) [95% CI] |

OraQuick ADVANCE Rapid HIV-1/2 Antibody Test (oral fluid) | 99.3 [98.4-99.7] | 99.8 [99.6-99.9] |

Uni-Gold Recombigen HIV (Whole blood) | 100 [99.5-100] | 99.7 [99.0-100] |

Clearview COMPLETE HIV 1/2 (Serum & Plasma) | 99.7 [98.9-100] | 99.9 [99.6-100] |

95% CI refers to 95% confidence interval. A 95% confidence interval for sensitivity means that 95% of the time you take a sample and calculate the sensitivity, the confidence interval will include the fixed population parameter (the “real” sensitivity).

For the purposes of our calculations, let’s use the 0.99 figure for both sensitivity and specificity. For the prior probability, let’s use 0.004 (0.4%). The posterior probability (positive predictive value), then becomes:

So, in a random screen, the posterior probability (positive predictive value) of having HIV, given a positive test, is 28%. What can we make of this?

**(3) Debunking HIV/AIDS denialist myths about HIV tests**

So the general argument by HIV/AIDS denialists goes something like this: since the posterior probability, that is, P(HIV|+) is low to moderate, this means that HIV tests are inaccurate or unreliable. There are three general objections that can be made from science-based medicine and these are overlapping to a large extent.

1. Real HIV testing is not a random screen: the calculation made above assumes that you pull a random person from the overall population, and test him or her. But this is not how HIV tests are done in practice. Presumably, ~~most of~~ some individuals who go and get tested for HIV has been involved in some high-risk behavior, such as unprotected sex or intravenous drug use etc. This means that it ~~is~~ may be inappropriate to use the population prevalence as the prior probability. Instead, the prevalence in that risk group ~~should~~ could be used. That means that the posterior probability will increase, as the only change being made in the formula is an increased prior probability.

2. HIV/AIDS denialists commit the fallacy of transposed conditions. P(HIV|+) is not the same as P(+|HIV), which was the sensitivity. It is the latter, together with P(-|not-HIV), i.e. the specificity, that tells you anything about the accuracy (in this case validity) of the test, not P(HIV|+).

3. Low prior probability, not an intrinsic flaw of rapid HIV tests, is the main reason for why the posterior probability was low. Having a specificity and sensitivity of over 99% means that the test rarely gives any false positives or false negatives, so the tests have high validity.

4. HIV/AIDS denialists overestimate false positive rate of the entire procedure used to diagnose HIV by thinking that the initial screening is all that is required for a HIV diagnosis. In reality, it is just a first step. This argument was made by Snout (Reckless Endangerment).

If we carry out the calculation with a more appropriate prior probability, say, the probability of having HIV if you belong to a risk group, the results become quite different. Let us take the risk group of men who have had sex with men and have gotten an HIV test. The prevalence among those is 19% (CDC, 2012a). This is not the same as saying that the prevalence among men who have sex with men in the U. S. overall is 19% (), only among those who have gotten tested in the time period from which the results are from. Presumably, the prevalence among those who get tested are higher than the overall population. Anyways, using that prevalence, the positive predictive values becomes:

The take home message is that if you belong to a risk group, decide to go get tested and get a positive HIV test result, you are very likely to actually have HIV. The assumption of a random screen does not conform to reality that well. It is also worth pointing out that a positive HIV test is followed up with a western blot to make sure the positive result is a true positive. If there are any inconsistencies, doctors can perform a PCR test as well. Taken together, these three tests reach a certainty level as high as it can in practice get in medicine.

To be fair, I have not actually seen any HIV/AIDS denialist make the argument using Bayes’ theorem. In fact, I doubt that most HIV/AIDS denialists online are that familiar with medical statistics in the first place. Most of the time, they just pull the posterior probability from a random screen and present it triumphantly, as if it meant that rapid HIV tests are unreliable or inaccurate. It does not. Now you know why.

**References and further reading**

CDC. (2008). FDA-Approved Rapid HIV Antibody Screening Tests. Accessed: 2012-08-16.

CDC. (2012a). HIV among Gay and Bisexual Men. Accessed: 2012-08-16.

CDC. (2012b). HIV in the United States: At A Glance. Accessed: 2012-08-16.

Altman, D. G. (1999). Practical Statistics For Medical Researchers. New York: Chapman & Hall/CRC, p. 409-416.

Categories: Debunking HIV/AIDS Denialism, Debunking Misuse of Statistics, Science Explained

The denialist arguments I’ve seen seem to have a number of basic flaws, but the major one I see again and again is vastly overestimating the false positive rate of the completed diagnostic algorithm by assuming that a “positive” result of an initial screening test by itself constitutes a diagnosis of HIV infection. It doesn’t – it merely triggers the next stage of the diagnostic process. This occurs irrespective of whether the prior probability is high – yielding a reasonably high PPV for the screening test alone – or whether it’s low. The diagnostic algorithm only terminates with the screening test if the result is negative, because in general the negative predictive value of a screening test alone is sufficiently high, irrespective of “risk group” status. (There are individual exceptions here – for example tests conducted in a suspected window period or possible seroconversion, and you can also occasionally get false negative screening tests in very late stage AIDS as well – but these situations should be clinically evident to the diagnostician).

I’m not sure I agree with you that “most individuals who go and get tested for HIV have been involved in some high-risk behavior”. There has always been a lot of HIV screening among people perceived to be at low risk – blood donors, for example, or as a routine test for pregnant women. There’s also an increasing push to broaden routine screening particularly in North America, to try to find those undiagnosed individuals who don’t see themselves as particularly at risk. Because of this, I think it’s really important not to exaggerate the PPV of screening testing alone. For example, I don’t think you should ever give a screening result as “preliminary positive”, even if you think the prior probability is high: as soon as you utter the word “positive” people don’t hear anything else in the conversation and you can generate a lot of unnecessary anxiety. This is especially the case with the rapid tests, whose specificity is sometimes lower than lab-based screening tests like ELISA or chemoluminescent assays.

Ultimately, the purpose of a diagnostic testing process is to end up with a final result of an acceptably high positive or negative predictive value. Because of the implications of an HIV diagnosis, this means “beyond any reasonable doubt”. The main point of applying of Bayes Theorem to individual tests is to inform the sequence of the diagnostic elements required to get an end result of that degree of reliability, irrespective of the perceived prior probability – which in reality can only be very broadly estimated for any given individual case.

Hey Snout, I am a big fan of your work.

I suspect you are right.

I made a note at the top of the post, changed the phrasing of the argument regarding what prior p is appropriate, and adding in your core argument (with attribution).

Thanks.

At the end of section (1), in the analysis of Bayes’ formula, the assertion “P(+|nonHIV) is the false positive rate and is determined by 1-P(+|HIV) as a positive is either a true positive or a false one” is false. We should read “P(+|nonHIV) is the false positive rate and is determined by 1-P(-|nonHIV)…”. Which makes the alleged link to the specificity.

Actually, you can calculate the false positive rate either by subtracting away true positives from the sum of true and false positives (i.e. the sum of all positive results) or by subtracting away true negatives from the sum of false positives or true negatives (i.e. the sum of all non-HIV cases).

Draw up a 2×2 table over HIV/non-HIV and +/- test results and you will see.

I made further calculations using specified figures for sensitivity and specificity (as shown in the table section (2)) and I found the following :

OraQuick(Sens=0.993, Spec=0.998) gives P(HIV|+)=67%

Uni-Gold(Sens=1, Spec=0.997) gives P(HIV|+)=57%

Clearview(Sens=99.7, Spec=0.999) gives P(HIV|+)=80%.

Those are far better than the 28% using a non justified Sens=Spec=0.99 assumption. Isn’t it?

If you use different values, then of course you will get a different posterior probability.

Using sensitivity = specificity = 0.99 makes sure that the posterior from all the actual tests listed will be higher. I would have used 0.993 and still fulfilled that condition, but I decided that two significant figures were enough for the purpose of this demonstration. So contrary to your position, I am justified in using those values.

1) I do appreciate the main idea of your blog and the attempt to oppose denialists. And denialists can be found in a broad range : I even heard the distinguished mathematics professor Serge Lang denying the mere existence of AIDS in a conference!

2) It is not the figures that are significant, it is the argument. There is a FLAW in your argument because what you say amounts to “P(A|nonB)=1-P(A|B)” which is FALSE in general! I humbly suggested to replace it by “P(A|nonB)=1-P(nonA|nonB)”. Your assumption Sens=Spec=0.99 made the error unnoticeable.

3) I stumbled on your blog while searching examples (for my college course) of misuse of Bayes’ formula by practitioners. I find it ironic that an author that denounces misuse of Bayes’ formula falls into this category.

Best regards.

That is an assertion, not an argument. Perhaps you confuse the two.

I have already explained to you that you can calculate the false positive rate either by subtracting away true positives from the sum of true and false positives (i.e. the sum of all positive results) or by subtracting away true negatives from the sum of false positives or true negatives (i.e. the sum of all non-HIV cases).

Draw up the 2×2 table for yourself if you do not believe me.

Simplified: a positive result is either a true positive or a false positive. There are no third option (inconclusive is neglected in this simple example).

I may of course be wrong here, but you need to make an actual argument, or reference a credible source if you are interested in convincing me. Assertions simply will not do.

I hope to settle this once and for all!

The Bayes’ formula is correctly stated in your text :

P(HIV|+)=[P(+|HIV)xP(HIV)]/[P(+|HIV)xP(HIV)+P(+|nonHIV)xP(nonHIV)]

in terms of Positive predictive value (PPV), Sensitivity (Sn), Specificity (Sp) and Prevalence (Pr) it translates to

PPV=[Sn x Pr]/[Sn x Pr + (1-Sp) x (1 – Pr)].

In particular : P(+|nonHIV) = 1-P(-|nonHIV)=(1-Sp) and NOT “P(+|nonHIV) […] is determined by 1-P(+|HIV) as a positive is either a true positive or a false one” as you say. A true positive is P(+ AND HIV), not P(+|HIV)!

Your error went unnoticed because you’ve made a copy and paste of the DRUG example (and the nice picture in the beginning of your article) from Wikipedia (http://en.wikipedia.org/wiki/Bayes'_theorem). This (poor) example is misleading due to the coincidental figures (Sn=Spec=0.99).

So, as posted on your blog, the computed numerical value of the PPV is right but the formula you’ve used is wrong! If you compute the PPV of each test one by one (where SnSp) in the way you do, you’ll be mistaken.

I have no more to say, good luck.

Your assertion that I copy/pasted the example from Wikipedia is false. It is from Frigyesi (2009), not Wikipedia.

You keep repeating the assertion that I am wrong, but an assertion is not an argument. I urge you to draw up the 2×2 table yourself. Then you will see that calculate the false positive rate either by subtracting away true positives from the sum of true and false positives (i.e. the sum of all positive results) or by subtracting away true negatives from the sum of false positives or true negatives (i.e. the sum of all non-HIV cases).