It’s Valentine’s Day! Time to review Bayes Theorem.


Figure 1

Figure 1

It’s Valentine’s Day! Time to review your knowledge of Bayes Theorem. Here’s a fun exercise to do: Calculate the probability that a gay man is HIV-negative, given that he tells you he’s HIV-negative.


First, let’s define our terms.

h: Does not have HIV
~h: Does have HIV
e: Says he does not have HIV
~e: Says he does have HIV


So let’s imagine that you’re a gay man, and you’re going to hook up with a guy for Valentine’s Day. You might be interested in calculating the following: P(h|e)

This expression, P(h|e) represents the probability that a gay man does not have HIV given that he says he does not have HIV.


The base rate of HIV infection among gay men who have sex with men is 19%.1

Hence: P(~h) = 0.19; or P(h) = 0.81

See Figure 1 for a graphical representation. The entire square represents all gay men who have sex with men. The blue rectangle takes up 81% of the square, which is proportional to the CDC’s best estimate for the number of gay men who are actually HIV-negative.

From the same source, we can also determine that the probability that a person says he does not have HIV given that he does have HIV to be 44%.1

Hence: P(e|~h) = 0.44

In Figure 1, this is represented by the green rectangle. Given that a person is HIV-positive, there’s a 44% that they don’t know, and so they would likely say that they are “negative.”

The remainder, the yellow rectangle, is the proportion of gay men who are HIV-positive and who know that they are HIV-positive.


I am considering only the population of gay men who have sex with men.

Built into this is the assumption that men who have HIV and don’t know it would report themselves as HIV-negative, or that there wouldn’t be anyone who just says “I don’t know.”

I am also assuming here that 100% of gay men who don’t have HIV will say that they don’t have HIV. Put another way, there is a 0% chance that someone will say he has HIV if, in fact he does not have HIV. This is a simplification, It’s possible that someone is confused about his status, but very unlikely. Hence:

P(e|h) = 1; or P(~e|h) = 0

Bayes Theorem

To calculate our desired value, P(h|e), we should use Bayes Theorem.

P(h|e) = P(h) / ( P(h) + P(e|~h) * P(~h) / P(e|h) )

P(h|e) = 0.81 / ( 0.81 + 0.44 * 0.19 / 1 )

P(h|e) = 0.81 / ( 0.81 + 0.44 * 0.19 )

P(h|e) = 0.91

To illustrate this graphically, in Figure 1, this would represent the chance of your prospective hook-up being in the blue area, given that the only thing you know about him is that he’s either in the blue area or the green area.


Your risk of HIV exposure can be informed by your prospective sexual partner’s response to whether or not he is HIV-negative.

If a person tells you that he’s HIV-positive, he knows his status. No one goes around claiming to be HIV-positive unless they’ve been tested and got a positive result. The best evidence we have indicates that HIV-positive people with an undetectable viral load do not transmit HIV.2 So with a sexual partner who’s HIV-positive, you’re not getting any surprises.

If you don’t even ask about your prospective sex partner’s HIV status, you can be 81% certain that he’s HIV-negative, just because of the base rate of HIV prevalence. If you do ask and he tells you that he’s negative, that is a useful piece of information—it allows you to update your estimation of the probability that your prospective sexual partner is HIV-negative to 91%, but there’s still about a 1 in 10 chance that he’s HIV-positive, has no idea, and is not being treated for it.

Happy Valentine’s Day everyone!


  2. Attia S et al. Sexual transmission of HIV according to viral load and antiretroviral therapy: systematic review and meta-analysis. AIDS. 23(11): 1397–1404, 2009.


    title = {It’s Valentine’s Day! Time to review Bayes Theorem.},
    journaltitle = {The Grey Literature},
    author = {Benjamin Gregory Carlisle},
    address = {Montreal, Canada},
    date = 2016-02-14,
    url = {}


Carlisle, Benjamin Gregory. "It’s Valentine’s Day! Time to review Bayes Theorem." Web blog post. The Grey Literature. 14 Feb 2016. Web. 20 Feb 2017. <>


Carlisle, Benjamin Gregory. (2016, Feb 14). It’s Valentine’s Day! Time to review Bayes Theorem. [Web log post]. Retrieved from

Leave a Reply

Your email address will not be published. Required fields are marked *


A word from our sponsors

Tag bag

Recent comments

Old posts

All content © Benjamin Carlisle