Mathematics

Bayes’ Rule Explained

You wake up one morning and feel something isn’t right. Your head hurts. You’re aware that recently there’s this virus on the loose that’s causing people to lose their minds and you worry that you might be infected. This disease is aptly named Mindlostisis and no cure exists. So you rush to the nearest hospital and get yourself tested. Test comes positive. Doctor tells you 90% of people who have Mindlostisis test positive. Should you be worried?

No, not yet. Because what if 90% of people who don’t have Mindlostisis also test positive? The doctor has given you a number that you don’t care about, namely the probability of testing positive if you have the disease. Instead, what you really want to know is the probability of having the disease if you test positive. I’ll now introduce some notation that will make talking about probabilities easier.

P(T) = Probability of the test coming positive.
P(M) = Probability of having Mindlostisis.
P(T|M) = Probability of a positive test given that you have Mindlostisis.
P(M|T) = Probability of having Mindlostisis given that the test comes positive.

Rephrasing what’s been said earlier, the doctor gave you P(T|M) when it’s P(M|T) that you’re really interested in. And this is where Bayes’ Rule comes in:

\boxed{ \hspace*{5pt} P(M|T)={\dfrac{{P(T|M) \times P(M)}} {P(T)}} \hspace*{5pt}}.

This equation is far from obvious so let’s try and understand it using a Venn diagram.
Bayes' Rule Explained

U = Set of all people in the city.
X = Set of all people that test positive.
Y = Set of all people that have Mindlostisis.
A = Set of all people that have Mindlostisis and test positive.
Y-A = Set of all people that have Mindlostisis but do not test positive.

Additionally, total number of people in any set is denoted in lowercase. For example, total number of people in X is x. Using above-established notation and Venn diagram, it’s evident that P(T|M), which is 90% as the doctor said, equals:

\boxed{ \hspace*{5pt} {P(T|M) = \dfrac{a}{y}} = 0.9\hspace*{5pt}}.

What you want to know is P(M|T), which is the ratio of number of people in A and number of people in X:

\boxed{ \hspace*{5pt} {P(M|T) = \dfrac{a}{x}}\hspace*{5pt}}.

In order to calculate P(M|T), we do need P(T|M) but that’s not enough. Something more is required, and let that something be s.

P(M|T) = P(T|M) \times s \\  \\ \Rightarrow s = \dfrac{P(M|T)}{P(T|M)} = \dfrac{a}{x} \times \dfrac{y}{a} = \dfrac {y}{x} = \dfrac {y}{u} \times \dfrac {u}{x} = \dfrac{P(M)}{P(T)}.

Putting it all together we get:

\boxed{ \hspace*{5pt} P(M|T)={\dfrac{{P(T|M) \times P(M)}} {P(T)}} \hspace*{5pt}}.

Clearly, to be able to tell your chances of having the disease given a positive test, you not only need to know what the doctor said, but also: (P(M) / P(T)).

Discussion

Comments disabled.