Tools › Statistics › Hypothesis Tests › Diagnostic Accuracy and Agreement


Diagnostic Accuracy and Agreement

Evaluates a diagnostic or screening test and the agreement between raters or measurement methods: sensitivity, specificity, predictive values and likelihood ratios from a 2 × 2 table with exact and Wilson confidence intervals, comparison of two tests by McNemar's test, ROC curves with the area under the curve and DeLong's comparison, Cohen's and Fleiss' agreement coefficients, Bland–Altman limits of agreement and intraclass correlations.

  • 2 × 2 table: sensitivity, specificity, predictive values at the sample and at an entered prevalence, likelihood ratios, diagnostic odds ratio, accuracy and Youden index, each with confidence limits

  • Two tests compared on the same subjects (McNemar exact and mid-p) or on separate samples (Fisher, Newcombe interval); sample size for a wanted precision

  • ROC curve from pasted scores: area with Hanley–McNeil and DeLong standard errors, DeLong test of two correlated areas, Youden and cost-weighted cut-offs, partial area

  • Agreement of raters: Cohen's coefficient with linear and quadratic weights, Fleiss' coefficient for several raters, prevalence and bias indices, percent agreement

  • Agreement of measurements: Bland–Altman limits with confidence intervals, repeatability, Lin's concordance correlation, Deming regression, six Shrout–Fleiss intraclass correlations

Diagnostic Accuracy and Agreement


Unit System: /

Analysis



Diagnostic Test (2 × 2 table against the comparator)







Subjects With the Condition (both tests on each subject)





Subjects Without the Condition





Test 1 (its own sample)





Test 2 (a separate sample)





Sample Size for a Diagnostic Accuracy Study





ROC Curve








Agreement of Two Raters



Agreement of Several Raters



Method Comparison




Intraclass Correlation


×

Diagnostic Accuracy and Agreement

Diagnostic Accuracy and Agreement

Two different questions

A study of a test, a rater or a measuring instrument asks one of two questions. Accuracy: how often is the result right? That needs a reference standard, the best available way of establishing whether the condition is present. Agreement: how closely do two results match, when neither is known to be right? Two tests can agree and both be wrong, so agreement is not accuracy, and the FDA guidance of 2007 asks that results against a non-reference standard be reported as percent agreement and never as sensitivity or specificity. The first five analyses of this page are about accuracy, the last four about agreement.

The 2 × 2 table

With a reference standard the subjects fall into four cells: true positives TP, false positives FP, false negatives FN and true negatives TN. Sensitivity = TP / (TP + FN) is the share of subjects with the condition whom the test finds; specificity = TN / (FP + TN) the share without it whom the test clears. Both are properties of the test in the kind of subjects studied and do not depend on how many of each were sampled. The positive predictive value TP / (TP + FP) and the negative predictive value TN / (TN + FN) answer the clinical question, what a positive or a negative result means, but they depend on the prevalence p of the condition. By Bayes' theorem

PPV = Se p / [Se p + (1 − Sp)(1 − p)],   NPV = Sp (1 − p) / [Sp (1 − p) + (1 − Se) p].

The predictive values counted in the sample hold only at the sample's prevalence, and mean nothing in a case-control sample where the numbers with and without the condition were fixed by the investigator; enter the prevalence of the population in which the test will be used to get the values that apply there.

The likelihood ratios LR+ = Se / (1 − Sp) and LR− = (1 − Se) / Sp say how much a result shifts the odds of the condition: post-test odds = pre-test odds × LR. The diagnostic odds ratio (TP × TN) / (FP × FN) = LR+ / LR− condenses the table into one number, and the Youden index J = Se + Sp − 1 runs from 0 (useless) to 1 (perfect). Accuracy (TP + TN) / n is given for completeness; like the predictive values it depends on prevalence.

Confidence limits of a proportion

Each proportion x / n carries two intervals. The Wilson score interval, the one printed in the FDA guidance, is

[p̂ + z² / (2n) ± z √(p̂ (1 − p̂) / n + z² / (4n²))] / (1 + z² / n),

