[rkward-cvs] SF.net SVN: rkward:[4422] branches/external_plugins/rk.CohenKappa/inst/ rkward

m-eik at users.sourceforge.net m-eik at users.sourceforge.net
Thu Nov 8 17:44:53 UTC 2012


Revision: 4422
          http://rkward.svn.sourceforge.net/rkward/?rev=4422&view=rev
Author:   m-eik
Date:     2012-11-08 17:44:53 +0000 (Thu, 08 Nov 2012)
Log Message:
-----------
rk.CohenKappa: added plugin tests

Modified Paths:
--------------
    branches/external_plugins/rk.CohenKappa/inst/rkward/plugins/CohensKappa.js
    branches/external_plugins/rk.CohenKappa/inst/rkward/plugins/CohensKappa.xml
    branches/external_plugins/rk.CohenKappa/inst/rkward/rk.CohenKappa.pluginmap
    branches/external_plugins/rk.CohenKappa/inst/rkward/rkwarddev_plugin_script_kappa.R

Added Paths:
-----------
    branches/external_plugins/rk.CohenKappa/inst/rkward/tests/
    branches/external_plugins/rk.CohenKappa/inst/rkward/tests/rk.CohenKappa/
    branches/external_plugins/rk.CohenKappa/inst/rkward/tests/rk.CohenKappa/RKTest.example1.rkcommands.R
    branches/external_plugins/rk.CohenKappa/inst/rkward/tests/rk.CohenKappa/RKTest.example1.rkout
    branches/external_plugins/rk.CohenKappa/inst/rkward/tests/rk.CohenKappa/RKTest.example2.rkcommands.R
    branches/external_plugins/rk.CohenKappa/inst/rkward/tests/rk.CohenKappa/RKTest.example2.rkout
    branches/external_plugins/rk.CohenKappa/inst/rkward/tests/testsuite.R

Modified: branches/external_plugins/rk.CohenKappa/inst/rkward/plugins/CohensKappa.js
===================================================================
--- branches/external_plugins/rk.CohenKappa/inst/rkward/plugins/CohensKappa.js	2012-11-08 10:20:54 UTC (rev 4421)
+++ branches/external_plugins/rk.CohenKappa/inst/rkward/plugins/CohensKappa.js	2012-11-08 17:44:53 UTC (rev 4422)
@@ -1,4 +1,5 @@
-// 
+// this code was generated using the rkwarddev package.
+//perhaps don't make changes here, but in the rkwarddev script instead!
 
 
 

Modified: branches/external_plugins/rk.CohenKappa/inst/rkward/plugins/CohensKappa.xml
===================================================================
--- branches/external_plugins/rk.CohenKappa/inst/rkward/plugins/CohensKappa.xml	2012-11-08 10:20:54 UTC (rev 4421)
+++ branches/external_plugins/rk.CohenKappa/inst/rkward/plugins/CohensKappa.xml	2012-11-08 17:44:53 UTC (rev 4422)
@@ -1,7 +1,7 @@
-<!DOCTYPE rkplugin>
+<!DOCTYPE rkplugin >
 <document>
 	<!-- this code was generated using the rkwarddev package.
-		perhaps don't make changes here, but in the rkwarddev script instead! -->
+			perhaps don't make changes here, but in the rkwarddev script instead! -->
 	<code file="CohensKappa.js" />
 	<help file="CohensKappa.rkh" />
 	<include file="../rk.CohenKappa.pluginmap" />

Modified: branches/external_plugins/rk.CohenKappa/inst/rkward/rk.CohenKappa.pluginmap
===================================================================
--- branches/external_plugins/rk.CohenKappa/inst/rkward/rk.CohenKappa.pluginmap	2012-11-08 10:20:54 UTC (rev 4421)
+++ branches/external_plugins/rk.CohenKappa/inst/rkward/rk.CohenKappa.pluginmap	2012-11-08 17:44:53 UTC (rev 4422)
@@ -1,18 +1,18 @@
-<!DOCTYPE rkpluginmap>
+<!DOCTYPE rkpluginmap >
 <document 
 	namespace="rkward"
 	id="CohensKappa_rkward"
 >
 	<!-- 
 		this code was generated using the rkwarddev package.
-		perhaps don't make changes here, but in the rkwarddev script instead! 
+			perhaps don't make changes here, but in the rkwarddev script instead! 
 	-->
 	<about 
 		name="rk.CohenKappa"
 		shortinfo="RKWard GUI to calculate Cohen's Kappa"
 		longinfo="RKWard GUI to calculate Cohen's Kappa, i.e., the agreement of two raters (using the psych package)"
-		version="0.01-3"
-		releasedate="2012-04-07"
+		version="0.01-4"
+		releasedate="2012-11-08"
 		url="http://rkward.sf.net"
 		license="GPL (>= 3)"
 	>
@@ -25,11 +25,10 @@
 		<dependencies rkward_min_version="0.5.6">
 			<package name="psych" />
 			<!-- 
