Introduction
A diagnostic screening question often supplies several percentages, but the calculation depends on how those percentages relate to one another. Prevalence describes the starting disease risk in a population; sensitivity and specificity describe test results conditional on disease status. A patient’s risk after a result is a different probability again. Moving carefully between these quantities is the central skill in diagnostic testing problems.
A useful solution does more than produce a decimal. It identifies the relevant population, lays out the possible routes to the observed test result, checks the denominator, and translates the result into context. Depending on the information and the question, a tree, a table of natural frequencies, or Bayes’ rule may make that reasoning clearest.
These conditional probabilities answer different questions. In particular, sensitivity is not the probability that a person with a positive result has the disease. That latter quantity is the positive predictive value, which also depends on prevalence and on the probability of false positives. Similarly, the probability of disease after a negative result is \(P(D\mid -)\), not sensitivity or specificity.
A Reliable Setup Before Calculating
Before applying a formula, state the model. Assume the population has disease prevalence \(P(D)\), and that the test’s sensitivity and specificity apply to this population and testing context. Treat disease status as either \(D\) or \(D^c\), and the result as either \(+\) or \(-\). The four joint outcomes are a true positive, false negative, false positive, and true negative. These assumptions make the listed probabilities sufficient to work out posterior risks.
The denominator for a posterior probability must include all ways the observed result can occur. A positive result can come from a person with disease or from a person without disease. A negative result can also come from either group. The law of total probability therefore gives:
Since \(P(+\mid D)=\text{sensitivity}\), \(P(+\mid D^c)=1-\text{specificity}\), and \(P(D^c)=1-P(D)\), Bayes’ rule gives the positive predictive value. For a negative result, the disease route is a false negative and the non-disease route is a true negative:
These equations follow directly from the definition of conditional probability. For example, \(P(D\mid +)=P(D\cap +)/P(+)\). The numerator is \(P(+\mid D)P(D)\), while the denominator is the sum of the disjoint routes \(D\cap +\) and \(D^c\cap +\). The negative-result equation follows by replacing \(+\) with \(-\) and identifying the corresponding two routes.
Use the prevalence for the population to which the question refers, not an unrelated population.
Write sensitivity as \(P(+\mid D)\), specificity as \(P(-\mid D^c)\), and obtain the complementary branch probabilities.
Use a tree or table to include every way the observed result could occur.
Divide the joint probability for the patient’s disease status and result by the total probability of that result, then state the risk in context.
Worked Examples
Worked Example: A Positive Result With a Probability Tree
Suppose a hypothetical screening program serves a population with disease prevalence \(2\%\). The test has sensitivity \(90\%\) and specificity \(95\%\). For a person from this population who tests positive, what is the probability that the person has the disease?
Check the setup. We assume the prevalence and test characteristics apply to this population and that the person’s result is classified as positive or negative. The positive branch among people without disease has probability \(1-0.95=0.05\), the false-positive rate.
A tree starts with \(P(D)=0.02\) and \(P(D^c)=0.98\). The joint probability of being diseased and testing positive is \(0.02(0.90)=0.018\). The joint probability of not being diseased and testing positive is \(0.98(0.05)=0.049\). Both branches lead to a positive result, so:
The estimated probability that this person has the disease after a positive result is about \(26.87\%\). This is not a \(90\%\) probability: \(90\%\) is the sensitivity, the chance of a positive result among people who have the disease. The posterior risk is lower because the calculation also includes positive results among the much larger group without disease.
Worked Example: Residual Risk After a Negative Result
In a different hypothetical population, prevalence is \(8\%\), sensitivity is \(96\%\), and specificity is \(90\%\). Find the probability of disease after a negative result. A frequency table based on 10,000 people makes the denominator easy to inspect.
Check the setup. Assume the given test characteristics apply in this population. Of 10,000 people, \(0.08(10{,}000)=800\) have the disease and \(9{,}200\) do not. Among the 800 with disease, the false-negative rate is \(1-0.96=0.04\), so \(800(0.04)=32\) test negative. Among the 9,200 without disease, specificity is \(0.90\), so \(9{,}200(0.90)=8{,}280\) test negative.
There are \(32+8{,}280=8{,}312\) negative results in total. Only 32 of those are from people with disease. Thus:
The residual probability of disease after a negative result is about \(0.3850\%\), or roughly 4 in 1,039 people with a negative result under this model. The table yields the same calculation: \(32/8{,}312\approx0.003850\). The denominator is all negative results, not all people without disease.
Worked Example: Choosing a Table to Answer Both Questions
A hypothetical clinic screens 2,000 people from a population with \(5\%\) disease prevalence. The test has \(90\%\) sensitivity and \(95\%\) specificity. Find the probability of disease after a positive result and after a negative result.
Check the setup. Assume the clinic’s prevalence and the stated sensitivity and specificity describe these 2,000 people and this test. A table is convenient because it displays both possible test results for each disease group. There are \(0.05(2{,}000)=100\) people with disease and 1,900 without disease. Of the 100 with disease, 90 test positive and 10 test negative. Of the 1,900 without disease, \(0.05(1{,}900)=95\) test positive and \(0.95(1{,}900)=1{,}805\) test negative.
| Disease | No disease | Total | |
|---|---|---|---|
| Positive | 90 | 95 | 185 |
| Negative | 10 | 1,805 | 1,815 |
| Total | 100 | 1,900 | 2,000 |
Among the 185 people with positive results, 90 have disease. Among the 1,815 people with negative results, 10 have disease. Therefore:
Under these assumptions, a positive result corresponds to an estimated disease probability of about \(48.65\%\); a negative result corresponds to about \(0.5510\%\). These are probabilities for people with the respective test results in this population. They do not establish an individual diagnosis, and they should not be transferred to a population with a different prevalence without recalculation.
Choosing a Representation and Checking the Answer
A probability tree is useful when the problem gives conditional probabilities in sequence: first disease status, then test result. It shows which probabilities multiply along each path and which paths must be added. A natural-frequency table is often easier when the prevalence and test characteristics are percentages and a convenient population size can be chosen. Bayes’ rule is compact when the probabilities are already clear and the requested posterior is the main goal.
These are not competing methods. A carefully built tree, a table with consistent counts, and Bayes’ rule encode the same joint probabilities. Use whichever makes the conditional direction and denominator most visible. Before accepting an answer, check that:
- The prevalence refers to the population being discussed.
- The false-positive rate is \(1-\text{specificity}\), and the false-negative rate is \(1-\text{sensitivity}\).
- The denominator includes every person or probability path with the observed result.
- The numerator includes only people with both the disease status asked about and that result.
- The final probability is between 0 and 1 and is described using the correct conditioning.
A result can also be a warning that the model inputs need checking. For example, counts in a table should sum to the stated population total, and the positive and negative outcomes should account for everyone. If they do not, a branch probability may have been applied to the wrong group or a route may have been omitted.
Common Mistake: Reversing the Conditional
A common error is to say, “The test has \(90\%\) sensitivity, so a person who tests positive has a \(90\%\) chance of disease.” This reverses the condition. Sensitivity is \(P(+\mid D)\); the patient’s question asks for \(P(D\mid +)\). These probabilities generally differ because the latter depends on prevalence and false positives as well as sensitivity.
The correction is to begin with the event the patient’s result identifies. For a positive result, count or calculate all positive results, then find what fraction came from people with disease. In the first example, \(0.018\) of the population are both diseased and positive, while \(0.067\) are positive overall. The required fraction is \(0.018/0.067\), not \(0.90\).
Finally, posterior risk is not by itself a clinical decision. Whether to confirm a result or take another action depends on clinical context and decision criteria beyond the probability calculation. A statistical answer should report the probability supported by the stated model without turning it into a diagnosis or a recommendation.
Check Your Understanding
For each question, identify the relevant conditional probability and explain the denominator you would use.
- A test has sensitivity \(88\%\). In words, what conditional probability does this describe?
- If specificity is \(97\%\), what is the false-positive rate?
- For a positive result, why must the denominator include both true positives and false positives?
- A clinic uses a screening test in a population with a different prevalence from the population used to estimate its predictive value. What input must be reconsidered when calculating the clinic’s posterior risk?
- Explain why \(P(D\mid -)\) is not the same quantity as specificity.