with z the normal quantile of the confidence level. The exact (Clopper–Pearson) interval inverts the binomial distribution: its limits are the quantiles α/2 of Beta(x, n − x + 1) and 1 − α/2 of Beta(x + 1, n − x). It never covers less than the stated level and is therefore somewhat wider. Neither needs the large counts that the simple p̂ ± z √(p̂ q̂ / n) interval needs, which fails for proportions near 0 or 1, exactly where good tests live.

The limits of a likelihood ratio are found on the log scale: ln LR+ ± z √[1/TP − 1/(TP + FN) + 1/FP − 1/(FP + TN)], and the same with FN and TN for LR−. The odds ratio uses ln DOR ± z √(1/TP + 1/FP + 1/FN + 1/TN), with ½ added to every cell when one is zero. The limits of a predictive value at an entered prevalence come from carrying the likelihood-ratio limits through Bayes' theorem, which is the logit method of Mercaldo, Lau and Zhou. The Youden index has a normal-approximation interval and a Newcombe interval built from the Wilson limits of sensitivity and of the false-positive rate; the second behaves better near 1.

Comparing two tests

Same subjects. When both tests are read on every subject, only the discordant subjects carry information about which test is more sensitive: b subjects positive on test 1 alone and c on test 2 alone, among those with the condition. Under equal sensitivity they should split evenly, so McNemar's exact test is the two-sided binomial probability of a split at least as uneven as b : c with chance ½. The exact test is conservative; the mid-p value, which counts only half the probability of the observed split, is closer to the nominal level and is the one recommended by Fagerland, Lydersen and Laake. The large-sample statistic (b − c)² / (b + c) is given with and without the continuity correction. The difference of the two sensitivities is (b − c) / n with standard error √[b + c − (b − c)² / n] / n. Specificity is compared in the same way among the subjects without the condition.

Separate samples. When each test has its own subjects, the two sensitivities are independent proportions: the z test with the pooled proportion, Fisher's exact test and the Newcombe interval of the difference, which combines the two Wilson intervals as d − √[(p̂₁ − l₁)² + (u₂ − p̂₂)²] to d + √[(u₁ − p̂₁)² + (p̂₂ − l₂)²].

Sample size

A diagnostic accuracy study is usually sized so that sensitivity and specificity are estimated to a wanted precision. For a proportion expected at P and a half-width d the normal approximation gives n = z² P (1 − P) / d²; the page also solves for the n at which the Wilson interval has that half-width, which is a little larger for proportions near 1. The n for sensitivity counts subjects with the condition and the n for specificity subjects without it, so with prevalence p among those recruited the totals are n / p and n / (1 − p) (Buderer). The larger governs.

ROC analysis

A test that returns a score becomes a positive or negative result only once a cut-off is chosen, and every cut-off trades sensitivity against specificity. The receiver operating characteristic curve plots sensitivity against 1 − specificity for every possible cut-off; the page uses the cut-offs midway between consecutive distinct scores. The area under the empirical curve, by the trapezoid rule, equals the Mann–Whitney statistic: the probability that a randomly chosen subject with the condition scores higher than a randomly chosen subject without it, ties counting ½. It is 0.5 for a useless score and 1 for a perfect one.

Two standard errors are given. Hanley and McNeil's is √{[A (1 − A) + (m − 1)(Q₁ − A²) + (n − 1)(Q₂ − A²)] / (m n)} with Q₁ = A / (2 − A) and Q₂ = 2A² / (1 + A), for m subjects with and n without the condition; it rests on an assumed shape of the score distributions. DeLong's is nonparametric. For each subject with the condition let V₁₀ be the share of subjects without it that score lower (ties ½), and for each subject without it let V₀₁ be the share of subjects with the condition that score higher. The area is the mean of either set, and its variance is var(V₁₀) / m + var(V₀₁) / n. When two scores are measured on the same subjects the covariance of their areas is cov(V₁₀⁽¹⁾, V₁₀⁽²⁾) / m + cov(V₀₁⁽¹⁾, V₀₁⁽²⁾) / n, and the two areas are compared by z = (A₁ − A₂) / √[var(A₁) + var(A₂) − 2 cov(A₁, A₂)].