-				If this plugin depends on other pluginmaps, edit this part to your needs: 
-				 				<pluginmap 
-									name="CHANGE_ME_OR_DELETE_ME"
-									url="CHANGE_ME_OR_DELETE_ME"
-								 /> 
+				If this plugin depends on other pluginmaps, edit this part to your needs: 				<pluginmap 
+								name="CHANGE_ME_OR_DELETE_ME"
+								url="CHANGE_ME_OR_DELETE_ME"
+							 /> 
 			-->
 		</dependencies>
 	</about>
@@ -54,10 +53,10 @@
 	</hierarchy>
 	<!-- 
 		<context id="x11">
-				</context> 
+			</context> 
 	-->
 	<!-- 
 		<context id="import">
-				</context> 
+			</context> 
 	-->
 </document>

Modified: branches/external_plugins/rk.CohenKappa/inst/rkward/rkwarddev_plugin_script_kappa.R
===================================================================
--- branches/external_plugins/rk.CohenKappa/inst/rkward/rkwarddev_plugin_script_kappa.R	2012-11-08 10:20:54 UTC (rev 4421)
+++ branches/external_plugins/rk.CohenKappa/inst/rkward/rkwarddev_plugin_script_kappa.R	2012-11-08 17:44:53 UTC (rev 4422)
@@ -16,7 +16,7 @@
 		person(given="Meik", family="Michalke",
 			email="meik.michalke at hhu.de", role=c("aut","cre"))),
 	about=list(desc="RKWard GUI to calculate Cohen's Kappa",
-		version="0.01-3", url="http://rkward.sf.net", long.desc="RKWard GUI to calculate Cohen's Kappa, i.e., the agreement of two raters (using the psych package)"),
+		version="0.01-4", url="http://rkward.sf.net", long.desc="RKWard GUI to calculate Cohen's Kappa, i.e., the agreement of two raters (using the psych package)"),
 	dependencies=list(rkward.min="0.5.6"),
 	package=list(c(name="psych"))
 	)

Added: branches/external_plugins/rk.CohenKappa/inst/rkward/tests/rk.CohenKappa/RKTest.example1.rkcommands.R
===================================================================
--- branches/external_plugins/rk.CohenKappa/inst/rkward/tests/rk.CohenKappa/RKTest.example1.rkcommands.R	                        (rev 0)
+++ branches/external_plugins/rk.CohenKappa/inst/rkward/tests/rk.CohenKappa/RKTest.example1.rkcommands.R	2012-11-08 17:44:53 UTC (rev 4422)
@@ -0,0 +1,16 @@
+local({
+## Vorbereiten
+require(psych)
+## Berechne
+	kappa.result <- cohen.kappa(
+		x=rater.data
+	)
+
+## Drucke Ergebnisse
+rk.header("Cohen's Kappa and weighted Kappa")
+	rk.header("Correlation coefficients and confidence boundaries", level=3)
+	rk.print(kappa.result[["confid"]])
+	rk.print(paste("<b>Alpha level:</b>", kappa.result[["plevel"]]))
+	rk.print(paste("<b>Number of subjects:</b>", kappa.result[["n.obs"]]))
+
+})

Added: branches/external_plugins/rk.CohenKappa/inst/rkward/tests/rk.CohenKappa/RKTest.example1.rkout
===================================================================
--- branches/external_plugins/rk.CohenKappa/inst/rkward/tests/rk.CohenKappa/RKTest.example1.rkout	                        (rev 0)
+++ branches/external_plugins/rk.CohenKappa/inst/rkward/tests/rk.CohenKappa/RKTest.example1.rkout	2012-11-08 17:44:53 UTC (rev 4422)
@@ -0,0 +1,30 @@
+<h1>Cohen's Kappa and weighted Kappa</h1>
+DATE<br />
+<h3>Correlation coefficients and confidence boundaries</h3>
+<br />
+
+
+<p align= center >
+<table cellspacing=0 border=1><caption align=bottom class=captiondataframe></caption>
+<tr><td>
+	<table border=0 class=dataframe>
+	<tbody> <tr class= firstline > <th></th><th>lower</th><th>estimate</th><th>upper</th> </tr>
+ 
+<tr><td class=firstcolumn>unweighted kappa</td>
+<td class=cellinside>-0.18</td>
+<td class=cellinside> 0.00</td>
+<td class=cellinside> 0.18</td></tr>
+ 
+<tr><td class=firstcolumn>weighted kappa</td>
+<td class=cellinside> 0.43</td>
+<td class=cellinside> 0.68</td>
+<td class=cellinside> 0.93</td></tr>
+ 
+	</tbody>
+</table>
+ </td></table>
+ <br>
+
+<p class='character'><b>Alpha level:</b> 0.05</p>
+
+<p class='character'><b>Number of subjects:</b> 9</p>

Added: branches/external_plugins/rk.CohenKappa/inst/rkward/tests/rk.CohenKappa/RKTest.example2.rkcommands.R
===================================================================
--- branches/external_plugins/rk.CohenKappa/inst/rkward/tests/rk.CohenKappa/RKTest.example2.rkcommands.R	                        (rev 0)
+++ branches/external_plugins/rk.CohenKappa/inst/rkward/tests/rk.CohenKappa/RKTest.example2.rkcommands.R	2012-11-08 17:44:53 UTC (rev 4422)
@@ -0,0 +1,18 @@
+local({
+## Vorbereiten
+require(psych)
+## Berechne
+	kappa.result <- cohen.kappa(
+		x=cohen,
+		w=cohen.weights,
+		n.obs=200
+	)
+
+## Drucke Ergebnisse
+rk.header("Cohen's Kappa and weighted Kappa")
+	rk.header("Correlation coefficients and confidence boundaries", level=3)
+	rk.print(kappa.result[["confid"]])
+	rk.print(paste("<b>Alpha level:</b>", kappa.result[["plevel"]]))
+	rk.print(paste("<b>Number of subjects:</b>", kappa.result[["n.obs"]]))
+
+})

Added: branches/external_plugins/rk.CohenKappa/inst/rkward/tests/rk.CohenKappa/RKTest.example2.rkout
===================================================================
--- branches/external_plugins/rk.CohenKappa/inst/rkward/tests/rk.CohenKappa/RKTest.example2.rkout	                        (rev 0)
+++ branches/external_plugins/rk.CohenKappa/inst/rkward/tests/rk.CohenKappa/RKTest.example2.rkout	2012-11-08 17:44:53 UTC (rev 4422)
@@ -0,0 +1,30 @@
+<h1>Cohen's Kappa and weighted Kappa</h1>
+DATE<br />
+<h3>Correlation coefficients and confidence boundaries</h3>
+<br />
+
+
+<p align= center >
+<table cellspacing=0 border=1><caption align=bottom class=captiondataframe></caption>
+<tr><td>
+	<table border=0 class=dataframe>
+	<tbody> <tr class= firstline > <th></th><th>lower</th><th>estimate</th><th>upper</th> </tr>
+ 
+<tr><td class=firstcolumn>unweighted kappa</td>
+<td class=cellinside> 0.39</td>
+<td class=cellinside> 0.49</td>
+<td class=cellinside> 0.59</td></tr>
+ 
+<tr><td class=firstcolumn>weighted kappa</td>
+<td class=cellinside>-0.39</td>
+<td class=cellinside> 0.35</td>
+<td class=cellinside> 1.08</td></tr>
+ 
+	</tbody>
+</table>
+ </td></table>
+ <br>
+
+<p class='character'><b>Alpha level:</b> 0.05</p>
+
+<p class='character'><b>Number of subjects:</b> 200</p>

Added: branches/external_plugins/rk.CohenKappa/inst/rkward/tests/testsuite.R
===================================================================
--- branches/external_plugins/rk.CohenKappa/inst/rkward/tests/testsuite.R	                        (rev 0)
+++ branches/external_plugins/rk.CohenKappa/inst/rkward/tests/testsuite.R	2012-11-08 17:44:53 UTC (rev 4422)
@@ -0,0 +1,36 @@
+## definition of the test suite
+	suite <- new("RKTestSuite",
+		id="rk.CohenKappa",
+		## needed packages
+		libraries = c("rk.CohenKappa"),
+		## initCalls are run *before* any tests. Use this to set up the environment
+		initCalls = list(
+			function(){
+				## load needed packages
+				require("psych")
+
+				## prepare needed data objects
+				# taken from the examples of psych::cohen.kappa()
+				rater.data <- cbind(c(1,2,3,4,5,6,7,8,9),c(1,3,1,6,1,5,5,6,7))
+
+				# also taken from the examples of psych::cohen.kappa()
+				cohen <- matrix(c(0.44, 0.07, 0.09, 0.05, 0.20, 0.05, 0.01, 0.03, 0.06),ncol=3,byrow=TRUE)
+				# cohen.weights weight differences
+				cohen.weights <- matrix(c(0,1,3,1,0,6,3,6,0),ncol=3)
+			}
+		),
+		## the tests
+		tests = list(
+				## define the actual tests here
+				new("RKTest", id="RKTest.example1", call=function(){
+					rk.call.plugin ("rkward::cmp_CohensKappaCohensKappa", spn_Alphvlfr.real="0.05", spn_Nmbrfbsr.real="0.00", svb_Svrsltst.active="0", svb_Svrsltst.objectname="kappa.result", svb_Svrsltst.parent=".GlobalEnv", vrsl_Dtmtrxr2.available="rater.data", vrsl_Wghtmtrx.available="", submit.mode="submit")
+				}),
+				new("RKTest", id="RKTest.example2", call=function(){
+					rk.call.plugin ("rkward::cmp_CohensKappaCohensKappa", spn_Alphvlfr.real="0.05", spn_Nmbrfbsr.real="200.00", svb_Svrsltst.active="0", svb_Svrsltst.objectname="kappa.result", svb_Svrsltst.parent=".GlobalEnv", vrsl_Dtmtrxr2.available="cohen", vrsl_Wghtmtrx.available="cohen.weights", submit.mode="submit")
+				})
+		),
+		## postCalls are like initCalls, but run after all tests to clean up.
+		postCalls = list(
+			function(){}
+		)
+	)

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the rkward-tracker mailing list