sensitivity and specificity sensitivity and specificity sensitivity and specificity mathematically describe the accuracy of a test which reports the presence or absence of a condition. if individuals who have the condition are considered "positive" and those who don't are considered "negative", then sensitivity is a measure of how well a test can identify true positives and specificity is a measure of how well a test can identify true negatives: sensitivity (true positive rate) is the probability of a positive test result, conditioned on the individual truly being positive. specificity (true negative rate) is the probability of a negative test result, conditioned on the individual truly being negative. sensitivity and specificity - the left half of the image with the solid dots represents individuals who have the condition, while the right half of the image with the hollow dots represents individuals who do not have the condition. the circle represents all individuals who tested positive. if the true status of the condition cannot be known, sensitivity and specificity can be defined relative to a "gold standard test" which is assumed correct. for all testing, both diagnostic and screening, there is usually a trade-off between sensitivity and specificity, such that higher sensitivities will mean lower specificities and vice versa. a test which reliably detects the presence of a condition, resulting in a high number of true positives and low number of false negatives, will have a high sensitivity. this is especially important when the consequence of failing to treat the condition is serious and/or the treatment is very effective and has minimal side effects. a test which reliably excludes individuals who do not have the condition, resulting in a high number of true negatives and low number of false positives, will have a high specificity. this is especially important when people who are identified as having a condition may be subjected to more testing, expense, stigma, anxiety, etc. sensitivity and specificity the terms "sensitivity" and "specificity" were introduced by american biostatistician jacob yerushalmy in 1947. terminology and derivationsfrom a confusion matrix condition positive (p)the number of real positive cases in the data condition negative (n)the number of real negative cases in the data true positive (tp)a test result that correctly indicates the presence of a condition or characteristic true negative (tn)a test result that correctly indicates the absence of a condition or characteristic false positive (fp)a test result which wrongly indicates that a particular condition or attribute is present false negative (fn)a test result which wrongly indicates that a particular condition or attribute is absent sensitivity, recall, hit rate, or true positive rate (tpr) t p r = t p p = t p t p + f n = 1 − f n r = } }}= } +\mathrm }}=1-\mathrm } specificity, selectivity or true negative rate (tnr) t n r = t n n = t n t n + f p = 1 − f p r = } }}= } +\mathrm }}=1-\mathrm } precision or positive predictive value (ppv) p p v = t p t p + f p = 1 − f d r = } +\mathrm }}=1-\mathrm } negative predictive value (npv) n p v = t n t n + f n = 1 − f o r = } +\mathrm }}=1-\mathrm } miss rate or false negative rate (fnr) f n r = f n p = f n f n + t p = 1 − t p r = } }}= } +\mathrm }}=1-\mathrm } fall-out or false positive rate (fpr) f p r = f p n = f p f p + t n = 1 − t n r = } }}= } +\mathrm }}=1-\mathrm } false discovery rate (fdr) f d r = f p f p + t p = 1 − p p v = } +\mathrm }}=1-\mathrm } false omission rate (for) f o r = f n f n + t n = 1 − n p v = } +\mathrm }}=1-\mathrm } positive likelihood ratio (lr+) l r + = t p r f p r = } }}} negative likelihood ratio (lr-) l r − = f n r t n r = } }}} prevalence threshold (pt) p t = f p r t p r + f p r = }} }}+ }}}}} threat score (ts) or critical success index (csi) t s = t p t p + f n + f p = } +\mathrm +\mathrm }}} prevalence p p + n } +\mathrm }}} accuracy (acc) a c c = t p + t n p + n = t p + t n t p + t n + f p + f n = +\mathrm } +\mathrm }}= +\mathrm } +\mathrm +\mathrm +\mathrm }}} balanced accuracy (ba) b a = t p r + t n r 2 = f1 scoreis the harmonic mean of precision and sensitivity: f 1 = 2 × p p v × t p r p p v + t p r = 2 t p 2 t p + f p + f n _=2\times \times \mathrm } +\mathrm }}= } +\mathrm +\mathrm }}} phi coefficient (φ or rφ) or matthews correlation coefficient (mcc) m c c = t p × t n − f p × f n ( t p + f p ) ( t p + f n ) ( t n + f p ) ( t n + f n ) = \times \mathrm -\mathrm \times \mathrm } +\mathrm )(\mathrm +\mathrm )(\mathrm +\mathrm )(\mathrm +\mathrm )}}}} fowlkes–mallows index (fm) f m = t p t p + f p × t p t p + f n = p p v × t p r =\times = informedness or bookmaker informedness (bm) b m = t p r + t n r − 1 =\mathrm +\mathrm -1} markedness (mk) or deltap (δp) m k = p p v + n p v − 1 =\mathrm +\mathrm -1} diagnostic odds ratio (dor) d o r = l r + l r − = } }}} sources: fawcett (2006), piryonesi and el-diraby (2020), powers (2011), ting (2011), cawcr, d. chicco & g. jurman (2020, 2021, 2023), tharwat (2018). balayla (2020) application to screening study imagine a study evaluating a test that screens people for a disease. each person taking the test either has or does not have the disease. the test outcome can be positive (classifying the person as having the disease) or negative (classifying the person as not having the disease). the test results for each subject may or may not match the subject's actual status. in that setting: true positive: sick people correctly identified as sick false positive: healthy people incorrectly identified as sick true negative: healthy people correctly identified as healthy false negative: sick people incorrectly identified as healthy after getting the numbers of true positives, false positives, true negatives, and false negatives, the sensitivity and specificity for the test can be calculated. if it turns out that the sensitivity is high then any person who has the disease is likely to be classified as positive by the test. on the other hand, if the specificity is high, any person who does not have the disease is likely to be classified as negative by the test. an nih web site has a discussion of how these ratios are calculated. definition sensitivity consider the example of a medical test for diagnosing a condition. sensitivity (sometimes also named the detection rate in a clinical setting) refers to the test's ability to correctly detect ill patients out of those who do have the condition. mathematically, this can be expressed as: sensitivity = number of true positives number of true positives + number of false negatives = number of true positives total number of sick individuals in population = probability of a positive test given that the patient has the disease &=+\\&=\\&=\end a negative result in a test with high sensitivity can be useful for "ruling out" disease, since it rarely misdiagnoses those who do have the disease. a test with 100% sensitivity will recognize all patients with the disease by testing positive. in this case, a negative test result would definitively rule out the presence of the disease in a patient. however, a positive result in a test with high sensitivity is not necessarily useful for "ruling in" disease. suppose a 'bogus' test kit is designed to always give a positive reading. when used on diseased patients, all patients test positive, giving the test 100% sensitivity. however, sensitivity does not take into account false positives. the bogus test also returns positive on all healthy patients, giving it a false positive rate of 100%, rendering it useless for detecting or "ruling in" the disease. the calculation of sensitivity does not take into account indeterminate test results. if a test cannot be repeated, indeterminate samples either should be excluded from the analysis (the number of exclusions should be stated when quoting sensitivity) or can be treated as false negatives (which gives the worst-case value for sensitivity and may therefore underestimate it). a test with a higher sensitivity has a lower type ii error rate. specificity consider the example of a medical test for diagnosing a disease. specificity refers to the test's ability to correctly reject healthy patients without a condition. mathematically, this can be written as: specificity = number of true negatives number of true negatives + number of false positives = number of true negatives total number of well individuals in population = probability of a negative test given that the patient is well &=+\\&=\\&=\end a positive result in a test with high specificity can be useful for "ruling in" disease, since the test rarely gives positive results in healthy patients. a test with 100% specificity will recognize all patients without the disease by testing negative, so a positive test result would definitively rule in the presence of the disease. however, a negative result from a test with high specificity is not necessarily useful for "ruling out" disease. for example, a test that always returns a negative test result will have a specificity of 100% because specificity does not consider false negatives. a test like that would return negative for patients with the disease, making it useless for "ruling out" the disease. a test with a higher specificity has a lower type i error rate. graphical illustration high sensitivity and low specificity low sensitivity and high specificity a graphical illustration of sensitivity and specificity the above graphical illustration is meant to show the relationship between sensitivity and specificity. the black, dotted line in the center of the graph is where the sensitivity and specificity are the same. as one moves to the left of the black dotted line, the sensitivity increases, reaching its maximum value of 100% at line a, and the specificity decreases. the sensitivity at line a is 100% because at that point there are zero false negatives, meaning that all the negative test results are true negatives. when moving to the right, the opposite applies, the specificity increases until it reaches the b line and becomes 100% and the sensitivity decreases. the specificity at line b is 100% because the number of false positives is zero at that line, meaning all the positive test results are true positives. the middle solid line in both figures that show the level of sensitivity and specificity is the test cutoff point. as previously described, moving this line results in a trade-off between the level of sensitivity and specificity. the left-hand side of this line contains the data points that tests below the cut off point and are considered negative (the blue dots indicate the false negatives (fn), the white dots true negatives (tn)). the right-hand side of the line shows the data points that tests above the cut off point and are considered positive (red dots indicate false positives (fp)). each side contains 40 data points. for the figure that shows high sensitivity and low specificity, there are 3 fn and 8 fp. using the fact that positive results = true positives (tp) + fp, we get tp = positive results - fp, or tp = 40 - 8 = 32. the number