[R] Cohen's Kappa for beginners

Jim Lemon jim at bitwrit.com.au
Tue May 25 13:31:48 CEST 2010


On 05/25/2010 06:01 PM, Jason Priem wrote:
> Hi,
> I've got two vectors with ratings from two coders, like this:
>
> x<-c("red", "yellow", "blue", "red") #coder number 1
> y<-c("red", "blue", "blue", "red") #coder number 2
>
> I want to find Cohen's Kappa using the wkappa function in the psych
> package. The only example in the docs is using a matrix, which I'm
> afraid I don't understand--I don't know how to get there from what I've
> got. Could anyone point me in the right direction? Thanks!

Hi Jason,
You're not alone. I tried to work out how to run this and it took a 
while. Both kappa2 in the "irr" package:

kappa2(cbind(x,y))

and classAgreement in the "e1071" package:

classAgreement(table(x,y))

produce a kappa of 0.6. I was unable to work out how to use the wkappa 
function in the "psych" package:

wkappa(table(x,y))

The above led to a kappa of -0.8. Although wkappa is presented as a test 
of the reliability of ratings of nominal level data, the example uses 
numeric data.

Jim



More information about the R-help mailing list