**Prior and posterior probability (difference):**

Consider a population where the proportion of HIV-infected individuals is 0.01. Then, the prior probability that a randomly chosen subject is HIV-infected is P_{prior} = 0.01 .

Suppose now a subject has been positive for HIV. It is known that specificity of the test is 95%, and sensitivity of the test is 99%. What is the probability that the subject is HIV-infected? In other words, what is the conditional probability that a subject is HIV-infected if he/she has tested positive?

The following table summarizes calculations. For the sake of simplicity you may consider the fractions (probabilities) as proportions of the general population.

. | Test results | . | |

HIV-status | Positive | Negative | Total |

infected | 0.01*0.99 = 0.0099 | 0.01*(1-0.99)=0.0001 | 0.01 |

not infected | 0.99*(1-0.95) | 0.99*(0.95) | 0.99 |

total: | 0.0594 | 0.9406 | 1.00 |

Thus, the average proportion of positive tests overall is 0.0594, and the proportion of actually infected among them is 0.0099/0.0594 or 0.167 = 16.7%.

So, the posterior (i.e. after the test has been carried out and turns out to be positive) probability that the subject is really HIV-infected is 0.167.

The difference between prior and posterior probabilities characterizes the information we have gotten from the experiment or measurement. In this example the probability changed from 0.01 (prior) to 0.167 (posterior)

Note also the surprising result in this case, which, although hypothetical, is typical of many medical screening tests. Although the test is 95% effective in correctly identifying an HIV case, a person who tests positive actually has only a 16.7% chance of having the disease. This is due to the very low proportion of actually-infected people in the population -- most of the positive test results are false positives from the non-infected people who are being tested.

See also: A Priori Probability , Posterior Probability .