{"id":856,"date":"2015-08-10T15:38:20","date_gmt":"2015-08-10T14:38:20","guid":{"rendered":"http:\/\/pcool.dyndns.org:8080\/statsbook\/?page_id=856"},"modified":"2025-07-04T20:23:29","modified_gmt":"2025-07-04T19:23:29","slug":"kappa-test","status":"publish","type":"page","link":"https:\/\/pcool.dyndns.org\/index.php\/kappa-test\/","title":{"rendered":"Kappa Test"},"content":{"rendered":"\n<p>The kappa test is used to measure agreement between two or more observers for <a href=\"https:\/\/pcool.dyndns.org\/index.php\/data-types\/\" data-type=\"page\" data-id=\"355\">categorical items<\/a>. A kappa of 1 indicates perfect agreement and a kappa of zero agreement less than chance. Substantial agreement requires a kappa between 0.6 and 0.8 and almost perfect agreement a kappa higher than 0.8<sup class='sup-ref-note' id='note-zotero-ref-p856-r1-o1'><a class='sup-ref-note' href='#zotero-ref-p856-r1'>1<\/a><\/sup>.<\/p>\n\n\n\n<p>The <a href=\"https:\/\/pcool.dyndns.org:\/wp-content\/data_files\/xray.rda\" target=\"_blank\" rel=\"noreferrer noopener\">xray.rda<\/a> dataset is used to show how to perform a kappa test in R. The data frame is called xray and contains two variables: Observer1 and Observer2 with <a href=\"https:\/\/pcool.dyndns.org\/index.php\/data-types\/\" data-type=\"page\" data-id=\"355\">categorical<\/a> data regarding the interpretation of radiographs (OA or RA).<\/p>\n\n\n\n<p>To show the data frame:<\/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:#f50606\" class=\"has-inline-color\">xray\n<\/mark><mark style=\"background-color:rgba(0, 0, 0, 0);color:#3305f5\" class=\"has-inline-color\">   Observer1 Observer2\n1         RA        RA\n2         OA        OA\n3         OA        OA\n4         RA        OA\n5         OA        OA\n6         RA        RA\n7         OA        OA\n8         OA        OA\n9         OA        OA\n10        OA        RA\n11        OA        OA\n12        OA        OA\n13        OA        OA\n14        OA        OA\n15        OA        OA\n16        OA        OA\n17        RA        RA\n18        RA        RA\n19        OA        OA\n20        OA        OA<\/mark><\/em>\n<em><mark style=\"background-color:rgba(0, 0, 0, 0);color:#f80202\" class=\"has-inline-color\">str(xray)\n<\/mark><mark style=\"background-color:rgba(0, 0, 0, 0);color:#3202f7\" class=\"has-inline-color\">'data.frame':\t20 obs. of  2 variables:\n $ Observer1: Factor w\/ 2 levels \"OA\",\"RA\": 2 1 1 2 1 2 1 1 1 1 ...\n $ Observer2: Factor w\/ 2 levels \"OA\",\"RA\": 2 1 1 1 1 2 1 1 1 2 ...<\/mark><\/em><\/code><\/pre>\n\n\n\n<p>It can be seen that most of the time the observers agree with each other. The irr package<sup class='sup-ref-note' id='note-zotero-ref-p856-r2-o1'><a class='sup-ref-note' href='#zotero-ref-p856-r2'>2<\/a><\/sup> should be <a href=\"https:\/\/pcool.dyndns.org\/index.php\/packages\/\" data-type=\"page\" data-id=\"22\">installed<\/a> and loaded. To perform a kappa test:<\/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:#f70101\" class=\"has-inline-color\">library(irr)\nkappa2(xray)\n<\/mark><mark style=\"background-color:rgba(0, 0, 0, 0);color:#3800f7\" class=\"has-inline-color\">&nbsp;Cohen's Kappa for 2 Raters (Weights: unweighted)\n\n&nbsp;Subjects = 20 \n&nbsp;&nbsp; Raters = 2 \n&nbsp;&nbsp;&nbsp; Kappa = 0.733 \n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; z = 3.28 \n&nbsp; p-value = 0.00104<\/mark><\/em><\/code><\/pre>\n\n\n\n<p>The kappa is 0.733 confirming substantial agreement between the two observers. The p-value to test the null hypothesis of no association is significant.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The kappa test is used to measure agreement between two or more observers for categorical items. A kappa of 1 indicates perfect agreement and a kappa of zero agreement less than chance. Substantial agreement requires a kappa between 0.6 and 0.8 and almost perfect agreement a kappa higher than 0.8. The xray.rda dataset is used [&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-856","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/pcool.dyndns.org\/index.php\/wp-json\/wp\/v2\/pages\/856","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=856"}],"version-history":[{"count":7,"href":"https:\/\/pcool.dyndns.org\/index.php\/wp-json\/wp\/v2\/pages\/856\/revisions"}],"predecessor-version":[{"id":4911,"href":"https:\/\/pcool.dyndns.org\/index.php\/wp-json\/wp\/v2\/pages\/856\/revisions\/4911"}],"wp:attachment":[{"href":"https:\/\/pcool.dyndns.org\/index.php\/wp-json\/wp\/v2\/media?parent=856"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}