home
Learn what Bayes' Theorem is and its main calculations!

Learn what Bayes' Theorem is and its main calculations!

See what Bayes' Theorem is, how it works, its main calculations and see in practice what its results will be!

by Thiago Coutinho

Published on July 11, 2018

Updated on October 14, 2021

Share

Bayes' Theorem is of great relevance within the world of mathematics, and relates several concepts involving probability, one of the most used methods for analysis and quantification.

Let's learn a little more about Bayes' Theorem and its applications in probability, proving its importance and directions.

It is quite common for scholars to attempt to describe a particular phenomenon by studying the probability of occurrence of an event associated with it.

After all, this is exactly what happens when in a Six Sigma project we study a process and try to estimate the probability of occurrence of a certain type of defect.

But do you know what a statistical distribution is? What is it for or how do you use it? Do you also know what the Bayes Theorem is?

Beginning to answer such questions, Bayes' Theorem is nothing more than a kind of statistical probability. It was developed by the Protestant pastor and English mathematician Thomas Bayes in the eighteenth century.

To find the answers to the other questions expressed here and other curiosities, do not forget to read this post.

In order for you to stay even more on top of the main news about Bayes' Theorem, we have separated in this article several contents of great relevance on the subject and its information. Check it out!

  • What is Bayes' Theory?
  • How to calculate Bayes' Theorem?
  • Examples of Bayes' Theorem
  • The famous problem of Monty Hall
  • Do you want to learn more about Lean Six Sigma?

Ready to get started?

What is Bayes' Theorem?

The Bayes Theorem is a mathematical formula used to calculate the probability of an event given that another event has already occurred, which is called conditional probability.

The big question of Bayes' Theorem is that you need to have some previous information, i.e. you need to know that a certain event has already occurred and what the probability of that event is.

It is based on this Bayesian inference that the expression "degree of belief" arises, which is that confidence in some earlier event, this initial assumption.

If you still don't understand, stay calm, with some practical examples I'm sure it will be simpler.

Lean Six Sigma is a methodology that seeks to increase the profitability of companies through the improvement of their processes.

Thinking about you and your career, we, at Think Lean Six Sigma, created a FREE Yellow Belt training in Lean Six Sigma.In this training, we will introduce you to the DMAIC method and all its 5 steps, namely: "Define, Measure, Analyze, Improve and Control.

With this course, you will be able to develop small improvement projects within your area of expertise and work with Green Belts and Black Belts in support of the Lean Six Sigma program.

Have you ever thought about being the agent of change within your organization? Click on the image below for more information and become a Yellow Belt, for FREE!

Yellow Belt in Lean Six Sigma

How to calculate the Bayes Theorem?

For the calculation of the probability of an event A given that an event B occurred,

"P (A | B)", by Bayes' Theorem we have:

First Example


That is, we need some data, which are:

  • P (B | A): probability of B occurring since A occurred
  • P (A): probability of A occurring
  • P (B): probability of B occurring

To clarify more, nothing better than an example, does not it?

Examples of Bayes' Theorem

To understand a little more about Bayes' Theorem and its applications in probability it is necessary to make the process visual, so that its applications are effective.

Therefore, let's check out some examples of Bayes' Theorem and how its calculation can be performed for the solution of everyday problems that involve the probability of events occurring, for example.

Example 1

Imagine that a couple has two children. How likely are the two kids to be boys since one of them is a boy?

To calculate this probability, we need to define some events and probabilities events are:

  • A: two sons boys (desired event)
  • B: one of the children is a boy

Define the events, let's define some of the probabilities that we need for the calculation:

  • P (A): probability that the two sons are boys
  • P (B): probability that a child is a boy

With simple calculations, we come to the conclusion that the probability that two children are boys is 1/4. Assuming that the probability that a child is a boy is 1/2, then the probability that at least one of the children of the couple is a boy is 3/4.

We can also conclude that P (B | A), that is, the probability that one of the children is a boy since the two are boys is 1.

Thus, we have:

  • P (A) = 1/4
  • P (B) = 3/4
  • P (B | A) = 1

Then, applying the Bayes' Theorem:

How to calculate


So, did you get the hang of it? That was a very simple example, right? Let's get one more complete.

Example 2

Before beginning this example, you need to be aware of one thing: tests are not 100% accurate, so they can't describe the actual events to perfection.

One of the applications of Bayes' Theorem is the solution to this problem of interpretation of the result of a positivity test on a disease. Understood that, let's return to the example.

Imagine that the mammogram test behaves as follows:

  • 1% of women have breast cancer (so 99% do not)
  • 80% of mammograms detect cancer when it exists (therefore, 20% fail)
  • 9.6% of Mammograms detect cancer when it does not exist (so 90.4% correctly return a negative result)

Putting this into a table, we have:

Second example


How to read this table?

  • 1% of women have breast cancer, so 99% do not have
  • Who has cancer is in the second column and there is 80% chance that you will test positive and 20% that you will test negative.
  • Who does not have cancer is in the third column and there is a 9.6% chance that you will test positive and 90.4% that you will test negative.

Given all this information, imagine that you underwent the mammogram test and that test showed a positive result. What are the chances of actually getting cancer given the positive test?

