Alex John Quijano
11/05/2021
We used Bayes’ Theorem to do some examples
Balls in Jars Example as the simplied example to used Bayes’ Theorem
Defined accuracy, precision, sensitivity, and specificity for a binary contingency table.
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:
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}\) |
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: the probability of a person tests positive with the actual COVID (this is the true positive rate) \[P(+|C^+) = 0.95\]
Specificity: the probability of a person tests negative without the actual COVID (this is the true negative rate) \[P(-|C^-) = 0.95\]
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^-).\]
Suppose that you randomly sample another person
A location has 0.05% COVID cases (prevalence). Given that they tested positive, what is the probability that they have COVID? Interpret this probability.
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:
\[P(+|C^-) = 1 - P(-|C^-) = 1 - 0.95 = 0.05 \longrightarrow \text{false positive rate}\]
\[P(+|C^+) = 0.95 \longrightarrow \text{true positive rate}\]
10:10
There is a 0.94% chance that a randomly selected person have COVID given that they testing positive.
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.
Today, we discussed the following:
Defined accuracy, precision, sensitivity, and specificity on a binary contingency table.
COVID testing examples.
Next, we will discuss: