First lets define some useful terms:

Let $F$ be the event that the patient has the illness

Let $E$ be the event that the test result is positive

$P(F|E)$ = probability of the illness given a positive test. This is the number we want to calculate.

$P(E|F)$ = probability of a positive result given illness =

$P(E|F^c)$ = probability of a positive result given no illness =

$P(F)$ = natural probability of the illness =

## Bayes Theorem

In this problem we know $P(F|E)$ but we want to know $P(E|F)$. We can apply Bayes Theorem to turn our knowledge of one conditional into knowledge of the reverse.

$P(F|E) = \frac{P(E|F)P(F)}{P(E|F)P(F) + P(E|F^c)P(F^c)}$

Now all we need to do is plug values into this formula. The only value we don't explicitly have is $P(F^c)$. But we can simply calculate it since $P(F^c) = 1 - P(F)$. Thus:

## Natural Frequency Intuition

One way to build intuition for Bayes Theorem is to think about "natural frequences". Imagine we have 1000 people. Let's think about how many of those have the illness and test positive and how many don't have the illness and test positive.

We are going to color people who **have the illness** in blue and those **without the illness** in pink (those colors do not imply gender!).

$1000 \times P(F)$ people have the illness

$1000 \times (1- P(F))$ people do not have the illness.

A certain number of people **with the illness will test positive** (which we will draw in Dark Blue) and a certain number of people **without the illness will test positive** (which we will draw in Dark Pink):

$1000 \times P(F) \times P(E|F)$ people have the illness and test positive

$1000 \times P(F^c) \times P(E|F^c)$ people do not have the illness and test positive.

Here is the whole population of 1000 people:

The number of people who test positive and have the illness is ?.

The number of people who test positive and don't have the illness is ?.

The total number of people who test positive is ?.

Out of the people who test positive, the fraction that have the illness is ?/? = ? which is a close approximation of the answer. If instead of using 1000 imaginary people, we had used more, the approximation would have been even closer to the actual answer (which we calculated using Bayes Theorem).