```Date: Wed, 10 Jan 2007 12:50:19 -0800 Reply-To: "Mogens A. Krogh" Sender: "SAS(r) Discussion" From: "Mogens A. Krogh" Organization: http://groups.google.com Subject: Re: adjusted kappa Comments: To: sas-l@uga.edu Content-Type: text/plain; charset="us-ascii" Dear Johanna, If I understand you correct you have multiple 2x2 tables and then you're not asked for the weighted Kappa -which for 2x2 tables is equal to the normal (Cohen's) kappa. I think you are asked for what sometimes is known as Prevalence- and Bias Adjusted Kappa, which also is known as Scott's Kappa or Scott's Pi. Scott's Pi can as far as I know not be calutated directly in proc freq, like the other measurements of agreement. Below are some code that calcutate Scott's Pi so you can do it in SAS (eventhough it would be easier to calulated it on the back of an envelope) Please check the formulas.. Regards Mogens A. Krogh Phd-student and Vet www.life.ku.dk data test; do subject=1 to 10; ran_no=ranuni(123); if ran_no<0.40 then vet1=0; else vet1=1; if ran_no<0.30 then vet2=0; else vet2=1; output; end; run; proc freq data=test; tables vet1*vet2 / out=table; run; /* Scott's Kappa also know as Unbiased Kappa */ /* r1 = a + b r2 = c + d c1 = a + c c2 = b + d P_Observed = (a + d) / (a+b+c+d) P_Expected = ( (r1 + c1)^2 + (r2 + c2)^2 ) / ( 4 * (a+b+c+d)^2) Kappa = ( P_Observed - P_Expected ) / ( 1 - P_Expected ) */ data _null_; set table end=eof; retain a b c d 0; if vet1=0 & vet2=0 then a=count; if vet1=0 & vet2=1 then b=count; if vet1=1 & vet2=0 then c=count; if vet1=1 & vet2=1 then d=count; if eof then do; r1=sum(a,b); r2=sum(c,d); c1=sum(a,c); c2=sum(b,d); P_observed=sum(a,d)/sum(a,b,c,d); P_expected= ((sum(r1,c1)**2)+(sum(r2,c2)**2))/(4*(sum(a,b,c,d))**2); Kappa=(P_observed - P_expected)/(1-P_expected); put kappa=; end; run; ```

Back to: Top of message | Previous page | Main SAS-L page