Programming the statistical procedures from SAS

Error calculating kappa with MKAPPA

Posts: 35

Error calculating kappa with MKAPPA

When running Bin Chen's MKAPPA macro, I get an error, but I am not sure why.  Specifically I am wondering whether I am not using the macro correctly.

My data set is attached.  There are 13 raters who rated 320 subjects on a 4-point ordinal scale.  (This is after I removed subjects with only one rater.)

My code

%include "\path\to\"; /* from */

%let dloc = c:\temp;

%let dset = rating_smile_transposed ;

%let Nrater = 13;

%let Ncat = 4;

%let outfile = output.rtf ;


The error

MPRINT(MKAPPA):   data kap.koutput;

MPRINT(MKAPPA):   set final;

MPRINT(MKAPPA):   keep Kappa SE pvalue;

MPRINT(MKAPPA):   Kappa=num/den;

MPRINT(MKAPPA):   SE=sqrt(2*(den*den-pqpsum))/(den*sqrt( 320*13*(13-1)));

MPRINT(MKAPPA):   pvalue=1-probnorm(kappa/se);


NOTE: Invalid argument to function SQRT(-0.290557332) at line 34 column 174.

rate=4 x=188 xmx2=1914 p=0.0451923077 pq=0.043149963 pqp=0.0392498702 kj=0.111439652 numj=0.0048086169 num=0.0165537167 den=0.2357844859 pqpsum=0.20087299 Kappa=0.0702069801 SE=. pvalue=. _ERROR_=1 _N_=1

Super User
Posts: 11,786

Re: Error calculating calla with MKAPPA

Proximate cause:

den=0.2357844859 pqpsum=0.20087299

sqrt (2* (den*den - pqpsum))

the den*den is calculated first with value in the .055 range. Subtract 0.200 and the result is negative.

It may be that some of your values are pushing the boundaries of what the macro was designed for but pqpsum has to be less than den*den to avoid this error.

Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation