FAQ/kappa/multiple - CBU statistics Wiki
location: / multiple

This macro is from David Nicholls, Senior Support Statistician at SPSS.

[COPY AND PASTE SYNTAX IN THE BOX BELOW INTO A SPSS SYNTAX WINDOW]

then below the patsed syntax type

MKAPPASC VARS=varlist.

where varlist is the list of variables containing the ratings for each rater. So. for example,

MKAPPASC VARS=r1 r2 r3.

evaluates the kappa for the three raters whose ratings per case are contained in columns called r1 r2 r3.

```***************************************
* MACRO NAME: MKAPPASC.SPS
*                                            *
*                                            *
*  SPSS REQUIREMENTS:Release 4.0 or above
*
*
*  AUTHOR: David Nichols [mailto:nichols@spss.com]
*
*  LAST UPDATED:       04/08/97
*
**************************************

preserve.
set printback=off mprint=off.
save outfile='ka_tmp1.sav'.
define mkappasc (vars=!charend('/')).
set mxloops=1000.
count ms_=!vars (missing).
select if ms_=0.
matrix.
get x /var=!vars.
compute c=mmax(x).
compute y=make(nrow(x),c,0).
loop i=1 to nrow(x).
loop j=1 to ncol(x).
loop k=1 to c.
do if x(i,j)=k.
compute y(i,k)=y(i,k)+1.
end if.
end loop.
end loop.
end loop.
compute pe=msum((csum(y)/msum(y))&**2).
compute k=ncol(x).
compute pa=mssq(y)/(nrow(y)*k*(k-1))-(1/(k-1)).
compute kstat=(pa-pe)/(1-pe).
compute num=2*(pe-(2*k-3)*(pe**2)+2*(k-2)*msum((csum(y)/msum(y))&**3)).
compute den=nrow(y)*k*(k-1)*((1-pe)**2).
compute ase=sqrt(num/den).
compute z=kstat/ase.
compute sig=1-chicdf(z**2,1).
save {kstat,ase,z,sig} /outfile='ka_tmp2.sav'
/variables=kstat,ase,z,sig.
end matrix.
get file='ka_tmp2.sav'.
formats all (f11.8).
variable labels kstat 'Kappa' /ase 'ASE' /z 'Z-Value' /sig 'P-Value'.
report format=list automatic align(center)
/variables=kstat ase z sig
/title "Estimated Kappa, Asymptotic Standard Error,"
"and Test of Null Hypothesis of 0 Population Value".
get file='ka_tmp1.sav'.
!enddefine.```
• The macro first saves your working data file to a file named ka_tmp1.sav. The macro creates two new files, ka_tmp1.sav and ka_tmp2.sav, which contain respectively your original data, and a file used to store the values printed in the reported output.

MAKE SURE YOU HAVE NO EXISTING FILES CALLED KA_TMP1.SAV OR KA_TMP2.SAV AS THESE WILL BE OVERWRITTEN.

• Multiple invocations of the macro in the same interactive session will produce the following note:

>The macro name specified on the DEFINE command duplicates the name of a previously defined macro. This instance will take precedence.

This warning does not indicate a problem and may be ignored.

None: FAQ/kappa/multiple (last edited 2013-03-08 10:17:16 by localhost)