Cut-offs. The Youden cut-off maximizes J = sensitivity + specificity − 1, the height of the curve above the chance line. The closest-to-the-corner cut-off minimizes (1 − Se)² + (1 − Sp)². Both treat a false negative and a false positive as equally bad and ignore prevalence. The cost-weighted cut-off maximizes Se + r Sp with r = (1 − p) / (c p), where c is the cost of a false negative relative to a false positive and p the prevalence: a costly false negative or a common condition lowers r and moves the cut-off toward sensitivity. A cut-off chosen and judged on the same data is optimistic and should be confirmed on new subjects.

Partial area. When only high specificities are of practical use (screening), the area can be restricted to a specificity range. The standardized form of McClish, ½ [1 + (area − chance) / (largest − chance)], puts it back on the 0.5 to 1 scale.

Agreement of raters: Cohen's kappa

Two raters who each put n subjects into k categories agree on the share po on the diagonal of their cross-table. Some of that would happen by chance: with row shares pi· and column shares p·i the expected agreement is pe = Σ pi· p·i. Cohen's coefficient κ = (po − pe) / (1 − pe) is the share of the possible agreement beyond chance that was achieved: 1 for perfect agreement, 0 for chance, negative for less than chance.

On an ordered scale a near miss is better than a wide one. Weighted kappa replaces the diagonal count by Σ wij pij and the chance value by Σ wij pi· p·j, with weights wij = 1 − |i − j| / (k − 1) (linear) or 1 − (i − j)² / (k − 1)² (quadratic). Quadratic weighted kappa is close to an intraclass correlation of the category numbers. The standard errors are the large-sample values of Fleiss, Cohen and Everitt: one for the confidence interval and another, valid under chance agreement, for the test of κ = 0.

Kappa depends on the category totals. In a 2 × 2 table with cells a, b, c, d the prevalence index (a − d) / n measures how unequal the two categories are and the bias index (b − c) / n how differently the raters use them; a large prevalence index lowers κ for the same percent agreement. The prevalence-adjusted bias-adjusted value PABAK = 2 po − 1 (Byrt, Bishop and Carlin) is reported beside κ, with the agreement on each category, 2a / (2a + b + c) and 2d / (2d + b + c), and the FDA's positive and negative percent agreement a / (a + c) and d / (b + d). The Landis–Koch labels (slight to 0.20, fair to 0.40, moderate to 0.60, substantial to 0.80, almost perfect above) are a convention.

Several raters: Fleiss' kappa

When each of N subjects is rated by n raters, not necessarily the same ones, let nij be the number who put subject i in category j. The share of agreeing rater pairs on subject i is Pi = (Σj nij² − n) / [n (n − 1)], and P̄ is its mean. With pj the share of all ratings in category j, chance agreement is P̄e = Σ pj² and κ = (P̄ − P̄e) / (1 − P̄e). Its standard error under chance agreement is √{2 [S² − Σ pj qj (qj − pj)] / [S² N n (n − 1)]} with q = 1 − p and S = Σ pj qj. A coefficient is also given for each category against all others, with standard error √[2 / (N n (n − 1))].

Agreement of measurements: Bland and Altman

Two methods that measure the same quantity are compared through the differences d = A − B on the same subjects. The mean difference d̄ is the bias of one method relative to the other and, if the differences are roughly normal and unrelated to the size of the measurement, 95 % of them lie between the limits of agreement d̄ ± 1.96 s, where s is their standard deviation (Bland and Altman used 2 s). Whether the methods can replace each other is decided by comparing those limits with the largest difference that would not matter in practice; a correlation coefficient cannot decide it, because it measures association along any line and grows with the range of the sample. The standard error of d̄ is s / √n and that of a limit about s √[(1 + k² / 2) / n] for limits at k standard deviations, which is √(3 s² / n) for k = 2; the intervals use Student's t with n − 1 degrees of freedom.

The plot of difference against mean shows whether the assumptions hold. A slope in it means proportional bias; the page fits the least-squares line of difference on mean and tests its slope. When the scatter grows with the mean, a log transformation is the usual remedy.

Repeatability. With a repeat measurement by each method, the standard deviation of the repeat differences (about zero) is s = √(Σ d² / n) and the repeatability coefficient k s is the difference two measurements by the same method seldom exceed. Poor repeatability limits the agreement any other method can have with it. When the methods are compared through the means of their two measurements, the standard deviation of the differences is corrected to sc = √(sD² + ¼ sA² + ¼ sB²).

