一、Kappa 檢驗(yàn)方法
在做數(shù)據(jù)分析時(shí),我們經(jīng)常會面臨一致性檢驗(yàn)問題,即判斷不同的模型或者分析方法在預(yù)測結(jié)果上是否具有一致性、模型的結(jié)果與實(shí)際結(jié)果是否具有一致性等。另外,一致性檢驗(yàn)在臨床實(shí)驗(yàn)中也有著廣泛的應(yīng)用。對于兩個(gè)或多個(gè)醫(yī)務(wù)工作者對同一病人給出的診斷結(jié)論進(jìn)行一致性檢驗(yàn),英文叫interrater reliability; 對同一醫(yī)務(wù)工作者多次診斷結(jié)論的一致性檢驗(yàn),英文叫 intraraterreliability。
摘自:http://wenku.baidu.com/view/f1061c165f0e7cd18425361d.html
二、計(jì)算方法
Kappa 系數(shù)有帶加權(quán)和不帶加權(quán)兩種計(jì)算方法,分別對應(yīng) SAS的簡單Kappa系數(shù)和加權(quán)Kappa系數(shù)(Simple KappaCoefficient, Weighted Kappa Coefficient)。
先看不帶加權(quán)的公式:
帶加權(quán)的公式:
注:線性權(quán)重和平方權(quán)重分別對應(yīng)SAS中的Cicchetti-Allison權(quán)重和Fleiss-Cohen權(quán)重,默認(rèn)情況下使用Cicchetti-Allison權(quán)重。
以上公式來自 http://www.physther.org/content/85/3/257.full(英文資料,介紹地比較全面)
三、統(tǒng)計(jì)檢驗(yàn)方法
Kappa只是一個(gè)統(tǒng)計(jì)量,存在抽樣誤差。Kappa/ASE近似服從標(biāo)準(zhǔn)正態(tài)分布,據(jù)此可以得出Kappa 統(tǒng)計(jì)量的置信區(qū)間。
四、如何使用 SAS 做 Kappa 分析?
1)兩種評測方法評分范圍一致的情況
data equalranges;
inputrater1rater2;
datalines;
11
12
12
11
22
22
21
22
;
run;
proc freq data=equalranges;
tables rater1*rater2/agree nopercent nocolnorow;
run;
輸出結(jié)果:
注:對于 2*2 的列聯(lián)表,加權(quán)Kappa系數(shù)等于簡單Kappa系數(shù)。SAS FREQ過程步只有當(dāng)列聯(lián)表大于2*2表時(shí)才顯示加權(quán)Kappa系數(shù)。
(For 2*2 tables, the weighted kappa coefficient equals thesimple kappa coefficient. PROC FREQ displays the weighted kappacoefficient only for tables larger than 2*2.)
2)兩種評測方法評分范圍不一致的情況 -- 使用 Weight 語句加 zeros 選項(xiàng) (請參考 UCLA大學(xué)的網(wǎng)站:http://www.ats.ucla.edu/stat/sas/faq/kappa.htm)
data unequalranges;
inputrater1rater2;
datalines;
11
11
11
11
22
22
22
22
32
32
32
32
;
run;
data unequalranges;
if _n_=1 then do;
rater1 =3;
rater2 = 3;
weight = 0;
output;
end;
set unequalranges;
weight = 1;
output;
run;
proc freq data=unequalranges;
tables rater1*rater2;
test kappa;
weight weight / zeros;
run;
輸出結(jié)果:
SAS 的 FREQ 過程步可用于 Kappa一致性檢驗(yàn),代碼共有兩種寫法,數(shù)值都一樣,只是分析結(jié)果的展現(xiàn)形式不太一樣。
TEST KAPPA 語句
proc freq data= unequalranges;
tables rater1*rater2;![[轉(zhuǎn)載]一致性檢驗(yàn)--Kappa系數(shù) kappa一致性分析](http://img.aihuau.com/images/02111102/02063530t019bccaba774c3ec6b.gif)
test kappa;
weight weight / zeros;
run;
輸出結(jié)果:
TABLES 語句中的 AGREE 選項(xiàng)
proc freq data= unequalranges;
tables rater1*rater2/agreenopercent nocol norow;
weight weight / zeros;
run;
輸出結(jié)果:
下面的代碼僅用于手算驗(yàn)證簡單KAPPA系數(shù)的計(jì)算結(jié)果(理解任何一種計(jì)算公式的最好辦法是手算一遍,當(dāng)然要基于小數(shù)據(jù)來計(jì)算):
ods output simplekappa = simplekappa;
proc freq data= unequalranges;
tables rater1*rater2/agree nopercent nocolnorow;
weight weight / zeros;
run;
data kappa_diy;
set simplekappa(keep=label1 nvalue1);
where label1='ASE';
po=(4+4)/12;
pe=(4*4+8*4)/12**2;
kappa = (po-pe)/(1-pe);
kappa_lower = kappa+probit(0.025)*nvalue1;
kappa_upper = kappa+probit(0.975)*nvalue1;
put _all_;
run;
輸出結(jié)果:
Label1=ASE nValue1=0.155902
po=0.6666666667
pe=0.3333333333
kappa=0.5
kappa_lower=0.1944369283
kappa_upper=0.8055630717
下面介紹一下如何將 Kappa 統(tǒng)計(jì)量保存在 SAS 數(shù)據(jù)集中便于后續(xù)的分析和使用。
1) 保存簡單Kappa系數(shù)
ods output SimpleKappa = SimpleKappa;
2) 保存加權(quán)Kappa系數(shù)
ods output WeightedKappa = WeightedKappa;
代碼如下:
ods output SimpleKappa = SimpleKappa;
ods output WeightedKappa = WeightedKappa;
proc freqdata= unequalranges;
tables rater1*rater2;
test kappa;
weight weight / zeros;
run;
五、經(jīng)驗(yàn)
1) Weighted kappa penalizes disagreements interms of their seriousness, whereas unweighted kappa treats alldisagreements equally. Unweighted kappa, therefore, is inappropriate for ordinalscales.
2) Landis and Koch45 have proposed thefollowing as standards for strength of agreement for the kappacoefficient:
≤0=poor,
.01–.20=slight,
.21–.40=fair,
.41–.60=moderate,
.61–.80=substantial,
and .81–1=almost perfect.
六、參考資料
http://www.cis.udel.edu/~carberry/CIS-885/Papers/DiEugenio-Kappa-Second-Look.pdf
http://www.agreestat.com/research_papers/kappa_statistic_is_not_satisfactory.pdf
http://www.chestx-ray.com/statistics/kappa.html
http://david.abcc.ncifcrf.gov/helps/linear_search.html
http://rss.acs.unt.edu/Rdoc/library/epicalc/html/kap.html(R,我這里就不介紹了,大家有興趣的自己看看)
愛華網(wǎng)



