Diff for "FAQ/kappa/multiple" - CBU statistics Wiki
location: Diff for "FAQ/kappa/multiple"
Differences between revisions 1 and 11 (spanning 10 versions)
Revision 1 as of 2006-07-18 14:23:29
Size: 3736
Editor: pc0082
Comment:
Revision 11 as of 2006-07-18 15:59:02
Size: 2836
Editor: pc0082
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
Line 4: Line 3:
[CUT AND PASTE SYNTAX IN THE BOX BELOW INTO A SPSS SYNTAX WINDOW] [COPY AND PASTE SYNTAX '''IN THE BOX''' BELOW INTO A SPSS SYNTAX WINDOW]
Line 9: Line 8:
Line 16: Line 14:
evaluates the kappa for the three raters whose ratings per item are contained in columns called r1 r2 r3.

Cases are objects or subjects that have been rated. Data must be
in case by case form (WEIGHT is ignored), and ratings must be coded as
consecutive integers from 1 to the number of rating categories (though
it is not necessary for a particular rater to utilize all categories).

The macro first saves your working data file to a file named ka__tmp1.sav.
The double underscore in the file name is an attempt to render unlikely the
overwriting of an existing file. The SET commands are used to minimize
output; they may be changed or removed if you have problems running the
macro in order to aid in identification of problem sources.actions

The macro should function on any SPSS release offering macro support and the
MATRIX procedure (which means for modular systems you must have the Advanced
Statistics module). It 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.

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.
evaluates the kappa for the three raters whose ratings per case are contained in columns called r1 r2 r3.
Line 44: Line 17:
**************************************************************
*
MACRO NAME:         MKAPPASC.SPS        *
* *
*
README FILE:        MKAPPASC.RM              *
*
*
* SPSS REQUIREMENTS:  Release 4.0 or above *
*
Advanced Statistics Module *
*
*
* AUTHOR:             David Nichols (nichols@spss.com) *
* *

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

* LAST UPDATED: 04/08/97
*
**************************************
Line 59: Line 34:
save outfile='ka__tmp1.sav'. save outfile='ka_tmp1.sav'.
Line 62: Line 37:
count ms__=!vars (missing).
select if ms__=0.
count ms_=!vars (missing).
select if ms_=0.
Line 86: Line 61:
save {kstat,ase,z,sig} /outfile='ka__tmp2.sav' save {kstat,ase,z,sig} /outfile='ka_tmp2.sav'
Line 89: Line 64:
get file='ka__tmp2.sav'. get file='ka_tmp2.sav'.
Line 96: Line 71:
get file='ka__tmp1.sav'. get file='ka_tmp1.sav'.
Line 98: Line 73:
restore.
Line 101: Line 75:

 * 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.

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                   
*                                            *
* README FILE:MKAPPASC.RM              
*                                            *
*  SPSS REQUIREMENTS:Release 4.0 or above                  
*
*  Advanced Statistics Module            
*
*  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)