Let's Calculate:

If the test was positive, you are at the top of the table. Let's focus on that line then. If you look carelessly, you're sure to find that your life is over but calm, Bayes' Theorem can help you with that.

Now, we need to establish the data:

  • P (A | B) = probability of having cancer (A) given that the test was positive (B).
  • P (B | A) = probability of positive test (B) since it has cancer (A). This is the chance of a true positive, which is 80%.
  • P (A) = probability of having cancer (1%).
  • P (AC) = probability of not having cancer (99%), represented by AC (complementary to A, that is, "not A").
  • P (B | AC) = probability of positive test (B) since it does not have cancer (AC), which is 9.6% in this case.

Let's take a look at the formula:

Formula to calculate


How would we do to find P (B) (probability of any positive test)? Well, that's exactly why we need information about all the possibilities of a positive test.

A test can be positive whether the woman has cancer or not. These possibilities are exactly P (B | A) and P (B | AC). Thus, we have that P (B) is equal to:

Formula to calculate


So our formula looks like this:

Formula to calculate


To make calculations easier, you can use a scientific calculator, although you can do this with any calculator. Replacing the numbers, we are left with:

Formula to calculate

Formula to calculate


That is the probability of having breast cancer given that the mammogram was positive is only 7.8%. This value, which may seem contrary to your intuition, is obtained by calculating all the possibilities of a positive test.

The big question is the weight that the proportion of people who do not have cancer make in the formula. The fact that for every 100 people only 1 has the disease makes all the difference.

With this example, the importance and explanation of Bayes' Theorem in conditional probabilities became clearer, right? The understanding that two independent events, when considered as conditioned, will give us a new vision of the chances of occurrence of these events.

The famous problem of Monty Hall

One of the applications of the Bayes Theorem is in the famous problem of Monty Hall. This problem, or paradox, controversial and counter-intuitive, reflects this change of probabilities based on a degree of belief.

What is this problem? Well, this is the famous door game, common in many game shows, in which the guest has to choose 1 of 3 doors because it contains a prize. As soon as you choose, another door opens revealing that it is empty, and then you are asked if you want to switch doors.

The degree of belief assumed is that the show host knows exactly where the prize is. So, regardless of whether you chose the right door first, it will open a door that is empty and ask you if you want to change.

From this information given, that the presenter knows where the prize is, should you change the door or not? I'll give you the answer: yes, changing the door doubles your chances of winning the prize. Maybe you're shocked now, but calm, the math assumes right now.

Let's suppose you choose Door number 1. The presenter opens Door number 2, which is empty. Remember that he knows where the prize is. He then asks you if you want to change the door.

Let's go to the data:

When you choose door number 1, you have a 1/3 chance to win, because we have 3 doors, with only one containing the prize. So what happens to your chances when the presenter opens an empty door? They stay the same. But why?

Defining events:

  • A = the chosen door (# 1) has the prize
  • B = the presenter opens an empty door

So, let's start with the Bayes Theorem:

The famous problem of Monty Hall


We know that P (A) = 1/3. To calculate P (B), we need to cover all possibilities for the presenter to open an empty port. That is, what are the chances that the presenter will open an empty door, whether or not you have chosen the right door.

Thus,

Formula to calculate


we define the probabilities:

  • P (A) = probability of the premium is on door number 1.
  • P (B | A) = probability of the presenter choosing an empty door since the premium is on door number 1.
  • P (B | AC) = probability that the presenter will choose an empty door since the prize is NOT on door number 1.
  • P (AC) = probability the prize is NOT on door number 1.

We can state that the probability of the presenter opening an empty door (the premium being or not at door number 1) is 1, i.e. P (B | A) = P (B | AC) = 1. Why? Because this information was previously given, that is, the presenter will always choose an empty one, because he knows behind which door the prize is.

As for P (AC), we have a 2/3 probability, because this is the chance we miss the door in the first choice. So if you keep your choice on the first door, you have a probability of:

Formula to calculate


That is, if you do not change the door, your chance to win remains 1/3, while if you change, you double your chances to 2/3. This does not guarantee that you will win the prize, as it may happen that you have hit first, but most of the time, the prize will be behind the other door.

A simple way to verify this is through a table. Assuming you have chosen door number 1, we have the following possibilities:

Verification table


Remembering that the presenter will open an empty door when you change the door, you win 2 out of 3 times. Got it now? Although it sounds strange and not intuitive, you may soon notice that based on the information that the presenter knows where the prize is, switching is the best option.

Do you want learn more about Lean Six Sigma?

How about enjoying now completely free content that Think Lean Six Sigma has prepared for you? unlock the main myths about Lean Six Sigma methodology with the Lean Six Sigma Ultimate Guide Ebook!

Download now and understand how to become a Lean Six Sigma professional applying the most used methodology in world-class industries.

Deepen your knowledge of the Lean Six Sigma methodology and train yourself now to become a better professional.

Click on the image down below to free download the ebook!

Lean Six Sigma Ultimate Guide

bayes-theorem

Statistic

Conditional Probability

Bayes's theorem

Thiago Coutinho