[R] Cohen's Kappa for beginners

David Winsemius dwinsemius at comcast.net
Thu Feb 10 15:17:04 CET 2011


On Feb 10, 2011, at 12:23 AM, Matthew Schmidt wrote:

> Refresh list was used, but a restart of the client was necessary for
> updates to become active.

I was under the impression which I have just corrected that it would  
be a simple matter to detach() a package and reload it. My efforts to  
document that misconception fell apart after looking at ?detach

So maybe one does need to start a fresh session if one has loaded an  
out of date package version and then installed anew version. It  
appears that may be especially so if there is a DLL in the package.

>
> Please advise as to appropriate list. Many thanks!

Actually, after reconsideration it probably of more general relevance  
than just the Max OS user audience to which I thought you intended  
this to be read. The list of lists, however, is reached via a link to  
the "R Mailing Lists" which appears in the first paragraph of the R  
Help page whose link is in every R-help posting.

-- 
David.

>
> On Wednesday, February 9, 2011, David Winsemius <dwinsemius at comcast.net 
> > wrote:
>>
>> On Feb 9, 2011, at 3:29 PM, matthew.schmidt wrote:
>>
>>
>>
>> I'm a newb with R and am trying to move from proprietary stats  
>> tools to open
>> ones. Hopefully this post might help others doing the same.
>>
>> I downloaded the R package for Mac
>>
>>
>> Posted to the wrong list.
>>
>>
>> and hacked together a couple scripts, but
>> couldn't seem to get the right output. After installing the psych  
>> package, I
>> tried the test script included in this thread on the console, but I  
>> got
>> similar results to a prior poster:
>>
>>
>> x
>>
>> [1] "red"    "yellow" "blue"   "red"
>>
>> y
>>
>> [1] "red"  "blue" "blue" "red"
>>
>> ck <- cohen.kappa(cbind(x,y))
>>
>> Error in counts[i, j] <- sum(scores[i, ] == score.levels[j], na.rm  
>> = TRUE) :
>>  subscript out of bounds
>> In addition: Warning messages:
>> 1: NAs introduced by coercion
>> 2: NAs introduced by coercion
>>
>> Since I got the impression that there may be a version problem, I  
>> updated
>> the psych package to the most recent version, 1.0-94 (from source).  
>> After
>> this, I tried over and over to run the cohen.kappa command, and  
>> still kept
>> getting the same error.
>>
>> So I quit R and restarted it, then went to the package manager and  
>> selected
>> the checkbox next to "psych" to load it, and tried to re-run the  
>> command.
>>
>> This time I got the expected output:
>>
>> Call: cohen.kappa1(x = x, w = w, n.obs = n.obs, alpha = alpha)
>>
>> Cohen Kappa and Weighted Kappa correlation coefficients and  
>> confidence
>> boundaries
>>                 lower estimate upper
>> unweighted kappa  0.098      0.6  1.10
>> weighted kappa   -0.693      0.0  0.69
>>
>> Number of subjects = 4
>>
>> Lesson learned: close and restart the Mac client if you're using  
>> the GUI
>> front-end in order for changes to the package manager to take effect.
>>
>>
>> I have a small screenshot for you to look at:
>>
>>

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list