# 2.7 - Bayes' Theorem

2.7 - Bayes' Theorem

## Example 2-10: Jury Trial

In a jury trial, suppose the probability the defendant is convicted, given guilt, is 0.95, and the probability the defendant is acquitted, given innocence, is 0.95. Suppose that 90% of all defendants truly are guilty. Find the probability the defendant was actually innocent given the defendant is convicted. The video will step you through this example.

#### Video: Jury Trial Example

Let Guilty = $$G$$
Innocent = $$I$$
Acquitted = $$A$$
Convicted = $$C$$

$$P(G) = 0.9$$ so $$P(I) = 0.1$$
$$P(C | G) = 0.95$$ so $$P(A | G) = 0.05$$
$$P(A | I) = 0.95$$ so $$P(C | I) = 0.05$$
Need to find: $$P(I | C)$$

\begin{align} P(I\ and\ C)  &= P(C | I)*P(I)\\ &= 0.05*0.1\\ &= 0.005 \end{align}
\begin{align} P(C) &= P(G\ and\ C) + P(I\ and\ C)\\ &= (0.95)*(0.9) + ( 0.05)*(0.1)\\ &= 0.855 + 0.005\\ &= 0.86\\ \end{align}
\begin{align} P(I | C) &= \dfrac{P(I\ and\ C) }{P(C)} \\&= \dfrac{0.005}{0.86}\\ &= 0.006 \end{align}

The above example illustrates the use of Bayes' theorem to find "reverse" conditional probabilities.

Bayes' Theorem

Suppose we have events $A_1, \dots, A_k$  and event B.  If $A_1, \dots, A_k$ are $k$ mutually exclusive events, then...

$$P(A_{i}|B)=\dfrac{P(B | A_{i})P(A_{i})}{\sum_{i} P(B | A_{i})P(A_{i})}=\dfrac{P(B | A_{i})P(A_{i})}{P(B| A_{1})P(A_{1})+P(B |A_{2})P(A_{2})+...+P(B| A_{k})P(A_{k})}$$

Applying this to just two events A and B we have...

$$P(A|B)=\dfrac{P(B | A)P(A)}{ P(B | A)P(A)+P(B| A')P(A')}$$

## Example 2-11: Screw Manufacturing

A company creates their product using a specially made screw. For financial purposes, the company gets their screws from three different manufacturers. If a screw is defective, it can cause a lot of damage. Here is the table of the proportion of screws from each manufacturer and the probability of obtaining a defective screw.

Manufacturer Probability of Company's Screws Probability of Defective Screw
A 0.40 0.01
B 0.25 0.02
C 0.35 0.015

If a screw is found to be defective, what is the probability that it came from Manufacturer C?

Let D denote a defective screw.  We want $$P(C|D)$$.  We can use Bayes' Theorem to find this probability.

\begin{align} P(C|D) &=\frac{P(C\cap D)}{P(D)}\\ &=\frac{P(D|C)P(C)}{P(D|C)P(C)+P(D|A)P(A)+P(D|B)P(B)}\\ &=\frac{0.015(0.35)}{0.015(0.35)+0.01(0.40)+0.02(0.25)}\\ &=\frac{0.00525}{0.01425}\\ &=\frac{7}{19}=0.36842 \end{align}

## Practical Application: Bayes' Theorem in Diagnostic Testing

In diagnostic testing (e.g. drug tests), there are five key concepts:

Prevalence

Prevalence is the probability or proportion of occurrence of a disease or behavior in the population at a particular point in time.

• Example: Proportion of bus drives who use illegal drugs
Sensitivity and Specificity
• Sensitivity is the probability of a positive result given person is actually positive.
• Example: the probability of a home pregnancy test coming up positive for a woman who is actually pregnant
• Specificity is the probability of a negative result given person is actually negative.
• Example: the probability of a home pregnancy test coming up negative for a woman who is not pregnant
False Positives and False Negatives
• False Positives are when results come back positive for someone who is actually negative
• Example: a home pregnancy test coming up positive for a woman who is not pregnant
• False Negatives are when results come back negative for someone who is actually positive
• Example: a home pregnancy test coming up negative for a woman who is actually pregnant

## Example 2-12: Diabetes Screening

Consider the following data on a diabetes screening test based on a non-fasting blood screen test, which is relatively inexpensive and painless.

Test Results
Diabetes? Positive Negative Total
Yes 350 150 500
No 1900 7600 9500
Total 2250 7750 10,000