Saturday, February 21, 2009

Bayes Theorem

Bayes theorem is an extension of the theorem of total probability.

Again, we are in a situation where all events in a sample space are mutually exclusive and exhaustive, but this time we want to find conditional probability as opposed to just probability.

We can do this with Bayes theorem which states that the conditional probability of any event (Ei) is

P(Ei,F) = (P(F,Ei)*P(Ei))/(The theorem of total probability)

Recall the theorem of total probability is:
P(F) = P(F and E1) + (F and E2) + (F and E3) + ...(as many as it takes to get "total" probability. "and" in the formula can me taken to mean multiplication or times.)

So in other words we are taking the product of the conditional probability of the outcome, with the probability of the outcome and dividing it by the total probability.

Consider the same example with the factories:
Let us say a company buys parts from 3 other companies.

It gets
60% from company A
40% from company B
20% from company C


Company A ships defective parts 1% of the time (0.01)
Company B ships defective parts 5% of the time (0.05)
Company C ships defective parts 10% of the time (0.10)

Bayes theorem can help us answer the question, what are the chances that a defective part in our company came from company A?

Here the conditional probability of the outcome (defective if from A) is 0.01
The chance of the outcome (bought from A) is 0.60

The probability of any part that is being bought can be found using the total probability theorem. We did that yesterday and found the probability to be 0.046(4.6%)

Bayes theorem says the chances the defective part is from company A is

(0.01*0.60) / 0.046 = 0.13 or 13%

Surprisingly higher than the chance of getting any defective product, but it is because such a large portion of purchases are from that company.

No comments: