---
title: "Bayes Theorem"
canonical: "https://modelassist.epixanalytics.com/space/EA/26574955/Bayes%20Theorem"
format: markdown
---
Bayes Theorem<sup>1</sup> is a logical extension of the conditional probability arguments we looked at in the [Venn diagram section](https://epixanalytics.atlassian.net/wiki/spaces/EA/pages/26574946/). We saw that:

  


![image](media://28b7bda5-2378-417e-bdd4-46f24e279cc7)

> Macro (mathinline)

and 

![image](media://5865e137-1c1e-41a3-997f-38662385e04a)

> Macro (mathinline)



  


Since 

![image](media://a19caf49-882c-4457-ab5b-fd06bbe7d6b9)

 > Macro (mathinline)

   :

  


![image](media://74871ab6-cb5b-43d7-bd15-546fdbe78ef8)

> Macro (mathblock)

  


Hence: 

![image](media://912aa95e-d6a1-47a2-b896-60c8168aac10)

 > Macro (mathinline)

which is Bayes Theorem

  


and, in general,

![image](media://b45ca831-e01b-4034-8ec6-cfcdd5313840)

  


> Macro (mathblock)

  


The following example illustrates the use of this equation. Many more are given in the section on [Bayesian inference](https://epixanalytics.atlassian.net/wiki/spaces/EA/pages/26575368/).

  


### ***Example***

Three machines *A*, *B* and *C* produce 20%, 45% and 35% respectively of a factory's wheel nuts output. 2%, 1% and 3% respectively of these machines outputs are defective.

  


a) What is the probability that any wheel nut randomly selected from the factory's stock will be defective? Let *X* be the event that the wheel nut is defective and *A*, *B*, and *C* be the events that the selected wheel nut came from machines A, B and C respectively:

  


*P(X)     = P(A). P(X/A)+P(B). P(X/B)+P(C). P(X/C)*

            = (0.2).(0.02)+(0.45.)(0.01)+(0.35).(0.03)

            = 0.019

  


b) What is the probability that a randomly selected wheel nut comes from machine *A* if it is defective?

  


From Bayes Theorem,

  


![image](media://7ff283ae-d5ec-424a-899b-e319f4f5c7b1)

> Macro (mathblock)

  


![image](media://3a2811a3-ad03-4f2f-819c-d66adb695f89)

> Macro (mathblock)

  


            

  


In other words, in Bayes Theorem we divide the probability of the required path (probability that it came from machine A and was defective) by the probability of all possible paths (probability that it came from any machine and was defective).

  


  


  


  


1Rev. Thomas Bayes (1702-1761) - English philosopher. A short biography and a reprint of his original paper describing Bayes Theorem appear in Press (1989).

  


---