@lcmaley ,
I had to brush off some rust, since I have not looked at my script since for multiple years.
You should always mentions which version of JMP you are using. That said, I suggest you use @ghartel 's solution posted in 2021.
Download the Weighted Kappa Function.jsl that was provided in the @ghartel post, and save it to a drive for your scripts.
Note, the Weighted Kappa Function solution includes the Std Err and confidence limits, as well as, a By variable; my script did not. @ghartel 's solution is a much better solution.
Below is the JSL I used to run the Weighted Kappa Function, for the sample table provided with my original script. See the attached screenshot of the result for the JMP table slide58.jmp.
Note:
- Udir can be any drive you wish and the data table and function can be in different directories.
- You do not need to call out each option for the Contingency, likely, you have defaults set up. However, Counts and Expected need to be included in your Contingency Platform options or called out in your script.
Kudos to @ghartel for the terrific function!
Names Default to Here(1);
Udir ="C:\temp";
dt = open(Udir || "\slide58.jmp");
Include( Udir || "\Weighted Kappa Function.jsl" );
CT = dt << Contingency(
Y( :Y ),
X( :X ),
Freq( :n ),
Contingency Table(
Count( 1, Format( "Fixed Dec", 8, 0 ) ),
Total %( 1, Format( "Fixed Dec", 8, 2 ) ),
Col %( 1, Format( "Fixed Dec", 8, 2 ) ),
Row %( 1, Format( "Fixed Dec", 8, 2 ) ),
Expected( 1, Format( "Best", 8 ) ),
Deviation( 0, Format( "Best", 8 ) ),
Cell Chi Square( 0, Format( "Fixed Dec", 8, 4 ) ),
Col Cum( 0, Format( "Fixed Dec", 8, 0 ) ),
Col Cum %( 0, Format( "Fixed Dec", 8, 2 ) ),
Row Cum( 0, Format( "Fixed Dec", 8, 0 ) ),
Row Cum %( 0, Format( "Fixed Dec", 8, 2 ) )
),
Agreement Statistic( 1 )
);
WeightedKappa(CT);