Skip to content

Prior and posterior probability (difference)

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 Pprior = 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 .

Browse Other Glossary Entries

Test Yourself

Planning on taking an introductory statistics course, but not sure if you need to start at the beginning? Review the course description for each of our introductory statistics courses and estimate which best matches your level, then take the self test for that course. If you get all or almost all the questions correct, move on and take the next test.

Data Analytics

Considering becoming adata scientist, customer analyst or our data science certificate program?

Analytics Quiz

Advanced Statistics Quiz

Statistics Quiz


Looking at statistics for graduate programs or to enhance your foundational knowledge?

Statistics 1 Quiz

Regression Quiz

Regression Quiz


Entering the biostatistics field? Test your skill here.

Biostatistics Quiz

Advanced Statistics Quiz

Statistics 2 Quiz

Stay Informed

Our Blog

Read up on our latest blogs


Learn about our certificate programs


Find the right course for you

Contact Us

We'd love to answer your questions

Our mentors and academic advisors are standing by to help guide you towards the courses or program that makes the most sense for you and your goals.

300 W Main St STE 301, Charlottesville, VA 22903

(434) 973-7673

By submitting your information, you agree to receive email communications from All information submitted is subject to our privacy policy. You may opt out of receiving communications at any time.