Elegant way to calculate probability of a randomly selected person from a test group being sick, given specificity, sensitivity, and test results

617 Views Asked by At

Given a decease and a test that identifies:

  • 99.9% of sick patients as sick (sensitivity)
  • 99.8% of healthy patients as healthy (specificity)

15 of 5000 patients were tested positive, what is the probability that a randomly selected patient from that group is sick?

I have solved this issue naively by just using the definition of sensitivity and specificity, but is there a more elegant or efficient way to solve this problem?

Naive approach

That probability is $P(sick) = \frac{tp+fn}{5000}$, so we need to find the true positives and the false negatives. We can solve the following four equations for the unknown four variables $tn, tp, fn, fp$.

$$ \begin{align} sensitivity = \frac{tp}{tp+fn} = 0.999 \\ specificity = \frac{tn}{tn+fp} = 0.998\\ \\ tp + fp = 15 \\ fn + tn = 4985\\ \end{align} $$

The result is presented in the following table:

$$ \begin{array}{c|ll|c} & Sick & Healthy & \\ \hline Test\ Positive & tp= \frac{4995}{997} & fp = \frac{9960}{997} & 15 \\ Test\ Negative & fn = \frac{5}{997} & tn= \frac{4970040}{997} & 4985 \\ \hline & \ \ \ \ \frac{5000}{997} & 4994.984955 & 5000 \\ \end{array} $$

Thus $ P(Sick) = \frac{\frac{5000}{997}}{5000} = \frac{1}{997} = 0.1003009027\% $.

More context: I need $P(sick)$ in order to calculate $P(sick|positive\ test)$ with Bayes formula.

EDIT: Changed title, since i think that prevalence of the disease is not the same as the probability that a randomly selected patient from a group of 5000 people has the disease.

1

There are 1 best solutions below

0
On

I couldn't get all this in the comments so I'm posting it as an answer. I understand what lulu is saying although the $15$ testing positive does limit somewhat the possibilities of the prevalence of the disease. I have filled out the table below speculating a particular ratio of the $15$ who tested positive as to whether they are actually sick or not and in keeping with percentages of true positives and true negatives. $0.1\%$ of $5$ is $.005$ which I rounded down to $0$.

In this scenario, the prevalence of the sickness is $0.1\%$ in the population and the probability of having the disease if testing positive is: $$p = \frac{5}{15} = \frac{1}{3}$$

enter image description here

If the prevalence of the disease was $0\%$ then there would be an inconsistency of false positives $(15)$ being $0.2\%$ of $5000$. See second table below.

enter image description here