Lin's concordance correlation ρc = 2 sAB / [sA² + sB² + (Ā − B̄)²] measures how closely the points lie to the line of equality. It is the Pearson correlation r multiplied by a bias factor Cb ≤ 1 that falls with a shift in location or scale. Its interval is found on Fisher's z scale.

Deming regression fits B = a + b A allowing measurement error in both methods, with δ the ratio of the error variance of B to that of A: b = {sBB − δ sAA + √[(sBB − δ sAA)² + 4 δ sAB²]} / (2 sAB). With δ = 1 it is orthogonal regression. Standard errors are by the jackknife (Linnet). An intercept interval excluding 0 points to a constant difference, a slope interval excluding 1 to a proportional one. Passing–Bablok regression is not computed.

Intraclass correlation

For n subjects each rated by k raters, a two-way analysis of variance splits the variation into mean squares between subjects (BMS), between raters (JMS) and residual (EMS); the within-subject mean square WMS pools the last two. Shrout and Fleiss define three single-rating coefficients by the design:

ICC(1,1) = (BMS − WMS) / [BMS + (k − 1) WMS], each subject rated by a different set of raters;
ICC(2,1) = (BMS − EMS) / [BMS + (k − 1) EMS + k (JMS − EMS) / n], the same raters, regarded as a sample of all raters, absolute agreement;
ICC(3,1) = (BMS − EMS) / [BMS + (k − 1) EMS], the same raters and no others, consistency.

The corresponding coefficients for the mean of the k ratings are (BMS − WMS) / BMS, (BMS − EMS) / [BMS + (JMS − EMS) / n] and (BMS − EMS) / BMS. The confidence limits come from the F distributions of the mean-square ratios; for ICC(2,1) they use Satterthwaite's approximate degrees of freedom, as given by Shrout and Fleiss. A systematic difference between raters lowers ICC(2,1) but not ICC(3,1), so the choice between them is the choice between asking for the same number and asking for the same ordering.

What the page does not do

Smoothed or binormal ROC curves, bootstrap intervals, confidence intervals of the partial area and of the cut-off, and tests of more than two curves; Passing–Bablok regression; Bland–Altman limits for repeated measures beyond one repeat per method; kappa for raters who rate different subjects with unequal numbers of ratings; Light's and Conger's coefficients; Krippendorff's alpha; ICC with missing ratings; verification-bias or imperfect-reference corrections. The Newcombe interval is used for independent proportions; the paired difference has the simple large-sample interval only.




References

U.S. Food and Drug Administration (2007). Statistical Guidance on Reporting Results from Studies Evaluating Diagnostic Tests. Guidance for Industry and FDA Staff, Center for Devices and Radiological Health, Rockville, 13 March 2007.

Clopper, C. J., and Pearson, E. S. (1934). "The Use of Confidence or Fiducial Limits Illustrated in the Case of the Binomial." Biometrika, Vol. 26, No. 4, pp. 404–413.

Wilson, E. B. (1927). "Probable Inference, the Law of Succession, and Statistical Inference." Journal of the American Statistical Association, Vol. 22, No. 158, pp. 209–212.

Newcombe, R. G. (1998). "Interval Estimation for the Difference Between Independent Proportions: Comparison of Eleven Methods." Statistics in Medicine, Vol. 17, No. 8, pp. 873–890.

Simel, D. L., Samsa, G. P., and Matchar, D. B. (1991). "Likelihood Ratios with Confidence: Sample Size Estimation for Diagnostic Test Studies." Journal of Clinical Epidemiology, Vol. 44, No. 8, pp. 763–770.

Mercaldo, N. D., Lau, K. F., and Zhou, X. H. (2007). "Confidence Intervals for Predictive Values with an Emphasis to Case-Control Studies." Statistics in Medicine, Vol. 26, No. 10, pp. 2170–2183.

Youden, W. J. (1950). "Index for Rating Diagnostic Tests." Cancer, Vol. 3, No. 1, pp. 32–35.

