Chapter 15 · Measurement, agreement and diagnosis
Do two observers agree on categories?
Cohen's and weighted kappa, the prevalence problem, McNemar test and measures of association.
Read first: Bias, confounding and validity, Diagnostic tests
The problem first
You are a second-year Radiology resident. For your thesis, you and a senior radiologist independently read 200 chest radiographs of household contacts of TB patients as “active TB” or “no active TB”. You agree on 184 films and write “excellent agreement (92%)”.
The statistician's output shows Cohen's kappa = 0.39. Each of you called only 14 films positive. At the pre-submission seminar the professor of Radiology asks one question.
“You agreed on 92% of the films. Why is your kappa only 0.39?”
Start here
You agree on 92% of films. Why is that not the whole answer?
Two readers agree on some films by chance alone. If most films are negative, two readers who call almost everything negative will agree most of the time without looking carefully.
Imagine two readers who do not look at the films at all. Each tosses a biased coin and calls 30% of films positive. Both call a film positive with probability 0.30 × 0.30 = 0.09 and both call it negative with probability 0.70 × 0.70 = 0.49. They agree on 58% of films with no skill at all. This is the agreement expected by chance, pe. It is higher when one category is common.
Cohen (1960) proposed kappa to correct the observed agreement for chance. Kappa is 1 when agreement is perfect, 0 when agreement equals what chance would produce, and below 0 when the raters agree less often than chance. The basic 2 × 2 calculation was introduced in the bias and validity chapter. This chapter explains why kappa behaves as it does, and the methods that go further.
The calculation
How is Cohen's kappa calculated?
Three numbers: observed agreement, agreement expected by chance from each rater's totals, and kappa.
κ = (po − pe) ÷ (1 − pe)
- p o
- observed agreement: the sum of the diagonal cells ÷ n
- p e
- chance agreement: for each category, (row total ÷ n) × (column total ÷ n), added over the categories
- 1 − p e
- the largest possible agreement beyond chance
- Observed agreement: po = (20 + 65) ÷ 100 = 0.85.
- Sonologist A reports stones in 25% of scans, sonologist B in 30%.
- Chance agreement: pe = 0.25 × 0.30 + 0.75 × 0.70 = 0.075 + 0.525 = 0.60. As counts: 7.5 + 52.5 = 60 of 100 scans.
- κ = (0.85 − 0.60) ÷ (1 − 0.60) = 0.25 ÷ 0.40 = 0.625, which rounds to 0.63. 95% CI 0.45 to 0.80.
The same formula works for any number of categories: po is the sum of all diagonal cells and pe adds row share × column share for every category. Unweighted kappa treats every disagreement as equally serious, so the order of the categories is ignored.
Interpretation
Is a kappa of 0.6 good?
Most papers quote the labels of Landis and Koch (1977). The authors themselves described the divisions as clearly arbitrary, offered as benchmarks.
- The labels are conventions. They were not derived from data about clinical consequences. A kappa of 0.6 may be acceptable for a symptom checklist and unacceptable for a biopsy diagnosis that decides surgery.
- Use the confidence interval. In the gallstone example κ = 0.63 with a 95% CI of 0.45 to 0.80: the interval covers three labels.
- Kappa depends on prevalence and on bias between raters (next section), so the same labels do not mean the same thing in two studies with different case mixes.
- Report the table. Observed agreement, the marginal totals and kappa together let a reader judge the result.
The kappa paradoxes
Why can 90% agreement give a low kappa?
Feinstein and Cicchetti (1990) described two paradoxes. In the first, a high observed agreement gives a low kappa when the marginal totals are strongly imbalanced, that is when one category is much more common. In the second, kappa is higher when the imbalance is asymmetrical between raters than when it is symmetrical.
Paradox 1: prevalence
When most films are positive (or most are negative), the chance agreement pe is high. The room left for agreement beyond chance, 1 − pe, is small, and the few disagreements take up much of it. In the problem at the top of this chapter, each radiologist called 7% of films positive: pe = 0.07 × 0.07 + 0.93 × 0.93 = 0.87, so 92% observed agreement gives κ = 0.39.
Paradox 2: bias
Bias here means that one rater calls a category more often than the other. With the same observed agreement and the same average prevalence, a table with bias gives a slightly higher kappa: in the teaching tables, 750 · 50 · 50 · 150 gives κ = 0.69 and 750 · 100 · 0 · 150 gives κ = 0.69 as well (0.6875 against 0.6923), although in the second table all disagreements go one way.
What to report: bias index, prevalence index and PABAK
Byrt, Bishop and Carlin (1993) showed that kappa is affected by bias and prevalence as well as by agreement, and recommended reporting measures of bias and prevalence with kappa. For a 2 × 2 table with cells a, b, c, d:
- prevalence index
- (a − d) ÷ n: far from 0 when one category is common
- bias index
- (b − c) ÷ n: far from 0 when one rater calls positive more often
- PABAK
- prevalence-adjusted bias-adjusted kappa = 2po − 1. It depends only on observed agreement
In the radiograph problem: prevalence index (6 − 178) ÷ 200 = −0.86, bias index 0, PABAK = 2 × 0.92 − 1 = 0.84, kappa 0.39. PABAK is not a replacement for kappa: it describes what kappa would be with 50% prevalence and no bias. Cicchetti and Feinstein (1990) recommended that kappa should always be accompanied by the separate proportions of agreement on positive and on negative decisions (ppos and pneg).
Interactive
Keep agreement at 90%, raise the prevalence and watch kappa fall
Observed agreement, prevalence and bias can be set separately. Kappa responds to all three. PABAK responds only to observed agreement.
Try this: keep observed agreement at 90% and move the prevalence from 50% to 95%. The radiologists agree on 9 films in 10 the whole time, but kappa falls from 0.80 to below 0, because agreement expected by chance rises towards 90%.
Teaching example with made-up numbers: two radiologists read the same 1,000 chest films as positive or negative.
Films on which the two readers give the same answer
How often the readers call a film positive
Difference between the two readers' positive rates
| Films per 1,000 | Reader B positive | Reader B negative | Total |
|---|---|---|---|
| Reader A positive | 450 | 50 | 500 |
| Reader A negative | 50 | 450 | 500 |
| Total | 500 | 500 | 1000 |
po = 90.0% · pe = 0.500 × 0.500 + 0.500 × 0.500 = 50.0% · κ = (0.900 − 0.500) ÷ (1 − 0.500) = 0.800
Prevalence index 0.00, bias index 0.00. Agreement expected by chance is 50.0%, so the readers do 40.0 points better than chance.
Kappa is low when prevalence is extreme, even with the same observed agreement (the first paradox). For the same observed agreement and prevalence, a bias between readers gives a slightly higher kappa (the second paradox). PABAK depends on observed agreement alone.
Ordered categories
What if the grades are ordered?
When pathologists grade dysplasia as none, low grade or high grade, calling a high-grade lesion low grade is a smaller error than calling it normal. Unweighted kappa counts both as simple disagreement. Weighted kappa (Cohen, 1968) gives partial credit to near misses.
κw = (weighted po − weighted pe) ÷ (1 − weighted pe)
Each cell's share of patients (observed) and its chance share (row share × column share) are multiplied by its weight and added. With weights of 1 on the diagonal and 0 elsewhere, this is ordinary kappa.
| A \ B | None | Low grade | High grade | Total |
|---|---|---|---|---|
| None | 40 | 6 | 1 | 47 |
| Low grade | 5 | 20 | 4 | 29 |
| High grade | 1 | 5 | 18 | 24 |
| Total | 46 | 31 | 23 | 100 |
| Weights | Weighted po | Weighted pe | Kappa |
|---|---|---|---|
| Unweighted | 0.78 | 0.361 | 0.66 |
| Linear | 0.78 + 0.5 × 0.20 = 0.88 | 0.571 | 0.72 |
| Quadratic | 0.78 + 0.75 × 0.20 = 0.93 | 0.676 | 0.78 |
- The weights change the answer. The same table gives 0.66, 0.72 or 0.78. Decide the weights in the protocol and state them in the paper.
- Quadratic weights and the ICC. Fleiss and Cohen (1973) showed that weighted kappa with quadratic weights is equivalent to an intraclass correlation coefficient, which links this chapter to the ICC chapter.
- Software defaults differ. SPSS Weighted Kappa uses linear weights by default. In R, irr::kappa2 gives unweighted kappa unless told otherwise.
Interactive
Move the disagreements one grade or two grades apart and compare the three kappas
Observed agreement on the diagonal stays at 78 of 100 in all three presets. Only the distance of the disagreements changes.
Try this: press "Near misses only", then "Far misses". Unweighted kappa barely moves because it counts every disagreement the same. The weighted kappas fall when the disagreements are two grades apart.
Teaching example with made-up numbers: two pathologists grade dysplasia in the same 100 biopsies. The worked example in this chapter.
| A \ B | None | Low grade | High grade |
|---|---|---|---|
| None | |||
| Low grade | |||
| High grade |
| Weights | Credit for one grade apart | Credit for two grades apart | Weighted po | Weighted pe |
|---|---|---|---|---|
| unweighted | 0.00 | 0.00 | 0.780 | 0.361 |
| linear | 0.50 | 0.00 | 0.880 | 0.571 |
| quadratic | 0.75 | 0.00 | 0.930 | 0.676 |
Each weighted kappa = (weighted po − weighted pe) ÷ (1 − weighted pe). Quadratic weights give more credit to near misses, so on the same table the quadratic value is usually the highest. State in the protocol which weights you will use.
More than two raters
What if more than two raters classify each patient?
Fleiss (1971) extended kappa to many raters, with the same number of ratings for every patient. The raters rating one patient need not be the same people who rate the next.
For each patient, count how many of the m raters chose each category. Then:
- P i
- agreement for patient i = (sum of the squared counts − m) ÷ [m(m − 1)]: the share of rater pairs that agree
- P̄
- mean of P i over all patients: observed agreement
- p j
- share of all ratings that fell in category j
- P̄ e
- sum of p j²: chance agreement
Fleiss' κ = (P̄ − P̄e) ÷ (1 − P̄e)
Teaching example (made up): 4 cardiologists classify 10 ECGs as normal, ischaemic or other abnormality. For an ECG called normal by 3 and ischaemic by 1: Pi = (3² + 1² − 4) ÷ (4 × 3) = 0.50. Across the 10 ECGs P̄ = 0.70. The categories received 35%, 40% and 25% of the 40 ratings, so P̄e = 0.35² + 0.40² + 0.25² = 0.345.
κ = (0.70 − 0.345) ÷ (1 − 0.345) = 0.355 ÷ 0.655 = 0.54
In the SPSS implementation no weights can be assigned to the disagreements, so Fleiss' kappa treats categories as nominal. The same prevalence effects apply as for Cohen's kappa.
Paired proportions
Did the two tests find the same proportion positive?
When the same patients have two tests, or the same test before and after treatment, the results are paired. McNemar (1947) described the test for the difference between such correlated proportions.
McNemar χ² = (b − c)² ÷ (b + c), with 1 degree of freedom
- b
- A positive, B negative (25)
- c
- A negative, B positive (10)
- with continuity correction
- (|b − c| − 1)² ÷ (b + c)
- exact test
- if b + c is small: the binomial probability of a split at least as uneven as b : c when each discordant pair is equally likely to go either way
- Test A positive: (60 + 25) ÷ 200 = 42.5%. Test B positive: (60 + 10) ÷ 200 = 35.0%. Difference 7.5 percentage points = (b − c) ÷ n.
- χ² = (25 − 10)² ÷ 35 = 225 ÷ 35 = 6.43, p = 0.011.
- With continuity correction: (15 − 1)² ÷ 35 = 5.60, p = 0.018. Exact binomial test: p = 0.017.
- Test A finds more positives than test B. On the same table, kappa = 0.63 (95% CI 0.52 to 0.74): the tests also agree moderately well on individual patients.
Why not the ordinary chi-square test? The ordinary chi-square test assumes two independent groups. Here the 200 results under test A and the 200 under test B come from the same 200 patients. The pairing is used by counting pairs, not individual results. See also the choosing a test chapter.
Interactive
Edit a paired table and see kappa and the McNemar test give different answers
Kappa asks whether the tests agree on each patient. McNemar asks whether they find the same proportion positive. A table can pass one and fail the other.
Try this: press "No agreement, same positive rates". Kappa is 0, yet McNemar's p is 1.000, because both tests call 50% of patients positive. Then press "Good agreement, different positive rates": kappa is high and McNemar's p is small.
Teaching example with made-up numbers: two screening tests (A and B) done in the same patients. The worked example in this chapter.
| Patients | Test B positive | Test B negative | Total |
|---|---|---|---|
| Test A positive | 85 | ||
| Test A negative | 115 | ||
| Total | 70 | 130 | 200 |
Test A is positive in 42.5% and test B in 35.0%. Observed agreement 82.5%, expected by chance 52.3%.
McNemar χ² = (b − c)² ÷ (b + c) = (25 − 10)² ÷ 35 = 6.43, p = 0.011 · with continuity correction χ² = 5.60, p = 0.018 · exact binomial p = 0.017
McNemar uses only the two discordant cells (bold). Kappa uses the whole table. A small McNemar p says the tests find different proportions positive. It does not say how well they agree on individual patients.
Measures of association
How strongly are two categorical variables related?
Agreement compares two ratings of the same thing. Association asks whether two different variables vary together, such as smoking status and COPD. The chi-square test shows whether an association exists. Its size depends on the sample size, so separate measures describe the strength.
| COPD | Never smoked | Former smoker | Current smoker | Total |
|---|---|---|---|---|
| Yes | 10 | 15 | 35 | 60 |
| No | 90 | 55 | 45 | 190 |
| Total | 100 | 70 | 80 | 250 |
χ² = 28.11 with (2 − 1) × (3 − 1) = 2 degrees of freedom, p < 0.001. All expected counts are 16.8 or more.
| Measure | Formula | Range | This table |
|---|---|---|---|
| Phi (φ) | √(χ² ÷ n). For a 2 × 2 table, (ad − bc) ÷ √[(a+b)(c+d)(a+c)(b+d)], which carries a sign | 0 to 1 for 2 × 2 tables (−1 to +1 with the sign). Can exceed 1 in larger tables | √(28.11 ÷ 250) = 0.34 |
| Cramér's V | √[χ² ÷ (n × (min(rows, columns) − 1))] | 0 to 1 for any table size. Equals phi when the table has 2 rows or 2 columns | √(28.11 ÷ 250) = 0.34 |
| Contingency coefficient (C) | √[χ² ÷ (χ² + n)] | 0 to below 1. The maximum depends on the numbers of rows and columns | √(28.11 ÷ 278.11) = 0.32 |
None of these is a measure of agreement. Two raters who always give opposite answers produce a strong association and no agreement. For a 2 × 2 table of two ratings, phi and kappa can be close in value (0.63 for both in the gallstone example) but they answer different questions. The odds ratio and relative risk, the other measures of association for 2 × 2 tables, are covered in the risk and survival chapter.
Decide
Which statistic do you need?
Answer the questions about your data.
What kind of result do you have for each patient?
Which agreement or association statistic: all possible answers
- Intraclass correlation or Bland-Altman analysis: Agreement on measurements is covered in the previous chapter.
- McNemar test: Uses only the patients on whom the two tests disagree. It tests whether the two proportions differ, not how well the tests agree.
- Chi-square test with phi or Cramér’s V: The chi-square test asks whether an association exists. Phi (2 × 2 tables) and Cramér’s V (larger tables) describe its strength.
- Fleiss' kappa: For a fixed number of raters per patient, on nominal categories.
- Weighted kappa: Gives partial credit for near misses. Choose linear or quadratic weights before the analysis.
- Cohen's kappa: Report it with observed agreement and its 95% confidence interval.
- Cohen's kappa with observed agreement, prevalence and bias indices: Kappa will be low even with high agreement. Report observed agreement, the prevalence and bias indices and PABAK beside kappa.
Comparison
Pairs of methods that residents confuse
| Feature | Percentage agreement | Cohen's kappa |
|---|---|---|
| Formula | (a + d) ÷ n | (po − pe) ÷ (1 − pe) |
| Allows for chance | No | Yes, from each rater's totals |
| Rare findings | Looks high because both raters call most cases negative | Looks low for the same reason (prevalence paradox) |
| Range | 0% to 100% | Below 0 to 1 |
| Report | Always, with the table | Always, with observed agreement and a 95% CI |
| Feature | Kappa | McNemar test |
|---|---|---|
| Question | Do the raters or tests give the same result for each patient? | Is the proportion positive the same for both tests? |
| Cells used | All cells | Only the discordant cells b and c |
| Result | A coefficient with a CI | A p-value (and the difference in proportions with a CI) |
| 50 · 50 · 50 · 50 | κ = 0: no agreement beyond chance | p = 1.000: identical proportions |
| 80 · 0 · 15 · 105 | κ = 0.85: good agreement | exact p < 0.001: test B finds more positives |
| Feature | Kappa (agreement) | Phi and Cramér's V (association) |
|---|---|---|
| Data | The same variable rated twice | Two different variables |
| Table | Square, same categories in rows and columns | Any size |
| Perfect score means | Every patient gets the same category from both raters | Knowing one variable predicts the other exactly |
| Raters who always disagree | Kappa below 0 | Strong association |
The formula
Worked examples, step by step
Made-up teaching data. Every number was computed in Python with statsmodels 0.14, SciPy 1.15 and scikit-learn.
Example 1. Cohen's kappa with its companions (gallstones, 100 scans)
- Cells: a = 20 (both stones), b = 5 (A only), c = 10 (B only), d = 65 (neither).
- po = 85 ÷ 100 = 0.85. pe = (25 × 30 + 75 × 70) ÷ 100² = 6,000 ÷ 10,000 = 0.60.
- κ = 0.25 ÷ 0.40 = 0.63. Standard error 0.087, 95% CI 0.45 to 0.80.
- Prevalence index = (20 − 65) ÷ 100 = −0.45. Bias index = (5 − 10) ÷ 100 = −0.05. PABAK = 2 × 0.85 − 1 = 0.70.
κ = (0.85 − 0.60) ÷ (1 − 0.60) = 0.63 · PABAK = 0.70
Example 2. The radiograph problem (200 films)
- Cells: a = 6, b = 8, c = 8, d = 178. po = 184 ÷ 200 = 0.92.
- Each radiologist calls 14 ÷ 200 = 0.07 positive. pe = 0.07² + 0.93² = 0.0049 + 0.8649 = 0.870.
- κ = (0.92 − 0.870) ÷ (1 − 0.870) = 0.050 ÷ 0.130 = 0.39, 95% CI 0.14 to 0.63.
- Prevalence index −0.86, bias index 0, PABAK 0.84. The low kappa reflects the rarity of positive films as well as the 16 disagreements, 8 in each direction.
Example 3. Weighted kappa (dysplasia, 100 biopsies)
Diagonal 40 + 20 + 18 = 78. Disagreements one grade apart: 6 + 5 + 4 + 5 = 20. Two grades apart: 1 + 1 = 2. Unweighted κ = (0.78 − 0.361) ÷ (1 − 0.361) = 0.66. Linear κw = (0.88 − 0.571) ÷ (1 − 0.571) = 0.72. Quadratic κw = (0.93 − 0.676) ÷ (1 − 0.676) = 0.78.
Example 4. McNemar test (two tests, 200 patients)
χ² = (25 − 10)² ÷ (25 + 10) = 6.43, df 1, p = 0.011 · corrected χ² = 5.60, p = 0.018 · exact p = 0.017
Example 5. Cramér's V (smoking and COPD, 250 adults)
V = √[28.11 ÷ (250 × 1)] = 0.34 · C = √[28.11 ÷ (28.11 + 250)] = 0.32
In a real paper
Kappa and the McNemar test in published studies
Clausen S, Kjær S, Fredberg U, et al. Ultrasound imaging in patients with hip pain and suspected hip osteoarthritis: an inter-rater and intra-rater reliability study. BMJ Open. 2020;10(11):e038643.
doi:10.1136/bmjopen-2020-038643 · PMID 33154052 · Free full text (PMC7646344)
The study: A reliability study at a Danish regional hospital. Two experienced operators, blinded to clinical information, each examined both hips of 50 patients referred for radiography (92 hips). Binary findings were compared with Cohen's kappa and ordered grades with weighted kappa, using quadratic weights.
“Inter-rater and intra-rater reliability and agreement between ultrasound imaging and X-ray were assessed using Cohen’s ordinal kappa statistics for binominal categorical variables and weighted kappa for ordered categorical variables.”
Two kinds of kappa were used. For findings that are simply present or absent (“binominal”, meaning binary), ordinary Cohen's kappa. For findings graded in order, such as the grade of osteoarthritis, weighted kappa, so that a one-grade disagreement counts less than a three-grade one. The methods section adds that quadratic weights were applied. The table of results shows the prevalence paradox: for trochanteric bursitis the operators agreed on 95% of hips, but 93% was expected by chance, and kappa was only 0.26.
| Reported | Value | What it means |
|---|---|---|
| Overall joint effusion/synovitis | 97% observed, 68% expected, κ 0.90 (0.79 to 1.00) | Common enough for chance agreement to be moderate, so high agreement gives a high kappa |
| OA grading (weighted) | 96% observed, 80% expected, κ 0.80 (0.71 to 0.87) | Quadratic-weighted kappa for ordered grades |
| Trochanter bursitis | 95% observed, 93% expected, κ 0.26 (−0.18 to 0.70) | High agreement, low kappa: most hips were negative |
| Iliopsoas bursitis | 92% observed, 93% expected, κ −0.04 (−0.09 to 0.01) | Agreement slightly below chance, despite 92% raw agreement |
- Look at expected agreement beside every kappa. Where it is above 90%, a low kappa does not by itself mean poor readers.
- The weights are stated (quadratic). Linear weights would give lower values on the same tables.
- 92 hips came from 50 patients. Two hips of one patient are not independent observations.
- The authors used the Landis and Koch labels. Read the confidence intervals, which for the rare findings are very wide.
Han SS, Moon IJ, Kim SH, et al. Assessment of deep neural networks for the diagnosis of benign and malignant skin neoplasms in comparison with dermatologists: a retrospective validation study. PLoS Med. 2020;17(11):e1003381.
doi:10.1371/journal.pmed.1003381 · PMID 33237903 · Free full text (PMC7688128)
The study: A retrospective validation study of 10,426 biopsied skin lesions (1,222 malignant, 9,204 benign) in Seoul, Korea. A previously developed algorithm and the first clinical impression of 65 attending physicians were each compared with the biopsy result on the same cases, so their sensitivities and specificities are paired proportions.
“Furthermore, the sensitivity and specificity of the first clinical impression of 65 attending physicians were 70.2% and 95.6%, respectively, which were superior to those of the algorithm (McNemar test; p < 0.0001).”
Sensitivity is the proportion of malignant lesions called malignant. Because the algorithm and the physicians judged the same lesions, each malignant lesion gives a pair of results, and the McNemar test compares the two proportions using the lesions on which they disagreed. p < 0.0001 means the difference between 70.2% and the algorithm's 62.7% is unlikely to be chance. It says nothing about how often the algorithm and the physicians agreed on individual lesions, which kappa would measure.
| Reported | Value | What it means |
|---|---|---|
| Algorithm sensitivity | 62.7% (95% CI 59.9–65.1) | At the predefined high-specificity threshold |
| Algorithm specificity | 90.0% (95% CI 89.4–90.6) | Same threshold |
| Physicians, first impression | 70.2% sensitivity, 95.6% specificity | Higher on both, compared with the McNemar test |
| Cases | 10,426 (1,222 malignant) | Sensitivity was based on the malignant cases |
- Both classifiers judged the same cases, so a paired test (McNemar) is the correct choice. An unpaired chi-square test would ignore the pairing.
- With more than a thousand malignant cases, a small p-value is easy to reach. Look at the size of the difference and its confidence interval.
- The McNemar test compares proportions. It is not a measure of agreement between the algorithm and the physicians.
How to run it
Running kappa, weighted kappa, Fleiss' kappa and the McNemar test
Menu paths and function arguments below were checked against the IBM SPSS Statistics 30 and 31 documentation, the CRAN reference manuals and the jamovi documentation.
SPSS
- Cohen's kappa and McNemar: Analyze > Descriptive Statistics > Crosstabs... Put rater A (or test A) in Rows and rater B in Columns. Click Statistics and tick Kappa and/or McNemar. Kappa needs a square table with the same categories in rows and columns, and both variables must have the same storage type (string or numeric). For tables larger than 2 × 2, the McNemar option reports the McNemar-Bowker test of symmetry.
- Phi, Cramér's V and the contingency coefficient: in the same Statistics dialog, under Nominal.
- Weighted kappa: Analyze > Scale > Weighted Kappa... Select the rater variables. Click Criteria to choose the weighting scale: linear (Cicchetti-Allison, the default) or quadratic.
- Fleiss' kappa: Analyze > Scale > Reliability Analysis... Click Statistics, and under Interrater Agreement: Fleiss' Kappa select at least two rating variables. No weights can be assigned.
R
# ratings: one row per patient, one column per rater library(irr) kappa2(ratings) # Cohen's kappa, unweighted by default kappa2(ratings, weight = "squared") # weighted by squared distance (quadratic) kappam.fleiss(ratings) # Fleiss' kappa for three or more raters library(DescTools) tab <- table(ratings$A, ratings$B) # square table with the same levels CohenKappa(tab, weights = "Equal-Spacing", conf.level = 0.95) # linear weights CohenKappa(tab, weights = "Fleiss-Cohen", conf.level = 0.95) # quadratic weights library(epiR) epi.kappa(tab2x2, method = "fleiss") # 2 x 2 table: kappa and PABAK mcnemar.test(tab2x2) # continuity correction applied (correct = TRUE) mcnemar.test(tab2x2, correct = FALSE) library(vcd) assocstats(tab) # phi, contingency coefficient, Cramér's V
jamovi
- McNemar test: the Paired Samples Contingency Tables analysis (jmv function contTablesPaired).
- Phi, Cramér's V and the contingency coefficient: options in the Contingency Tables analysis.
- Cohen's, weighted and Fleiss' kappa: the meddecide module (part of ClinicoPath) from the jamovi library.
How to report it
What to write in the thesis or paper
A kappa on its own cannot be interpreted. Give the reader the table, or the numbers needed to rebuild it.
- Who rated, how they were trained, whether they rated independently and blind to each other and to clinical information.
- The number of patients and raters, and how patients were selected (this sets the prevalence).
- The agreement table, or observed agreement and each rater's proportion in each category.
- Kappa with its 95% CI. For ordered categories, weighted kappa and the weights used. For more than two raters, Fleiss' kappa.
- For rare or very common findings, the prevalence and bias indices and PABAK beside kappa.
- For paired proportions, both proportions, their difference with a CI, and the McNemar test (state whether exact or with continuity correction).
Worked sentences, using the teaching examples:
“Two sonologists, blinded to each other's reports, independently assessed 100 scans for gallstones. They agreed on 85 scans (85%), with 60% agreement expected by chance. Cohen's kappa was 0.63 (95% CI 0.45 to 0.80). Sonologist A reported stones in 25% of scans and sonologist B in 30% (prevalence index −0.45, bias index −0.05, PABAK 0.70).”
“In the same 200 patients, test A was positive in 85 (42.5%) and test B in 70 (35.0%), a difference of 7.5 percentage points (exact McNemar test, p = 0.017).”
Reporting items for agreement studies (GRRAS) are listed in the guidelines section.
By specialty
Agreement on categories by specialty
Two radiologists read chest radiographs of TB contacts as active TB present or absent. Few films are positive.
Expect a low kappa with high percentage agreement. Report observed agreement, the prevalence index and PABAK beside kappa.
Two pathologists grade dysplasia in biopsies as none, low grade or high grade.
Ordered grades: use weighted kappa, name the weights (linear or quadratic) and show the full 3 × 3 table.
An algorithm and dermatologists each classify the same biopsied lesions as malignant or benign, and their sensitivities are compared.
Same lesions, two classifiers: compare the proportions with the McNemar test. Agreement between them is a different question, answered by kappa.
Five psychiatrists each give a diagnostic category to the same recorded interviews.
More than two raters on nominal categories: Fleiss' kappa, with category-wise values if some diagnoses are rare.
A yes/no questionnaire on tobacco use is given twice to the same villagers two weeks apart.
Test-retest agreement: kappa. A change in the proportion answering yes between the two occasions: McNemar test.
Two obstetricians classify the same cardiotocographs as normal, suspicious or pathological.
Three ordered categories: weighted kappa. Disagreement between normal and pathological should cost more than between normal and suspicious.
Two nurses assign triage levels 1 to 5 to the same patients.
Weighted kappa, with the weighting stated in the protocol, because quadratic weights give higher values than linear weights on the same table.
The same isolates are classified as susceptible or resistant using two interpretive guidelines.
Kappa for how often the two guidelines give the same category, McNemar for whether one guideline calls more isolates resistant.
Common myths
Common mistaken beliefs
Myth: 92% agreement shows that the observers agree well.
Part of that agreement is expected by chance. With a rare finding, chance agreement can be close to 90%.
Myth: A kappa of 0.41 is moderate, by rule.
The Landis and Koch labels are conventions that the authors called clearly arbitrary. Judge kappa against the clinical use and its confidence interval.
Myth: A low kappa with high agreement means the observers are careless.
It can come from extreme prevalence (the first kappa paradox). Report observed agreement, the prevalence and bias indices and PABAK with kappa.
Myth: The McNemar test measures agreement.
It tests whether two paired proportions differ. A table with no agreement beyond chance (κ = 0) can give McNemar p = 1.
Myth: A significant chi-square test on the rating table shows agreement.
Chi-square tests association. Raters who always disagree in a consistent way produce a strong association.
Myth: Unweighted kappa is fine for ordered grades.
It treats a one-grade and a two-grade disagreement as equally wrong. Use weighted kappa and state the weights.
Why this matters to you
Five consequences of misusing kappa
Protocol sent back
A reliability objective without a plan for kappa, its CI, the weights (for grades) and the expected prevalence cannot be judged by the committee.
A wrong thesis conclusion
Reporting percentage agreement alone makes rare findings look reliable. Reporting kappa alone makes them look unreliable.
Questions you cannot answer at the viva
"Why is your kappa low when you agreed on 92%?" needs an answer in terms of chance agreement and prevalence.
Misreading papers
Comparing kappas from studies with different case mixes, or treating a significant McNemar test as poor agreement.
Harm to patients
A grading system with poor agreement beyond chance can send similar patients to different treatments.
History
History of agreement statistics for categories
- 1947
Quinn McNemar
Published "Note on the sampling error of the difference between correlated proportions or percentages" in Psychometrika.
- 1960
Jacob Cohen
Proposed "A coefficient of agreement for nominal scales": kappa, agreement corrected for chance.
- 1968
Jacob Cohen
Described weighted kappa, with provision for scaled disagreement or partial credit.
- 1971
Joseph Fleiss
Extended kappa to agreement among many raters.
- 1973
Joseph Fleiss and Jacob Cohen
Showed the equivalence of weighted kappa (with quadratic weights) and the intraclass correlation coefficient as measures of reliability.
- 1977
J. Richard Landis and Gary Koch
Published methods for observer agreement on categorical data and the benchmark labels from slight to almost perfect, describing the divisions as clearly arbitrary.
- 1990
Alvan Feinstein and Domenic Cicchetti
Described the two paradoxes of high agreement but low kappa, and recommended reporting agreement on positive and negative decisions separately.
- 1993
Ted Byrt, Janet Bishop and John Carlin
Defined indices of bias and prevalence, expressed kappa in terms of them, and recommended reporting them with kappa.
- 2005
Julius Sim and Chris Wright
Reviewed kappa in reliability studies, including the effects of prevalence, bias and non-independent ratings, and sample sizes.
- 2011
Jan Kottner and colleagues
Proposed the Guidelines for Reporting Reliability and Agreement Studies (GRRAS).
Guidelines
Reporting agreement on categories
“Describe the measurement/rating process (e.g. time interval between repeated measurements, availability of clinical information, blinding).” “State whether measurements/ratings were conducted independently.”
“Report estimates of reliability and agreement including measures of statistical uncertainty.”
“When comparisons are made between agreement studies it can be misleading to report kappa values alone, and it is recommended that researchers also include quantitative indicators of bias and prevalence.”
“The omnibus value of kappa should always be accompanied by separate individual values of ppos and pneg”, the proportions of agreement on positive and on negative decisions.
Reading a paper
Five checks on any kappa or McNemar result
- Is the agreement table, or observed agreement and the marginal totals, reported with kappa?
- Is kappa given with a 95% CI, and is the prevalence of each category shown?
- For ordered grades, was weighted kappa used, and are the weights named?
- Did the raters work independently and blind to each other and to the reference result?
- For paired proportions, was a paired test (McNemar) used, and was it read as a comparison of proportions, not as agreement?
Why is it called that?
Word surgery
“Agreement”
Two people say the same thing.
The share of patients given the same category by both raters. Kappa counts only the agreement beyond what chance would produce.
“Association”
A link or connection between two things.
Two different variables vary together. It is measured by phi, Cramér’s V or the odds ratio, and it is not agreement.
Kappa: the whole table, agreement beyond chance. McNemar: the two off-diagonal cells, whether the proportions differ. Rare finding: report observed agreement and PABAK too.
Kappa (κ)
the tenth letter of the Greek alphabet
Cohen's coefficient of agreement is written with this letter.
Paradox
Greek para- ("contrary to") + doxa ("opinion")
A result contrary to expectation: 90% agreement with a kappa below 0.
Prevalence
Latin praevalere: "to be more able", from prae ("before") + valere ("be strong")
In kappa studies, how common each category is among the patients rated. It sets the agreement expected by chance.
Bias
French biais: "slant, oblique"
In agreement studies, one rater choosing a category more often than the other.
Exam answers
Model answer outlines
McNemar's test
MD Community Medicine 2015- Definition: a test for the difference between two paired (correlated) proportions, described by Quinn McNemar in 1947.
- When used: the same patients tested with two tests, the same patients before and after treatment, or matched pairs, with a yes/no outcome. The ordinary chi-square test is not valid because the observations are not independent.
- Data layout: a 2 × 2 table of pairs: a (both positive), b (first positive, second negative), c (first negative, second positive), d (both negative).
- Null hypothesis: the two proportions are equal, which is the same as b and c being equally likely.
- Statistic: χ² = (b − c)² ÷ (b + c), 1 degree of freedom. With continuity correction (|b − c| − 1)² ÷ (b + c). For small b + c, the exact binomial test.
- Key point: only the discordant pairs b and c are used. The concordant pairs a and d do not affect the test.
- Example: 200 patients, test A positive in 85 and test B in 70, b = 25, c = 10. χ² = 225 ÷ 35 = 6.43, p = 0.011 (exact p = 0.017). Test A finds more positives.
- Limits: it compares proportions, not agreement (use kappa for agreement). For tables larger than 2 × 2, the McNemar-Bowker test of symmetry. For three or more paired proportions, Cochran's Q test.
Cohen's kappa: calculation, interpretation and limitations
- Purpose: agreement between two raters on categories, corrected for chance (Cohen, 1960).
- Formula: κ = (po − pe) ÷ (1 − pe). pe from each rater's marginal totals.
- Example: gallstones on 100 scans: po 0.85, pe 0.60, κ 0.63 (95% CI 0.45 to 0.80).
- Interpretation: 1 perfect, 0 chance-level, below 0 worse than chance. Landis and Koch labels (slight to almost perfect) are arbitrary conventions.
- Variants: weighted kappa (linear or quadratic weights) for ordered grades. Fleiss' kappa for more than two raters.
- Limitations: depends on prevalence and bias (Feinstein and Cicchetti paradoxes). Report observed agreement, prevalence and bias indices, PABAK = 2po − 1, or agreement on positive and negative decisions separately.
The one thing to remember
Kappa is agreement beyond chance, and chance agreement rises when one category is common. Always report observed agreement and the table with it.
All worked examples and interactive elements use made-up numbers for teaching. Calculations: Python with statsmodels 0.14, SciPy 1.15 and scikit-learn.
Sources: Cohen J. A coefficient of agreement for nominal scales. Educ Psychol Meas 1960;20(1):37–46 (doi:10.1177/001316446002000104). Cohen J. Weighted kappa: nominal scale agreement with provision for scaled disagreement or partial credit. Psychol Bull 1968;70(4):213–20 (doi:10.1037/h0026256, PMID 19673146). Fleiss JL. Measuring nominal scale agreement among many raters. Psychol Bull 1971;76(5):378–82 (doi:10.1037/h0031619). Fleiss JL, Cohen J. The equivalence of weighted kappa and the intraclass correlation coefficient as measures of reliability. Educ Psychol Meas 1973;33(3):613–9 (doi:10.1177/001316447303300309). Landis JR, Koch GG. The measurement of observer agreement for categorical data. Biometrics 1977;33(1):159–74 (doi:10.2307/2529310, PMID 843571). Feinstein AR, Cicchetti DV. High agreement but low kappa: I. The problems of two paradoxes. J Clin Epidemiol 1990;43(6):543–9 (doi:10.1016/0895-4356(90)90158-L, PMID 2348207). Cicchetti DV, Feinstein AR. High agreement but low kappa: II. Resolving the paradoxes. J Clin Epidemiol 1990;43(6):551–8 (doi:10.1016/0895-4356(90)90159-M, PMID 2189948). Byrt T, Bishop J, Carlin JB. Bias, prevalence and kappa. J Clin Epidemiol 1993;46(5):423–9 (doi:10.1016/0895-4356(93)90018-V, PMID 8501467). Sim J, Wright CC. The kappa statistic in reliability studies: use, interpretation, and sample size requirements. Phys Ther 2005;85(3):257–68 (PMID 15733050). McNemar Q. Note on the sampling error of the difference between correlated proportions or percentages. Psychometrika 1947;12(2):153–7 (doi:10.1007/BF02295996, PMID 20254758). Kottner J, Audigé L, Brorson S, et al. Guidelines for Reporting Reliability and Agreement Studies (GRRAS) were proposed. J Clin Epidemiol 2011;64(1):96–106 (doi:10.1016/j.jclinepi.2010.03.002, PMID 21130355). Shankar V, Bangdiwala SI. Observer agreement paradoxes in 2x2 tables: comparison of agreement measures. BMC Med Res Methodol 2014;14:100 (doi:10.1186/1471-2288-14-100). Vanbelle S, Albert A. A note on the linearly weighted kappa coefficient for ordinal scales. Stat Methodol 2009;6(2):157–63 (doi:10.1016/j.stamet.2008.06.001). Clausen S et al. BMJ Open 2020;10(11):e038643 (PMID 33154052). Han SS et al. PLoS Med 2020;17(11):e1003381 (PMID 33237903). Software documentation: IBM SPSS Statistics 30 and 31 documentation; CRAN reference manuals for irr 0.85, DescTools 0.99.60, epiR 2.0.96, vcd 1.4-14 and jmv 2.8.0; R stats documentation for mcnemar.test; meddecide module documentation, accessed 15 September 2026.
Past papers
TNMGRMU questions on kappa and agreement on categories
Questions from MD, MS, DM, MCh and Ph.D. papers that this chapter helps you answer. Tap a sitting to open the university's own question paper.
- ×1McNemar’s Test