+34 616 71 29 85 carsten@dataz4s.com

Bayes’ Theorem

What’s the probability of something, given something else? This is a Baysian question. Bayes’ Theorem provides a way of how to calculate a conditional probability.


John’s flue-probabilities

What is the probability of John having the flue? He works in a company of 50 employees of which 30 are females and 20 are males. Initially, we are told that one of the staffs has the flue, so John has a 1/50 probability of being the one with the flue.

Now, we are given a new information. We are told that the one having the flue is a male. What is now the probability that it is John who has the flue? We see that the probability of being John who has the flue has increased to 1/20 from the previous 1/50. The sample space has been reduced from 50 to 20.


Bayes’ Theorem formula

Bayes’ Theorem gives a formula that helps calculating these conditional probabilities. Let’s use it for this simple case:

Bayes' Theorem

Let’s use the Bayes Theorem formula in the following example:


Hprobabilitis example

One morning I feel bad. I have a headache and a runny nose, so I start Googling in the search of some exotic illness that matches my symptoms. I find it! My illness is called Hprobabilitis and is probably the most hypothetic illness ever heard of.

I get frustrated thinking that I know that I have Hprobabilitis, and even more as I further read that the probability of having just the symptoms that I have, given that I have the illness, is 95%. Really, what this says is:

“If you have this illness you are most likely to have the symptoms”.


This seems realistic to me and a hypothetic and hypocritic panic is creeping up on me.

I further read that Hprobabilitis is outmost rare and that only 1 in 100,000 has it and that the probability of having the symptoms that I have, is ‘pretty normal’. It is one in a hundred: 0.01.

I start defining:

  • P(H) = The probability that I have Hprobabilitis = 0.00001
  • P(S|H) = The probability of having my symptoms given that I have Hprobabilitis: 0.95
  • P(S) = The probability of having these symptoms = 0.01

Plugging these data into the Bayes’ Theorem formula:

Bayes' Theorem


My risk of having Hprobabilitis is less than 0.001%.


Learning resources on Bayes’ Theorem

Thanks Ian Olasov  for your khanacademy video: Bayes Theorem. The two examples above are inspired on your video. Ian Olasov’s Linkedin profile.


Submit a Comment

+34 616 71 29 85

Call me

Spain: Ctra. 404, km 2, 29100 Coín, Malaga


Denmark: c/o Musvitvej 4, 3660 Stenløse

Drop me a line

What are you working on just now? Can I help you, and can you help me? 

About me

Learning statistics. Doing statistics. Freelance since 2005. Dane. Living in Spain. With my Spanish wife and two children. 

What they say

20 years in sales, analysis, journalism and startups. See what my customers and partners say about me.