{"id":813,"date":"2015-08-10T15:25:45","date_gmt":"2015-08-10T14:25:45","guid":{"rendered":"http:\/\/pcool.dyndns.org:8080\/statsbook\/?page_id=813"},"modified":"2025-08-11T08:26:05","modified_gmt":"2025-08-11T07:26:05","slug":"sensitivity-specificity","status":"publish","type":"page","link":"https:\/\/pcool.dyndns.org\/index.php\/sensitivity-specificity\/","title":{"rendered":"Sensitivity \/ Specificity"},"content":{"rendered":"\n<p>In medicine, diagnostic tests are used to make a diagnosis. For example, an MRI-scan is performed to diagnose a meniscal tear or a CT-scan to see if someone has a tarsal coalition. Some diagnostic tests are better than others. An MRI-scan of the knee, for example, is better in diagnosing a meniscal tear than a CT scan, which in turn is better than a plain radiograph (<em>This of cause does <strong>not<\/strong> mean one should not request a radiograph of the knee when a meniscal tear is suspected! The radiograph is very helpful in eliminating other causes of knee pain or locking such as osteochondritis dissecans<\/em>). If one test is better than another in diagnosing a condition, we would like to know <strong><em>how much better<\/em><\/strong> this test is. To do this we can <strong><em>validate<\/em><\/strong> the test against a <strong><em>gold standard<\/em><\/strong>.<\/p>\n\n\n\n<p>Five measures of a diagnostic test have been described. These are <strong>sensitivity<\/strong>, <strong>specificity<\/strong>, <strong>positive predictive value<\/strong>, <strong>negative predictive value<\/strong> and <strong>accuracy<\/strong>. These five features allow us to <strong><em>compare<\/em><\/strong> different tests. They will be explained with a fictional example.<\/p>\n\n\n\n<p>As an example, lets look at the value of MRI in diagnosing a meniscal tear in the knee. The MRI needs to be <strong><em>validated<\/em><\/strong> against a <strong><em>gold standard<\/em><\/strong> (or the \u2018truth\u2019 as it is perceived). In this case, diagnostic arthroscopy is the gold standard. There are 100 patients with a suspected meniscal tear. All patients had an MRI-scan that was reviewed by a radiologist. The radiologist reported the scan as either positive or negative for a meniscal tear. The radiologist was not allowed to be indecisive. After the patient had the&nbsp; MRI-scan, a diagnostic arthroscopy was performed. The orthopaedic surgeon, who performed the procedure, diagnosed a meniscal tear or not. Other pathology found by the orthopaedic surgeon, such as arthritis, is irrelevant in this context.<\/p>\n\n\n\n<p>Now the radiological diagnosis is validated against the arthroscopic diagnosis. So, we assume that the arthroscopic diagnosis is always correct (surgeon is always right!). There are 4 possible combinations:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>The radiologist and orthopaedic surgeon both agree that there is a meniscal tear.<\/li>\n\n\n\n<li>The radiologist diagnosed a meniscal tear but this was not confirmed at arthroscopy (<em>over diagnosis by radiologist<\/em>).<\/li>\n\n\n\n<li>The radiologist reported the scan as normal, but there was a meniscal tear at arthroscopy (<em>missed diagnosis by radiologist<\/em>).<\/li>\n\n\n\n<li>They both agree there is no meniscal tear.<\/li>\n<\/ol>\n\n\n\n<table id=\"tablepress-15\" class=\"tablepress tablepress-id-15\">\n<thead>\n<tr class=\"row-1\">\n\t<td class=\"column-1\"><\/td><th class=\"column-2\">Athroscopy<br \/>\nPositive<\/th><th class=\"column-3\">Arthroscopy<br \/>\nNegative<\/th>\n<\/tr>\n<\/thead>\n<tbody class=\"row-striping row-hover\">\n<tr class=\"row-2\">\n\t<td class=\"column-1\">MRI<br \/>\nPositive<\/td><td class=\"column-2\">a<\/td><td class=\"column-3\">b<\/td>\n<\/tr>\n<tr class=\"row-3\">\n\t<td class=\"column-1\">MRI<br \/>\nNegative<\/td><td class=\"column-2\">c<\/td><td class=\"column-3\">d<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<!-- #tablepress-15 from cache -->\n\n\n<p class=\"is-style-text-annotation is-style-text-annotation--1\">Please note the formulas that follow will be different if the rows \/ columns in the table are changed.<\/p>\n\n\n\n<p>In this table, the gold standard (\u2018truth\u2019) is in the columns and the test we validate against this standard is in rows.  The result of the MRI-scan is validated against the arthroscopic diagnosis. So, value <strong>a<\/strong> is the number of patients who have been correctly diagnosed as having a meniscal tear by MRI-scan. They are called the <strong>True Positive <\/strong>scans. Similarly, we can see that value <strong>b<\/strong> is the <strong>False Positive<\/strong>, value <strong>c<\/strong> the <strong>False Negative<\/strong>s and value <strong>d<\/strong> the <strong>True Negative <\/strong>scans. Or:<\/p>\n\n\n\n<p><strong>a: True Positive<\/strong><\/p>\n\n\n\n<p><strong>b: False Positive<\/strong><\/p>\n\n\n\n<p><strong>c: False Negative<\/strong><\/p>\n\n\n\n<p><strong>d: True Negative<\/strong><\/p>\n\n\n\n<p>The five measures of a diagnostic test that have been described are discussed:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Positive Predictive Value<\/li>\n\n\n\n<li>Negative Predictive Value<\/li>\n\n\n\n<li>Sensitivity<\/li>\n\n\n\n<li>Specificity<\/li>\n\n\n\n<li>Accuracy<\/li>\n<\/ol>\n\n\n\n<table id=\"tablepress-16\" class=\"tablepress tablepress-id-16\">\n<thead>\n<tr class=\"row-1\">\n\t<td class=\"column-1\"><\/td><th class=\"column-2\">Athroscopy<br \/>\nPositive<\/th><th class=\"column-3\">Arthroscopy<br \/>\nNegative<\/th><td class=\"column-4\"><\/td>\n<\/tr>\n<\/thead>\n<tbody class=\"row-striping row-hover\">\n<tr class=\"row-2\">\n\t<td class=\"column-1\">MRI<br \/>\nPositive<\/td><td class=\"column-2\">49<\/td><td class=\"column-3\">5<\/td><td class=\"column-4\"><\/td>\n<\/tr>\n<tr class=\"row-3\">\n\t<td class=\"column-1\">MRI<br \/>\nNegative<\/td><td class=\"column-2\">1<\/td><td class=\"column-3\">45<\/td><td class=\"column-4\"><\/td>\n<\/tr>\n<tr class=\"row-4\">\n\t<td class=\"column-1\"><\/td><td class=\"column-2\"><\/td><td class=\"column-3\"><\/td><td class=\"column-4\">100<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<!-- #tablepress-16 from cache -->\n\n\n<p><strong>Positive Predictive Value (ppv, also called precision):<\/strong><\/p>\n\n\n\n<p>When the test is positive, what is the probability the person has the condition:<\/p>\n\n\n\n<table id=\"tablepress-17\" class=\"tablepress tablepress-id-17\">\n<thead>\n<tr class=\"row-1\">\n\t<td class=\"column-1\"><\/td><th class=\"column-2\">Athroscopy<br \/>\nPositive<\/th><th class=\"column-3\">Arthroscopy<br \/>\nNegative<\/th><td class=\"column-4\"><\/td>\n<\/tr>\n<\/thead>\n<tbody class=\"row-striping row-hover\">\n<tr class=\"row-2\">\n\t<td class=\"column-1\">MRI<br \/>\nPositive<\/td><td class=\"column-2\"><strong>49<\/strong><\/td><td class=\"column-3\"><strong>5<\/strong><\/td><td class=\"column-4\"><strong>54<\/strong><\/td>\n<\/tr>\n<tr class=\"row-3\">\n\t<td class=\"column-1\">MRI<br \/>\nNegative<\/td><td class=\"column-2\">1<\/td><td class=\"column-3\">45<\/td><td class=\"column-4\"><\/td>\n<\/tr>\n<tr class=\"row-4\">\n\t<td class=\"column-1\"><\/td><td class=\"column-2\"><\/td><td class=\"column-3\"><\/td><td class=\"column-4\">100<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<!-- #tablepress-17 from cache -->\n\n\n<div class=\"wp-block-mathml-mathmlblock\">\\(PPV  = \\frac{49}{54} \\approx 0.907 \\)<script src=\"https:\/\/pcool.dyndns.org\/wp-includes\/js\/dist\/hooks.min.js?ver=dd5603f07f9220ed27f1\" id=\"wp-hooks-js\"><\/script>\n<script src=\"https:\/\/pcool.dyndns.org\/wp-includes\/js\/dist\/i18n.min.js?ver=c26c3dc7bed366793375\" id=\"wp-i18n-js\"><\/script>\n<script id=\"wp-i18n-js-after\">\nwp.i18n.setLocaleData( { 'text direction\\u0004ltr': [ 'ltr' ] } );\n\/\/# sourceURL=wp-i18n-js-after\n<\/script>\n<script  async src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/mathjax\/2.7.7\/MathJax.js?config=TeX-MML-AM_CHTML\" id=\"mathjax-js\"><\/script>\n<\/div>\n\n\n\n<p>So, 91% of the patients who had a positive MRI-scan were indeed found to have a meniscal tear at arthroscopy. 9% of the patients with a positive scan did not have a meniscal tear. Patients with a positive MRI-scan are therefore likely to have a meniscal tear (91%). <strong>The positive predictive value is the probability that a person who is test positive indeed has the condition<\/strong>. The value ranges from 0 to 100 %. If the positive predictive value is 100%, all test positives are also true positives. In other words, there will be no patients with a false positive test (b=0). If the positive predictive value is 50%, there are as many true positives as there are false positives (a=b). Consequently, a positive test has no value in diagnosing disease. If the positive predictive value is 0%, there are no true positives (a=0), and all people with a positive test are false positives. This does not necessarily mean that the test is useless. It might well be that a negative test is helpful in excluding disease.<\/p>\n\n\n\n<p><strong>Negative Predictive Value (npv):<\/strong><\/p>\n\n\n\n<table id=\"tablepress-18\" class=\"tablepress tablepress-id-18\">\n<thead>\n<tr class=\"row-1\">\n\t<td class=\"column-1\"><\/td><th class=\"column-2\">Athroscopy<br \/>\nPositive<\/th><th class=\"column-3\">Arthroscopy<br \/>\nNegative<\/th><td class=\"column-4\"><\/td>\n<\/tr>\n<\/thead>\n<tbody class=\"row-striping row-hover\">\n<tr class=\"row-2\">\n\t<td class=\"column-1\">MRI<br \/>\nPositive<\/td><td class=\"column-2\">49<\/td><td class=\"column-3\">5<\/td><td class=\"column-4\">54<\/td>\n<\/tr>\n<tr class=\"row-3\">\n\t<td class=\"column-1\">MRI<br \/>\nNegative<\/td><td class=\"column-2\"><strong>1<\/strong><\/td><td class=\"column-3\"><strong>45<\/strong><\/td><td class=\"column-4\"><strong>46<\/strong><\/td>\n<\/tr>\n<tr class=\"row-4\">\n\t<td class=\"column-1\"><\/td><td class=\"column-2\"><\/td><td class=\"column-3\"><\/td><td class=\"column-4\">100<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<!-- #tablepress-18 from cache -->\n\n\n<div class=\"wp-block-mathml-mathmlblock\">\\(NPV = \\frac{45}{46} \\approx 0.978 \\)<\/div>\n\n\n\n<p>So, 98% of the patients who had a negative MRI-scan indeed did not have a meniscal tear at arthroscopy. Only 2% of the patients with a negative scan were found to have a meniscal tear at arthroscopy. Patients with a negative MRI-scan are therefore unlikely to have a meniscal tear. <strong>The negative predictive value is the probability that a person who is test negative does not have the condition.<\/strong> The value ranges from 0 to 100 %. If the negative predictive value is 100%, all test negatives are also true negatives. In other words, there will be no patients with a false negative test (c=0). If the negative predictive value is 50%, there are as many true negatives as there are false negatives (c=d). Consequently, a negative test has no value in excluding disease. If the negative predictive value is 0%, there are no true negatives (d=0), and all people with a negative test are false negatives. This does not necessarily mean that the test is useless. It might well be that a positive test is helpful in diagnosing disease.<\/p>\n\n\n\n<p><strong>Sensitivity (also called recall):<\/strong><\/p>\n\n\n\n<table id=\"tablepress-19\" class=\"tablepress tablepress-id-19\">\n<thead>\n<tr class=\"row-1\">\n\t<td class=\"column-1\"><\/td><th class=\"column-2\">Athroscopy<br \/>\nPositive<\/th><th class=\"column-3\">Arthroscopy<br \/>\nNegative<\/th><td class=\"column-4\"><\/td>\n<\/tr>\n<\/thead>\n<tbody class=\"row-striping row-hover\">\n<tr class=\"row-2\">\n\t<td class=\"column-1\">MRI<br \/>\nPositive<\/td><td class=\"column-2\"><strong>49<\/strong><\/td><td class=\"column-3\">5<\/td><td class=\"column-4\">54<\/td>\n<\/tr>\n<tr class=\"row-3\">\n\t<td class=\"column-1\">MRI<br \/>\nNegative<\/td><td class=\"column-2\"><strong>1<\/strong><\/td><td class=\"column-3\">45<\/td><td class=\"column-4\">46<\/td>\n<\/tr>\n<tr class=\"row-4\">\n\t<td class=\"column-1\"><\/td><td class=\"column-2\"><strong>50<\/strong><\/td><td class=\"column-3\"><\/td><td class=\"column-4\">100<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<!-- #tablepress-19 from cache -->\n\n\n<div class=\"wp-block-mathml-mathmlblock\">\\(Sensitivity = \\frac{49}{50} = 0.98 \\)<\/div>\n\n\n\n<p>So, 98% of the patients who were found to have a meniscal tear at arthroscopy had a positive MRI-scan. Only 2% of the patients with a meniscal tear had a negative MRI-scan. Therefore, an MRI-scan is very good in picking up patients who have a meniscal tear. <strong>The sensitivity, or true positive rate, describes how good a test is in picking up people with the condition. <\/strong>The value ranges from 0 to 100 %. If the sensitivity is 100%, all positives are true positives. In other words, there are no false negatives (c=0). If the sensitivity is 50%, there are as many true positives as there are false negatives (a=c). Indicating that the test has no use in picking up disease. If the sensitivity is 0%, there are no true positives (a=0), and all people with the condition are false negatives. This does not necessarily mean the test is useless. It might well be good in excluding disease.<\/p>\n\n\n\n<p><strong>Specificity:<\/strong><\/p>\n\n\n\n<table id=\"tablepress-20\" class=\"tablepress tablepress-id-20\">\n<thead>\n<tr class=\"row-1\">\n\t<td class=\"column-1\"><\/td><th class=\"column-2\">Athroscopy<br \/>\nPositive<\/th><th class=\"column-3\">Arthroscopy<br \/>\nNegative<\/th><td class=\"column-4\"><\/td>\n<\/tr>\n<\/thead>\n<tbody class=\"row-striping row-hover\">\n<tr class=\"row-2\">\n\t<td class=\"column-1\">MRI<br \/>\nPositive<\/td><td class=\"column-2\">49<\/td><td class=\"column-3\"><strong>5<\/strong><\/td><td class=\"column-4\">54<\/td>\n<\/tr>\n<tr class=\"row-3\">\n\t<td class=\"column-1\">MRI<br \/>\nNegative<\/td><td class=\"column-2\">1<\/td><td class=\"column-3\"><strong>45<\/strong><\/td><td class=\"column-4\">46<\/td>\n<\/tr>\n<tr class=\"row-4\">\n\t<td class=\"column-1\"><\/td><td class=\"column-2\">50<\/td><td class=\"column-3\"><strong>50<\/strong><\/td><td class=\"column-4\">100<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<!-- #tablepress-20 from cache -->\n\n\n<div class=\"wp-block-mathml-mathmlblock\">\\(Specificity = \\frac{45}{50} = 0.9 \\)<\/div>\n\n\n\n<p>So, 90% of the patients who (at arthroscopy) did not have a meniscal tear had a negative MRI-scan. 10% of the patients without a meniscal tear had a positive MRI-scan. Therefore, an MRI-scan is good in excluding patients who do not have a meniscal tear. <strong>The specificity, or true negative rate, describes how good a test is in correctly excluding people without the condition. <\/strong>The value ranges from 0 to 100 %. If the specificity is 100%, all negatives are true negatives. In other words, there are no false positives (b=0). If the specificity is 50%, there are as many true negatives as there are false positives (b=d). Indicating that the test has no use in excluding disease. If the specificity is 0%, there are no true negatives (d=0), and all people without the condition are false positives. This does not necessarily mean the test is useless. It might well be good in picking up disease.<\/p>\n\n\n\n<p><strong>Accuracy:<\/strong><\/p>\n\n\n\n<table id=\"tablepress-21\" class=\"tablepress tablepress-id-21\">\n<thead>\n<tr class=\"row-1\">\n\t<td class=\"column-1\"><\/td><th class=\"column-2\">Athroscopy<br \/>\nPositive<\/th><th class=\"column-3\">Arthroscopy<br \/>\nNegative<\/th><td class=\"column-4\"><\/td>\n<\/tr>\n<\/thead>\n<tbody class=\"row-striping row-hover\">\n<tr class=\"row-2\">\n\t<td class=\"column-1\">MRI<br \/>\nPositive<\/td><td class=\"column-2\"><strong>49<\/strong><\/td><td class=\"column-3\">5<\/td><td class=\"column-4\">54<\/td>\n<\/tr>\n<tr class=\"row-3\">\n\t<td class=\"column-1\">MRI<br \/>\nNegative<\/td><td class=\"column-2\">1<\/td><td class=\"column-3\"><strong>45<\/strong><\/td><td class=\"column-4\">46<\/td>\n<\/tr>\n<tr class=\"row-4\">\n\t<td class=\"column-1\"><\/td><td class=\"column-2\">50<\/td><td class=\"column-3\">50<\/td><td class=\"column-4\"><strong>100<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<!-- #tablepress-21 from cache -->\n\n\n<div class=\"wp-block-mathml-mathmlblock\">\\(Accuracy = \\frac{49+45}{100}=0.94 \\)<\/div>\n\n\n\n<p>So, in 94% of all MRI-scans performed, the result of the scan was correct. Accuracy \u2018combines\u2019 the specificity and the sensitivity of a test. The value is between 0 and 100 %. If the accuracy of a test is 100%, there were no false positives and no false negatives (b=0 and c=0). Indicating that the test is very useful. If the accuracy is 50%, there are just as many incorrect as correct results. In other words, the true positives plus true negatives equal the false positives plus false negatives (a+d = b+c). Consequently, the test is useless in diagnosing the disease. If the accuracy is 0%, there are no true positives and true negatives (a=0 and d=0). Indicating that the test is always incorrect! This does not necessarily mean the test is useless. It could be just as useful to know if a test is incorrect as if it is correct.<\/p>\n\n\n\n<p>To calculate the sensitivity, specificity, positive predictive value and negative predictive value in R is straight forward with the <a href=\"http:\/\/pcool.dyndns.org:8080\/statsbook\/?page_id=22\">epiR package<\/a><sup class='sup-ref-note' id='note-zotero-ref-p813-r1-o1'><a class='sup-ref-note' href='#zotero-ref-p813-r1'>1<\/a><\/sup>:<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code><em><mark style=\"background-color:rgba(0, 0, 0, 0);color:#f80404\" class=\"has-inline-color\">library(epiR)\n<\/mark><mark style=\"background-color:rgba(0, 0, 0, 0);color:#2305f7\" class=\"has-inline-color\">Package epiR 2.0.84 is loaded\nType help(epi.about) for summary information\nType browseVignettes(package = 'epiR') to learn how to use epiR for applied epidemiological analyses\n\n<\/mark><mark style=\"background-color:rgba(0, 0, 0, 0);color:#f80404\" class=\"has-inline-color\">\nmat &lt;- matrix(c(49,5,1,45),byrow=TRUE, ncol=2)\nmat\n<\/mark><mark style=\"background-color:rgba(0, 0, 0, 0);color:#3405f7\" class=\"has-inline-color\">     &#091;,1] &#091;,2]\n&#091;1,]   49    5\n&#091;2,]    1   45\n<\/mark><mark style=\"background-color:rgba(0, 0, 0, 0);color:#f70515\" class=\"has-inline-color\">epi.tests(mat)<\/mark><mark style=\"background-color:rgba(0, 0, 0, 0);color:#3405f7\" class=\"has-inline-color\">\n          Outcome +    Outcome -      Total\nTest +           49            5         54\nTest -            1           45         46\nTotal            50           50        100\n\nPoint estimates and 95% CIs:\n--------------------------------------------------------------\nApparent prevalence *                  0.54 (0.44, 0.64)\nTrue prevalence *                      0.50 (0.40, 0.60)\nSensitivity *                          0.98 (0.89, 1.00)\nSpecificity *                          0.90 (0.78, 0.97)\nPositive predictive value *            0.91 (0.80, 0.97)\nNegative predictive value *            0.98 (0.88, 1.00)\nPositive likelihood ratio              9.80 (4.26, 22.53)\nNegative likelihood ratio              0.02 (0.00, 0.16)\nFalse T+ proportion for true D- *      0.10 (0.03, 0.22)\nFalse T- proportion for true D+ *      0.02 (0.00, 0.11)\nFalse T+ proportion for T+ *           0.09 (0.03, 0.20)\nFalse T- proportion for T- *           0.02 (0.00, 0.12)\nCorrectly classified proportion *      0.94 (0.87, 0.98)\n--------------------------------------------------------------\n* Exact CIs<\/mark><\/em><\/code><\/pre>\n\n\n\n<p class=\"is-style-text-annotation is-style-text-annotation--2\">Please note the byrow=TRUE is required if data is entered by row. By default byrow=FALSE<\/p>\n\n\n\n<p><strong>Precision:<\/strong><\/p>\n\n\n\n<p>Accuracy should not be confused with precision and can have two meanings:<\/p>\n\n\n\n<p>1: Precision<\/p>\n\n\n\n<p>Precision is defined as the <strong>closeness of repeated measurements of the same quantity. <\/strong>Whilst accuracy is the closeness of a measured variate to its true value. Precision indicates the variability of the estimate over all samples. A precise indicator will have a small variability (small standard deviation). Consequently, the precision is:<\/p>\n\n\n\n<div class=\"wp-block-mathml-mathmlblock\">\\(Precision = \\frac{1}{Variance} = \\frac{1}{\\sigma^2} \\)<\/div>\n\n\n\n<p>For example, a person&#8217;s mass is 65.2 kg. If the person is repeatedly measured on the electronic scales and the mean mass is 60.00001 kg (standard deviation 0.0000001 kg). The measurement is very precise, but not very accurate.<\/p>\n\n\n\n<p>2: Precision (machine learning)<\/p>\n\n\n\n<p>In machine learning and artificial intelligence, papers often refer to precision and recall. In this context, <strong>precision refers to the positive predictive value<\/strong> , whilst <strong>recall is the same as the sensitivity<\/strong>(see above).<\/p>\n\n\n\n<p><strong>Validation<\/strong><\/p>\n\n\n\n<p>Validation is confirmation (by evidence) that the measure can be used consistently for its intended use.<br>In general: <\/p>\n\n\n\n<table id=\"tablepress-22\" class=\"tablepress tablepress-id-22\">\n<thead>\n<tr class=\"row-1\">\n\t<td class=\"column-1\"><\/td><th class=\"column-2\">Athroscopy<br \/>\nPositive<\/th><th class=\"column-3\">Arthroscopy<br \/>\nNegative<\/th><td class=\"column-4\"><\/td>\n<\/tr>\n<\/thead>\n<tbody class=\"row-striping row-hover\">\n<tr class=\"row-2\">\n\t<td class=\"column-1\">MRI<br \/>\nPositive<\/td><td class=\"column-2\">a<\/td><td class=\"column-3\">b<\/td><td class=\"column-4\">a + b<\/td>\n<\/tr>\n<tr class=\"row-3\">\n\t<td class=\"column-1\">MRI<br \/>\nNegative<\/td><td class=\"column-2\">c<\/td><td class=\"column-3\">d<\/td><td class=\"column-4\">c + d<\/td>\n<\/tr>\n<tr class=\"row-4\">\n\t<td class=\"column-1\"><\/td><td class=\"column-2\">a + c<\/td><td class=\"column-3\">b + d<\/td><td class=\"column-4\">a + b + c + d<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<!-- #tablepress-22 from cache -->\n\n\n<p>True Positive: a<\/p>\n\n\n\n<p>False Positive: b<\/p>\n\n\n\n<p>False Negative: c<\/p>\n\n\n\n<p>True Negative: d<\/p>\n\n\n\n<div class=\"wp-block-mathml-mathmlblock\">\\( Positive Predictive Value = PPV = \\frac{a}{a+b} \\)<\/div>\n\n\n\n<div class=\"wp-block-mathml-mathmlblock\">\\( Negative Predictive Value = PPV = \\frac{d}{c+d} \\)<\/div>\n\n\n\n<div class=\"wp-block-mathml-mathmlblock\">\\( Sensitivity = Sens = \\frac{a}{a+c} \\)<\/div>\n\n\n\n<div class=\"wp-block-mathml-mathmlblock\">\\( Specificity = Spec = \\frac{d}{b+d} \\)<\/div>\n\n\n\n<div class=\"wp-block-mathml-mathmlblock\">\\( Accuracy= Acc = \\frac{a + d}{a+b+c+d} \\)<\/div>\n\n\n\n<div class=\"wp-block-mathml-mathmlblock\"><\/div>\n\n\n\n<p><strong>Or in R:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code><span style=\"color: #ff0000;\"><em>library(epiR)<\/em><\/span>\n<span style=\"color: #ff0000;\"><em>mat&lt;-matrix(c(a,b,c,d),byrow=TRUE,ncol=2) <\/em><\/span>{enter values by row}\n<span style=\"color: #ff0000;\"><em>epi.tests(mat)<\/em><\/span>\n<span style=\"color: #0000ff;\"><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Disease +&nbsp;&nbsp;&nbsp; Disease -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Total<\/em><\/span>\n<span style=\"color: #0000ff;\"><em>Test +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/em><\/span>\n<span style=\"color: #0000ff;\"><em>Test -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; d &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/em><\/span>\n<span style=\"color: #0000ff;\"><em>Total<\/em><\/span>\n\n<span style=\"color: #0000ff;\"><em>Point estimates and 95 % CIs:<\/em><\/span>\n<span style=\"color: #0000ff;\"><em>---------------------------------------------------------<\/em><\/span>\n<span style=\"color: #0000ff;\"><em>Apparent prevalence&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/em><\/span>\n<span style=\"color: #0000ff;\"><em>True prevalence&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/em><\/span>\n<span style=\"color: #0000ff;\"><em>Sensitivity&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/em><\/span>\n<span style=\"color: #0000ff;\"><em>Specificity&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/em><\/span>\n<span style=\"color: #0000ff;\"><em>Positive predictive value&nbsp;&nbsp; <\/em><\/span>\n<span style=\"color: #0000ff;\"><em>Negative predictive value&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/em><\/span>\n<span style=\"color: #0000ff;\"><em>Positive likelihood ratio&nbsp;&nbsp;&nbsp;&nbsp; <\/em><\/span>\n<span style=\"color: #0000ff;\"><em>Negative likelihood ratio&nbsp;&nbsp;&nbsp; <\/em><\/span>\n<span style=\"color: #0000ff;\"><em>---------------------------------------------------------<\/em><\/span><\/code><\/pre>\n\n\n\n<p>In the table, the gold standard (\u2018truth\u2019) is in the columns and the test we validate against this standard is in rows. It is important to realise that the formulas will be different if we change the columns and rows. It is therefore <strong>not<\/strong> advisable to learn the formulas of by heart. It is better to approach it systematically. It should also be clear from the previous that any of the five performance measures discussed <strong><em>on their own<\/em><\/strong> are of limited value. The accuracy is often selected as a collective measure. However, when combining ratios, it is better to calculate the harmonic mean (of F1 score). In general, it is better to look at the 2 \u00d7 2 table and review the numbers in context in what is required (sometimes a high sensitivity is required but at other times a high specificity). This is further illustrated in two examples.<\/p>\n\n\n\n<p><strong>Example 1:<\/strong><\/p>\n\n\n\n<p>Very sensitive test; fire alarm:<\/p>\n\n\n\n<table id=\"tablepress-23\" class=\"tablepress tablepress-id-23\">\n<thead>\n<tr class=\"row-1\">\n\t<td class=\"column-1\"><\/td><th class=\"column-2\">Truth<br \/>\nPositive<\/th><th class=\"column-3\">Truth<br \/>\nNegative<\/th><td class=\"column-4\"><\/td>\n<\/tr>\n<\/thead>\n<tbody class=\"row-striping row-hover\">\n<tr class=\"row-2\">\n\t<td class=\"column-1\">Test<br \/>\nPositive<\/td><td class=\"column-2\">1<\/td><td class=\"column-3\">39<\/td><td class=\"column-4\">40<\/td>\n<\/tr>\n<tr class=\"row-3\">\n\t<td class=\"column-1\">Test<br \/>\nNegative<\/td><td class=\"column-2\">0<\/td><td class=\"column-3\">60<\/td><td class=\"column-4\">60<\/td>\n<\/tr>\n<tr class=\"row-4\">\n\t<td class=\"column-1\"><\/td><td class=\"column-2\">1<\/td><td class=\"column-3\">99<\/td><td class=\"column-4\">100<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<!-- #tablepress-23 from cache -->\n\n\n<p>True Positive: 1, False Positive: 39, False Negative: 0, True Negative: 60<\/p>\n\n\n\n<p>ppv = 2.5%, npv = 100%, Sensitivity = 100%, Specificity \u2248 61%, Accuracy = 61%<\/p>\n\n\n\n<p><strong>Or in R:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code><em><mark style=\"background-color:rgba(0, 0, 0, 0);color:#f50b0b\" class=\"has-inline-color\"><span style=\"color: #ff0000;\">library(epiR)<\/span>\nmat &lt;- matrix(c(1,39,0,60), byrow=TRUE, ncol=2)\nepi.tests(mat)<\/mark><mark style=\"background-color:rgba(0, 0, 0, 0);color:#0a24f5\" class=\"has-inline-color\">\n          Outcome +    Outcome -      Total\nTest +            1           39         40\nTest -            0           60         60\nTotal             1           99        100\n\nPoint estimates and 95% CIs:\n--------------------------------------------------------------\nApparent prevalence *                  0.40 (0.30, 0.50)\nTrue prevalence *                      0.01 (0.00, 0.05)\n<strong>Sensitivity *                          1.00 (0.03, 1.00)\nSpecificity *                          0.61 (0.50, 0.70)\nPositive predictive value *            0.03 (0.00, 0.13)\nNegative predictive value *            1.00 (0.94, 1.00)<\/strong>\nPositive likelihood ratio              2.54 (1.99, 3.24)\nNegative likelihood ratio              0.00 (0.00, NaN)\nFalse T+ proportion for true D- *      0.39 (0.30, 0.50)\nFalse T- proportion for true D+ *      0.00 (0.00, 0.97)\nFalse T+ proportion for T+ *           0.97 (0.87, 1.00)\nFalse T- proportion for T- *           0.00 (0.00, 0.06)\n<strong>Correctly classified proportion *      0.61 (0.51, 0.71)<\/strong>\n--------------------------------------------------------------\n* Exact CIs<\/mark><\/em><\/code><\/pre>\n\n\n\n<p><strong>Example 2:<\/strong><\/p>\n\n\n\n<p>Very specific test; being caught for speeding:<\/p>\n\n\n\n<table id=\"tablepress-24\" class=\"tablepress tablepress-id-24\">\n<thead>\n<tr class=\"row-1\">\n\t<td class=\"column-1\"><\/td><th class=\"column-2\">Truth<br \/>\nPositive<\/th><th class=\"column-3\">Truth<br \/>\nNegative<\/th><td class=\"column-4\"><\/td>\n<\/tr>\n<\/thead>\n<tbody class=\"row-striping row-hover\">\n<tr class=\"row-2\">\n\t<td class=\"column-1\">Test<br \/>\nPositive<\/td><td class=\"column-2\">1<\/td><td class=\"column-3\">0<\/td><td class=\"column-4\">1<\/td>\n<\/tr>\n<tr class=\"row-3\">\n\t<td class=\"column-1\">Test<br \/>\nNegative<\/td><td class=\"column-2\">39<\/td><td class=\"column-3\">60<\/td><td class=\"column-4\">99<\/td>\n<\/tr>\n<tr class=\"row-4\">\n\t<td class=\"column-1\"><\/td><td class=\"column-2\">40<\/td><td class=\"column-3\">60<\/td><td class=\"column-4\">100<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<!-- #tablepress-24 from cache -->\n\n\n<p>True Positive: 1, False Positive: 0, False Negative: 39, True Negative: 60<\/p>\n\n\n\n<p>ppv = 100%, npv&nbsp;\u2248 61%, Sensitivity = 2.5%, Specificity = 100%, Accuracy = 61%<\/p>\n\n\n\n<p><strong>Or in R:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code><span style=\"color: #ff0000;\"><em>library(epiR)<\/em><\/span>\n<em><mark style=\"background-color:rgba(0, 0, 0, 0);color:#f80202\" class=\"has-inline-color\">mat &lt;- matrix(c(1,0,39,60), byrow=TRUE, ncol=2)\nepi.tests(mat)\n<\/mark><mark style=\"background-color:rgba(0, 0, 0, 0);color:#3a02f7\" class=\"has-inline-color\">          Outcome +    Outcome -      Total\nTest +            1            0          1\nTest -           39           60         99\nTotal            40           60        100\n\nPoint estimates and 95% CIs:\n--------------------------------------------------------------\nApparent prevalence *                  0.01 (0.00, 0.05)\nTrue prevalence *                      0.40 (0.30, 0.50)\n<strong>Sensitivity *                          0.03 (0.00, 0.13)\nSpecificity *                          1.00 (0.94, 1.00)\nPositive predictive value *            1.00 (0.03, 1.00)\nNegative predictive value *            0.61 (0.50, 0.70)<\/strong>\nPositive likelihood ratio              Inf (NaN, Inf)\nNegative likelihood ratio              0.97 (0.93, 1.02)\nFalse T+ proportion for true D- *      0.00 (0.00, 0.06)\nFalse T- proportion for true D+ *      0.97 (0.87, 1.00)\nFalse T+ proportion for T+ *           0.00 (0.00, 0.97)\nFalse T- proportion for T- *           0.39 (0.30, 0.50)\n<strong>Correctly classified proportion *      0.61 (0.51, 0.71)<\/strong>\n--------------------------------------------------------------\n* Exact CIs<\/mark><\/em><\/code><\/pre>\n\n\n\n<p>It is important to bear in mind that a test can be sensitive for one purpose, but not necessarily for another. For example, a bone scan is very sensitive in picking up abnormalities such as fractures and infections. However, it is not very helpful in picking up multiple myeloma. For that purpose, it would be better to use an MRI scan of the marrow areas. If a test is used for screening, it is very important to make sure it has a high sensitivity. It is obviously unsatisfactory to miss disease with a screening investigation. If this investigation is not very specific, subsequent investigations can be performed to increase diagnostic accuracy (eliminate the false positives).<\/p>\n\n\n\n<p>All tests have their limitations, and the most appropriate investigation should be selected for what is being investigated. Sometimes, a combination of investigations is used. Usually, the simplest and most sensitive investigations are performed first, followed by the more specific investigations to increase diagnostic accuracy.<\/p>\n\n\n\n<p>To create radar or spider-web plots of different tests, please refer to the <a href=\"https:\/\/pcool.dyndns.org\/index.php\/radar-plots\/\" data-type=\"page\" data-id=\"1884\">radar plots<\/a> page.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In medicine, diagnostic tests are used to make a diagnosis. For example, an MRI-scan is performed to diagnose a meniscal tear or a CT-scan to see if someone has a tarsal coalition. Some diagnostic tests are better than others. An MRI-scan of the knee, for example, is better in diagnosing a meniscal tear than a [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"footnotes":""},"class_list":["post-813","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/pcool.dyndns.org\/index.php\/wp-json\/wp\/v2\/pages\/813","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pcool.dyndns.org\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/pcool.dyndns.org\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/pcool.dyndns.org\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/pcool.dyndns.org\/index.php\/wp-json\/wp\/v2\/comments?post=813"}],"version-history":[{"count":6,"href":"https:\/\/pcool.dyndns.org\/index.php\/wp-json\/wp\/v2\/pages\/813\/revisions"}],"predecessor-version":[{"id":5244,"href":"https:\/\/pcool.dyndns.org\/index.php\/wp-json\/wp\/v2\/pages\/813\/revisions\/5244"}],"wp:attachment":[{"href":"https:\/\/pcool.dyndns.org\/index.php\/wp-json\/wp\/v2\/media?parent=813"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}