Bayes Theorem Explained (Bayes Rule Formula)

Johnny Burns
4 min readFeb 7, 2020

--

What is “conditional probability”?

Let’s back up a second and talk about “The 1%”

They say that 1% of the US population controls 99% of the US wealth.

What are the chances of being part of the 1%?

For any given person, the chances that the person is part of the 1% is well… 1%.

Studies have shown that only ¼ of the 1% is female.

This means that the chances that a person is both female AND in The 1% is:

¼ of 1%

or

.25 * .01 = .0025

When you think about the logic behind this formula, it makes sense:

If that makes sense, the following should also make sense:

That middle term is very interesting. We’d like to know the chances of being in the 1% IF you are female.

Luckily, we already know the other two terms

chances of being female = 0.5 (half the population)
chances of being female AND in the 1% = .0025

Plugging those into the equation, we can solve for “x” (chances of being in the 1% IF you are female):

In other words, if you are female, you have just a 0.5% chance of being in the 1%.

“Bayes Rule” is just a formalization of the logic we followed above.

Let’s go back to this formula we had:

The term .0025 was calculated by multiplying .01 * .25, let’s put that back instead of the .0025

Now let’s think logically about what each of these terms represents:

0.25 — This is the chances of being female IF you’re in the 1%
0.01 — This is the overall chances of being in the 1%
0.5 — This is the chances of being female

Let’s replace all these terms with their logical representations.

This logic can be generalized, so that it can be applied more broadly.

Mathematicians like to use the term “given” instead of “if”. Mathematically, the formula is usually stated like so.

photo credit Wikimedia

“P” just means “probability”.
“|” means “given”.

So P(A|B) means “probability of A, given B”

In our previous example, “A” represented being in the 1%, and “B” represented being female. We can use this same formula to discover the chances that you are in the 1% IF you are male:

Let’s break down each of the numbers:

0.1 — The probability of being in the 1%
0.75 — The probability of being male, given you’re in the 1%
0.5 — The probability of being male

This calculation comes out to be 0.015

So, as a female, you only have a 0.5% chance of being in the 1%
As a male, your chances at 3x higher (1.5%)

How can you help?

Consider helping women find high paying tech jobs by making a donation to Girls who Code.

About the Author

I’m Johnny Burns, founder of FlyteHub.org, a repository of free open-source workflows to perform Machine Learning with no coding. I believe that collaborating on AI will lead to better products.

--

--