Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: kappa for more than 2 raters


From   May Boggess <[email protected]>
To   [email protected]
Subject   Re: st: kappa for more than 2 raters
Date   04 Dec 2003 11:28:25 -0600

On Wednesday, Jeffrey wrote:

> I have a data set involving 91 subjects.  All subjects have been rated 
> by the same three raters (R1, R2 & R3) into one of four categories. 

His question is:
> 
> Given that our rating scale is ordinal, is there a way to
> get STATA to generate a table of individual kappas based on a
> dichotomization of the rating scale at each possible cut-off?
> 

If I understand your question correctly, I think you can do this by
replacing each rating with 0/1 based on each cut-off, and then computing
kappa. The code pasted below does this, for a dataset like Jeffrey's,
using a loop.

yours,
May

[email protected]

capture program drop mykap
program define mykap
di as text _n _n  _col(3) "Cut"  _col(10) "Kappa" ///
   _col(25) "Z"    _col(36) "Prob>Z"
di in smcl in gr "{hline 41}"

forvalue i=1/3{
preserve
qui replace R1=(R1>`i')
qui replace R2=(R2>`i')
qui replace R3=(R3>`i') 
qui  kap R*
di as result _col(5) `i' _col(10) %-7.4f r(kappa)  ///
  _col(25) %-11.2f r(z) _col(35) %-12.4f 1-normprob(r(z))
restore
}

end

clear
set obs 91
gen subject=_n
gen R1=int(uniform()*4)+1
gen R2=int(uniform()*4)+1
gen R3=int(uniform()*4)+1
kap R*
mykap 



*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index