McNemar, Q. (1947). "Note on the Sampling Error of the Difference Between Correlated Proportions or Percentages." Psychometrika, Vol. 12, No. 2, pp. 153–157.

Fagerland, M. W., Lydersen, S., and Laake, P. (2013). "The McNemar Test for Binary Matched-Pairs Data: Mid-p and Asymptotic Are Better Than Exact Conditional." BMC Medical Research Methodology, Vol. 13, Article 91.

Buderer, N. M. F. (1996). "Statistical Methodology: I. Incorporating the Prevalence of Disease into the Sample Size Calculation for Sensitivity and Specificity." Academic Emergency Medicine, Vol. 3, No. 9, pp. 895–900.

Hanley, J. A., and McNeil, B. J. (1982). "The Meaning and Use of the Area Under a Receiver Operating Characteristic (ROC) Curve." Radiology, Vol. 143, No. 1, pp. 29–36.

DeLong, E. R., DeLong, D. M., and Clarke-Pearson, D. L. (1988). "Comparing the Areas Under Two or More Correlated Receiver Operating Characteristic Curves: A Nonparametric Approach." Biometrics, Vol. 44, No. 3, pp. 837–845.

McClish, D. K. (1989). "Analyzing a Portion of the ROC Curve." Medical Decision Making, Vol. 9, No. 3, pp. 190–195.

Robin, X., Turck, N., Hainard, A., Tiberti, N., Lisacek, F., Sanchez, J.-C., and Müller, M. (2011). "pROC: An Open-Source Package for R and S+ to Analyze and Compare ROC Curves." BMC Bioinformatics, Vol. 12, Article 77.

Cohen, J. (1960). "A Coefficient of Agreement for Nominal Scales." Educational and Psychological Measurement, Vol. 20, No. 1, pp. 37–46.

Cohen, J. (1968). "Weighted Kappa: Nominal Scale Agreement with Provision for Scaled Disagreement or Partial Credit." Psychological Bulletin, Vol. 70, No. 4, pp. 213–220.

Fleiss, J. L., Cohen, J., and Everitt, B. S. (1969). "Large Sample Standard Errors of Kappa and Weighted Kappa." Psychological Bulletin, Vol. 72, No. 5, pp. 323–327.

Fleiss, J. L. (1971). "Measuring Nominal Scale Agreement Among Many Raters." Psychological Bulletin, Vol. 76, No. 5, pp. 378–382.

Byrt, T., Bishop, J., and Carlin, J. B. (1993). "Bias, Prevalence and Kappa." Journal of Clinical Epidemiology, Vol. 46, No. 5, pp. 423–429.

Landis, J. R., and Koch, G. G. (1977). "The Measurement of Observer Agreement for Categorical Data." Biometrics, Vol. 33, No. 1, pp. 159–174.

Bland, J. M., and Altman, D. G. (1986). "Statistical Methods for Assessing Agreement Between Two Methods of Clinical Measurement." The Lancet, Vol. 327, No. 8476, pp. 307–310.

Lin, L. I.-K. (1989). "A Concordance Correlation Coefficient to Evaluate Reproducibility." Biometrics, Vol. 45, No. 1, pp. 255–268.

Linnet, K. (1990). "Estimation of the Linear Relationship Between the Measurements of Two Methods with Proportional Errors." Statistics in Medicine, Vol. 9, No. 12, pp. 1463–1473.

Shrout, P. E., and Fleiss, J. L. (1979). "Intraclass Correlations: Uses in Assessing Rater Reliability." Psychological Bulletin, Vol. 86, No. 2, pp. 420–428.

Koo, T. K., and Li, M. Y. (2016). "A Guideline of Selecting and Reporting Intraclass Correlation Coefficients for Reliability Research." Journal of Chiropractic Medicine, Vol. 15, No. 2, pp. 155–163.

Worked Examples

Published examples this tool reproduces; each page lists the inputs to enter and the printed answers.

All worked examples


DISCLAIMER: The methods and calculation on aNOWysis.com are provided as means to educate the reader. There is no warranty, expessed or implied, as to the relevance or accuracy of the methods or calculations. All calculations should be checked by a qualified analyst for appropriateness and accuracy. We will not be held liable for any damages, injuries or deaths caused by using methods or calculations from this site.