10 - Bayes’ Theorem Plus

Alex John Quijano

11/05/2021

Previously on Bayes’ Theorem…

COVID Testing Accuracy

Example: There is no test that is 100% accurate in detecting COVID. Suppose that there is a 95% percent accuracy in detecting COVID infections.

What does accuracy mean?

Useful terms:

Accuracy vs Precision

positive test
\(+\)
negative test
\(-\)
COVID
\(C^+\)
true positives (tp) false negative (fn)
type II error
true positive rate
(sensitivity)
\(\frac{tp}{tp+fn}\)
No COVID
\(C^-\)
false positive (fp)
type I error
true negative (tn) true negative rate
(specificity)
\(\frac{tn}{tn+fp}\)
positive predicted value
(precision)
\(\frac{tp}{(tp+fp)}\)
negative predicted value
\(\frac{tn}{tn+fn}\)
accuracy
\(\frac{tp+tn}{tp+tn+fp+fn}\)

100,000 Patients Example

Suppose that we have \(100,000\) patients with \(1000\) patients are infected and \(99,000\) patients are not, and below shows how many of them tested positive and tested negative. Given this example, the probability of having actual COVID is 1% (which is also known as the prevalence rate).

positive test
\(+\)
negative test
\(-\)
COVID
\(C^+\)
950 50 \(\text{sensitivity} = \frac{950}{1000} = 0.95\)
No COVID
\(C^-\)
4950 94050 \(\text{specificity} = \frac{94050}{99000} = 0.95\)
\(\text{precision} = \frac{950}{950+4950} = 0.1610\) \(\text{accuracy} = \frac{950+94050}{100,000} = \mathbf{0.95}\)

Sensitivity and Specificity

Applying Bayes’ Theorem (1/2)

The Bayes’ theorem expression for our example is \[P(C^+|+) = \frac{P(C^+)P(+|C^+)}{P(+)}\] where \(P(+)\) is computed using the law of total probability written as \[P(+) = P(C^+)P(+|C^+) + P(C^-)P(+|C^-).\]

Applying Bayes’ Theorem (2/2)

15.15-Minute activity (1/4)

Suppose that you randomly sample another person

  1. A location has 0.05% COVID cases (prevalence). Given that they tested positive, what is the probability that they have COVID? Interpret this probability.

  2. Try 3% COVID cases (prevalence). Did the probability increase or decrease from problem 1? Interpret this probability and compare this to the result from problem 1.

Information:

10:10

15.15-Minute activity (2/4)

  1. Answer: Givens \(P(C^+) = 0.0005\), \(P(+|C^-) =0.05\), and \(P(+|C^+) = 0.95\). \[ \begin{align} P(+) & = P(C^+)P(+|C^+) + P(C^-)P(+|C^-) \\ & = (0.0005)(0.95) + (1-0.0005)(0.05) = 0.0505 \end{align} \] \[P(C^+|+) = \frac{P(C^+)P(+|C^+)}{P(+)} = \frac{(0.0005)(0.95)}{0.0505} = 0.0094\]

There is a 0.94% chance that a randomly selected person have COVID given that they testing positive.

15.15-Minute activity (3/4)

  1. Answer: Givens \(P(C^+) = 0.03\), \(P(+|C^-) =0.05\), and \(P(+|C^+) = 0.95\). \[ \begin{align} P(+) & = P(C^+)P(+|C^+) + P(C^-)P(+|C^-) \\ & = (0.03)(0.95) + (1-0.03)(0.05) = 0.077 \end{align} \] \[P(C^+|+) = \frac{P(C^+)P(+|C^+)}{P(+)} = \frac{(0.03)(0.95)}{0.077} = 0.3701\]

There is a 37.01% probability that a randomly selected person have COVID given that they testing positive. This result is way higher than the previous but still less than 50% chance.

What does this all mean? (1/2)

Summary

Today, we discussed the following:

Next, we will discuss: