In this article, I will explain Bayes’ Theorem, which is the core of the Bayesian statistics, with a simple example.
First, the theorem is given as:
And here is the situation:
Suppose two companies, A and B, manufacture 4.6L SOHC V-6 engines that go into a Mustang. Ford bought 5000 engines from those two companies, and
- 9 out of 1000 engines from company A were defective.
- 25 out of 4000 engines from company B were defective.
Now, the question is:
What is the probability that a defective engine came from company B?
Define some variables we need:
- A = the engine came from company A
- B = the engine came from company B
- D = the engine is defective
Let’s write down the original question in a bit more formal way. What is the probability of B given D? In other words, what is the probability that the engine came from company B given it is defective?
Here is the conditional probability of getting a defective engine from company A:
Likewise, the conditional probability of getting a defective engine from company B is:
The prior probability of an engine coming from company A is:
Similarly for B:
|Now we have what we need to calculate $P(B||D)$.|
So, when Ford finds a defective engine, it’s most likely coming from company B.