SOLUTION: A diagnostic test has a probability 0.99 of giving a positive result when applied to a person suffering from Covid-19,and a probability 0.01 of giving a(false) positive when appl

Algebra ->  Probability-and-statistics -> SOLUTION: A diagnostic test has a probability 0.99 of giving a positive result when applied to a person suffering from Covid-19,and a probability 0.01 of giving a(false) positive when appl      Log On


   



Question 1160854: A diagnostic test has a probability 0.99 of giving a positive result when applied to a
person suffering from Covid-19,and a probability 0.01 of giving a(false) positive
when applied to a non-sufferer.It is estimated that 0.9% of the population are
sufferers.Suppose that the test is now administered to a person in Malawi about
whom we have no relevant information relating to the disease.Calculate the
following probabilities:
a)That the test result will be positive.
b)That,given a positive result,the person is a sufferer.
c)That,given a negative result,the person is a non-sufferer.
d)That the person will be misclassified.

Answer by CPhill(2303) About Me  (Show Source):
You can put this solution on YOUR website!
```python
# Given values
P_S = 0.009
P_Sc = 1 - P_S # 0.991
P_Tpos_given_S = 0.99
P_Tpos_given_Sc = 0.01
# a) P(T+) by Law of Total Probability
P_Tpos = P_Tpos_given_S * P_S + P_Tpos_given_Sc * P_Sc
# b) P(S | T+) by Bayes' theorem
P_S_given_Tpos = (P_Tpos_given_S * P_S) / P_Tpos
# c) P(Sc | T-)
P_Tneg_given_S = 1 - P_Tpos_given_S # 0.01
P_Tneg_given_Sc = 1 - P_Tpos_given_Sc # 0.99
P_Tneg = 1 - P_Tpos
# or P_Tneg = P_Tneg_given_S * P_S + P_Tneg_given_Sc * P_Sc
P_Sc_given_Tneg = (P_Tneg_given_Sc * P_Sc) / P_Tneg
# d) P(Misclassified)
# A person is misclassified if:
# (person has S and tests negative) OR (person has Sc and tests positive)
P_misclassified = P_Tneg_given_S * P_S + P_Tpos_given_Sc * P_Sc
print(f"a) P(T+): {P_Tpos:.6f} ({P_Tpos})")
print(f"b) P(S | T+): {P_S_given_Tpos:.6f} ({P_S_given_Tpos})")
print(f"c) P(Sc | T-): {P_Sc_given_Tneg:.6f} ({P_Sc_given_Tneg})")
print(f"d) P(Misclassified): {P_misclassified:.6f} ({P_misclassified})")

```
```text
a) P(T+): 0.018820 (0.01882)
b) P(S | T+): 0.473433 (0.47343251859723695)
c) P(Sc | T-): 0.999908 (0.9999082737112456)
d) P(Misclassified): 0.010000 (0.01)

```
To solve these questions, let us define the relevant events and given probabilities:
* $S$: The person is a sufferer of Covid-19.
* $S^c$: The person is a non-sufferer.
* $T^+$: The test result is positive.
* $T^-$: The test result is negative.
From the problem statement:
* **Prevalence:** $P(S) = 0.9\% = 0.009$
* **Non-sufferers:** $P(S^c) = 1 - P(S) = 1 - 0.009 = 0.991$
* **Sensitivity (True positive rate):** $P(T^+ \mid S) = 0.99 \implies P(T^- \mid S) = 1 - 0.99 = 0.01$
* **False positive rate:** $P(T^+ \mid S^c) = 0.01 \implies P(T^- \mid S^c) = 1 - 0.01 = 0.99$
---
### a) Probability that the test result will be positive, $P(T^+)$
Using the **Law of Total Probability**:
$$P(T^+) = P(T^+ \mid S)P(S) + P(T^+ \mid S^c)P(S^c)$$
$$P(T^+) = (0.99 \times 0.009) + (0.01 \times 0.991)$$
$$P(T^+) = 0.00891 + 0.00991 = \mathbf{0.01882} \quad (\approx 1.882\%)$$
---
### b) Probability that, given a positive result, the person is a sufferer, $P(S \mid T^+)$
Using **Bayes' Theorem**:
$$P(S \mid T^+) = \frac{P(T^+ \mid S)P(S)}{P(T^+)}$$
$$P(S \mid T^+) = \frac{0.00891}{0.01882} = \frac{891}{1882} \approx \mathbf{0.4734} \quad (\approx 47.34\%)$$
*(Even with a 99% accurate test, because the disease prevalence is low, a person testing positive is still slightly more likely to be a false positive than a true positive.)*
---
### c) Probability that, given a negative result, the person is a non-sufferer, $P(S^c \mid T^-)$
First, find the probability of a negative test result:

$$P(T^-) = 1 - P(T^+) = 1 - 0.01882 = 0.98118$$
Now, apply **Bayes' Theorem**:
$$P(S^c \mid T^-) = \frac{P(T^- \mid S^c)P(S^c)}{P(T^-)}$$
$$P(T^- \mid S^c)P(S^c) = 0.99 \times 0.991 = 0.98109$$
$$P(S^c \mid T^-) = \frac{0.98109}{0.98118} = \frac{10,901}{10,902} \approx \mathbf{0.999908} \quad (\approx 99.991\%)$$
---
### d) Probability that the person will be misclassified, $P(\text{Misclassified})$
A misclassification occurs in two disjoint cases:
1. The person has Covid-19 but tests negative (false negative).
2. The person does not have Covid-19 but tests positive (false positive).
$$P(\text{Misclassified}) = P(T^- \cap S) + P(T^+ \cap S^c)$$
$$P(\text{Misclassified}) = P(T^- \mid S)P(S) + P(T^+ \mid S^c)P(S^c)$$
$$P(\text{Misclassified}) = (0.01 \times 0.009) + (0.01 \times 0.991)$$
$$P(\text{Misclassified}) = 0.00009 + 0.00991 = \mathbf{0.01} \quad (1.0\%)$$