How to calculate sensitivity and specificity

7th Jan 2021

In clinical medicine and in public health, we need tests in order to separate healthy from diseased individuals. Most of the time, these tests assess a continuous variable like blood pressure, which is measured in mmHg, for example. Diseased and healthy individuals usually have different distributions of that variable. So we choose a threshold above which individuals are classified as diseased and below which they're classified as healthy or non-diseased. Where we choose the threshold makes a huge difference. If the threshold is too low, many healthy individuals will be falsely classified as diseased. If it's too high, many diseased individuals will be falsely classified as healthy.

Graph identifying a threshold between healthy and diseased individuals. Illustration.

Figure 1. For tests that separate healthy individuals from diseased individuals, we choose a threshold above which individuals are classified as diseased and below which individuals are classified as healthy. 

 

What is validity when it comes to diagnostic testing?

If a test is able to classify a large proportion of diseased and non-diseased individuals correctly, it is said to have high validity. 

Validity is usually determined when a test is newly introduced, and when that's done, it's compared to a gold standard. So lab tests assessing the presence of Helicobacter pylori could be compared to the gold standard of biopsy or a test of coronary artery disease could be compared to the gold standard of coronary angiography. Ideally, a new test has a validity that is as good or better than the gold standard. 

Test validity has two major components, or quality criteria: 1.	Sensitivity—proportion of diseased people correctly classified 2.	Specificity—proportion of non-diseased people correctly classified

 

How can sensitivity and specificity impact our interpretation of diagnostic test results?

Once a new test is used in the real world, we end up with positive or negative results and we have to do something with them. So sensitivity and specificity give us an indication as to how much trust we can put into these tests. Diseased individuals who are tested positive are called true positives and non-diseased individuals who are tested negative are called true negatives. Diseased individuals who are tested negative are called false negatives and non-diseased who have tested positive are called false positives.

The relationship between disease status and diagnostic test results. Illustration.

Figure 2. The relationship between disease status and diagnostic test results. 

Ideally, we'd like everyone to fall into the true positive or true negative groups, but no test is perfect, so we'll end up with people in the false negative and false positive groups. 


Now, what's the problem with these groups? Well, someone who's falsely labeled as positive will be sent for further testing. This will subject them to the risk of these potentially invasive tests, consuming healthcare dollars, creating fear for the patients and their relatives, and associating the patient with a label that might stick for a long time. Think about your own patients. Once falsely diagnosed with hypertension, for example, they might not ever get rid of that diagnosis, because it's copied from one letter or patient report to the next.

On the other hand, someone who's falsely labeled as negative, who has a potentially treatable disease, might be sent home and die or become much sicker because nothing's done about the disease. So when we choose the threshold of the test, we have to weigh the relative importance of problems associated with false positives and false negatives.

Table relating test results to presence of disease. Hospital. House. Grave. Illustration.

Figure 3. Individuals who are falsely classified as having a disease, known as false positives, are sent for further, potentially invasive, testing which is costly, and may cause fear and stigma for the patient. But individuals who are falsely classified as not having a disease, known as false negatives, are at risk of worsening health or death because of lack of, or delayed, treatment. 

Let's look at an example for better clarity. Let's pick a population of 1000 people and let's say that 200 of them have the disease of interest. So this means that the prevalence is 20%. Now, let's also say that 160 out of the 200 diseased people test positive, whereas 40 are missed by the test. On the other hand, 720 of non-diseased are correctly classified as negative by the test, whereas 80 are falsely classified as positive. 

 

Clickable call to action, "Start learning for free", with direct link to sign up for a free Medmastery trial account.


The sensitivity of that test is calculated as the number of diseased that are correctly classified, divided by all diseased individuals. So for this example, 160 true positives divided by all 200 positive results, times 100, equals 80%. In other words, the sensitivity is the proportion of diseased individuals correctly classified, and that's 80% in this case. 

Equation to calculating sensitivity of a diagnostic test

Figure 4. The equation to calculate the sensitivity of a diagnostic test 

The specificity is calculated as the number of non-diseased correctly classified divided by all non-diseased individuals. So 720 true negative results divided by 800, or all non-diseased individuals, times 100, gives us a specificity of 90%. So the specificity is the proportion of non-diseased correctly classified. 

Equation to calculate specificity of a diagnostic test

Figure 5. The equation to calculate the specificity of a diagnostic test

That’s it for now. If you want to improve your understanding of key concepts in medicine, and improve your clinical skills, make sure to register for a free trial account, which will give you access to free videos and downloads. We’ll help you make the right decisions for yourself and your patients.