Baye’s theorem

Hello there!

More than 6 months from last post, for a good reason. We had our third kid and now, time is more than ever a scarce resource. So, let’s stop talking and go direct to the point!

Today I’ll explain a little about Baye’s theorem and why it’s important to know it.  Baye’s theorem is named after, Thomas Bayes an English statistician. This theorem is a solution to solve a problem of inverse conditional probability. I’ll give you an example to have a better understanding:

Suppose that we have two dices, an ordinary dice and one loaded. The ordinary dice has 1/6 or 17% of chance to face any of the six numbers. On the other hand, the loaded dice has 50% chance to face number six and 50% to face any other number. Now, we do the following experiment. Both dices are in a black box and you pick one and roll it. It faces number six. The question is:

1) Knowing that the chances to get the loaded dice or the ordinary dice is 50%, what is the probability that you took the loaded dice?

This is an inverse conditional probability problem. Why? Because, we already know the result of the dice, we have two events related (dice face + dice loaded/ordinary) and we want to know the probability of what happened before (which dice has been chosen). How do we do that? Baye’s theorem is:

 

bayes

 

 

 

First, in order to get things clear, we can say:

P(A) – Probability to choose loaded dice

P(B) –  Probability dice faces number six

P(B|A) – Probability dices faces number six given the dice is loaded

P(A|B) – Probability to choose loaded dice given dice faces number six

Solving this problem now is easy:

Probability to dice faces six given dice is loaded: 50% =>P(B|A) = 0.5

Probability to choose loaded dice: 50% => P(A) = 0.5

Probability dice faces six. It can be the loaded dice (50%) OR ordinary dice (1/6 = 17%) => P(B) = 0.5 x 0.5 + 0.17 x 0.5 => P(B) = 0.34

P(A|B) = 0.74

It means that we have about 74% chance that we chose the loaded dice. It makes sense since if both dices were ordinary (no loaded dice), we should have 50% of chance to pick one or another. Since we have a loaded dice and after rolling the dice it faced six, the probability to have chosen the loaded dice is more than 50%. In opposite, if after rolling the dice we get another number, this probability will be less than 50%.

Briefly, Baye’s theorem states that a probability of an hypothesis may be affected by evidences. In our case  the hypothesis is “loaded dice chose” and evidence “dice faces six”.  As discussed before the fact that we had a six or not changes the probability of our hypothesis.

Bye

Marcelo

Marcelo Jo

Marcelo Jo is an electronics engineer with 10+ years of experience in embedded system, postgraduate in computer networks and masters student in computer vision at Université Laval in Canada. He shares his knowledge in this blog when he is not enjoying his wonderful family – wife and 3 kids. Live couldn’t be better.

LinkedIn 

One Response to 'Baye’s theorem'

  1. rupesh yadav says:

    nicely explained

Leave a Reply

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

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.