Alex John Quijano
11/03/2021
We used the law of total probability and Bayes’ Theorem to do some examples
Drawing cards from the top of standard deck.
COVID testing example
Today, we will:
More on the COVID testing example
Define accuracy, precision, sensitivity, and specificity for a binary contingency table.
How is Bayes’ Theorem is used?
Suppose that two jars contain colored balls as described in the table below.
Red | White | |
---|---|---|
Jar 1 | 3 | 3 |
Jar 2 | 4 | 2 |
15:15
Solution for (a): \[P(J_1|W) = \frac{P(J_1)P(W|J_1)}{P(J_1)P(W|J_1) + P(J_2)P(W|J_2)} = \frac{ \frac{1}{2} \frac{3}{6} }{\frac{1}{2} \frac{3}{6} + \frac{1}{2} \frac{2}{6}} = \frac{3}{5}\]
Solution for (b): \[P(J_2|R_2) = \frac{P(J_2)P(R_2|J_2)}{P(J_1)P(R_2|J_1) + P(J_2)P(R_2|J_2)} = \frac{\frac{1}{2} \frac{4}{6} \frac{3}{5}}{\frac{1}{2} \frac{3}{6} \frac{2}{5} + \frac{1}{2} \frac{4}{6} \frac{3}{5}} = \frac{2}{3}\]
Solution for (c): \[P(J_2|R_2 W) = \frac{P(J_2)P(R_2W|J_2)}{P(J_1)P(R_2 W|J_1) + P(J_2)P(R_2 W|J_2)} = \frac{4}{7}\]
For a more detailed solution see this pdf notes.
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\]
Today, we discussed the following:
Defined accuracy, precision, sensitivity, and specificity on a binary contingency table
How is Bayes’ Theorem used? The balls in jars (also balls in urns) are a simplified way to illustrate conditional probabilities and Bayes’ Theorem, which is applied to the COVID testing example.
Next, we will discuss: