[rkward-cvs] SF.net SVN: rkward:[2620] trunk/rkward/rkward/plugins/analysis/wilcoxon

tfry at users.sourceforge.net tfry at users.sourceforge.net
Sat Aug 22 20:27:25 UTC 2009


Revision: 2620
          http://rkward.svn.sourceforge.net/rkward/?rev=2620&view=rev
Author:   tfry
Date:     2009-08-22 20:27:25 +0000 (Sat, 22 Aug 2009)

Log Message:
-----------
Beef up wilcoxon_exact_test the same way as wilcoxon_test, and add a very basic help file.

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_exact_test.php
    trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_exact_test.xml

Added Paths:
-----------
    trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_exact_test.rkh

Modified: trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_exact_test.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_exact_test.php	2009-08-21 12:58:58 UTC (rev 2619)
+++ trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_exact_test.php	2009-08-22 20:27:25 UTC (rev 2620)
@@ -1,21 +1,30 @@
 <?
-function preprocess () { ?>
-require(coin)
+function preprocess () {
+	global $y;
+	$y = getRK_val ("y");
+	if ($y != "") $y = ", " . $y;
+?>
+require(exactRankTests)
 
-names <- rk.get.description (<? getRK ("x"); ?>, <? getRK ("y"); ?>)
+names = rk.get.description (<? getRK ("x"); echo ($y); ?>)
 <?
 }
 
 function calculate () {
+	global $y;
+
 	$exact_setting = getRK_val ("exact");
 	if ($exact_setting == "yes") {
 		$exact_opt = ", exact=TRUE";
 	} else if ($exact_setting == "no") {
 		$exact_opt = ", exact=FALSE";
 	}
+	if ($y != "") $paired_opt = ", paired = " . getRK_val ("paired");
+	if (getRK_val ("confint") == "TRUE") {
+		if (($conflevel = getRK_val("conflevel")) != "0.95") $conflevel_opt = ", conf.level=" . $conflevel;
+	}
 ?>
-result <- wilcox.exact (<? getRK ("x"); ?>, <? getRK ("y"); ?>, alternative = "<? getRK ("alternative"); ?>", mu = <? getRK ("mu"); ?>, paired = <? getRK ("paired"); ?><? echo ($exact_opt); ?>, correct = <? getRK ("correct"); ?>, conf.int = <? getRK ("confint"); ?> <?
-if (($conflevel = getRK_val ("conflevel")) != "0.95") echo (", conf.level=" . $conflevel); ?>)
+result <- wilcox.exact (<? getRK ("x"); echo ($y); ?>, alternative = "<? getRK ("alternative"); ?>", mu = <? getRK ("mu"); echo ($paired_opt); echo ($exact_opt); ?>, correct = <? getRK ("correct"); ?>, conf.int = <? getRK ("confint"); echo ($conflevel_opt); ?>)
 
 <?
 }
@@ -23,7 +32,7 @@
 function printout () {
 ?>
 rk.header (result$method,
-	parameters=list ("Comparing", paste (names[1], "against", names[2]),
+	parameters=list ("Comparing", paste (names, collapse=" against "),
 	"H1", rk.describe.alternative (result),
 	"Continuity correction in normal approximation for p-value", "<? getRK ("correct"); ?>",
 	"Compute exact p-value", "<? getRK ("exact"); ?>", "Paired test", "<? getRK ("paired"); ?>",
@@ -35,7 +44,7 @@
 	'Location Shift'=result$null.value,
 	'Hypothesis'=result$alternative,
 	p=result$p.value<?
-	if (getRK_val ("confint")== "TRUE") { ?>,
+	if (getRK_val ("confint") == "TRUE") { ?>,
 	'confidence interval percent'=(100 * attr(result$conf.int, "conf.level")),
 	'confidence interval of difference'=result$conf.int,
 	'Difference in Location' = result$estimate<? } ?>))

Added: trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_exact_test.rkh
===================================================================
--- trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_exact_test.rkh	                        (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_exact_test.rkh	2009-08-22 20:27:25 UTC (rev 2620)
@@ -0,0 +1,8 @@
+<!DOCTYPE rkhelp>
+<document>
+	<summary>
+		This test differs from <link href="rkward://component/wilcoxon_test"/> in that it uses a different algorithm and supports the exact test even for tied samples.
+
+		For details of the implementation see <link href="rkward://rhelp/wilcox.exact.test"/>. For documentation of the dialog settings, see <link href="rkward://component/wilcoxon_test"/>.
+	</summary>
+</document>

Modified: trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_exact_test.xml
===================================================================
--- trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_exact_test.xml	2009-08-21 12:58:58 UTC (rev 2619)
+++ trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_exact_test.xml	2009-08-22 20:27:25 UTC (rev 2620)
@@ -1,7 +1,14 @@
 <!DOCTYPE rkplugin>
 <document>
 	<code file="wilcoxon_exact_test.php"/>
+	<help file="wilcoxon_exact_test.rkh"/>
 
+	<logic>
+		<convert id="y_specified" mode="notequals" standard="" sources="y.available"/>
+		<connect client="paired.enabled" governor="y_specified"/>
+		<connect client="conflevel.enabled" governor="confint.state"/>
+	</logic>
+
 	<dialog label="Wilcoxon exact test">
 		<tabbook>
 			<tab label="Basic settings">
@@ -9,7 +16,7 @@
 					<varselector id="vars"/>
 					<column>
 						<varslot type="numeric" id="x" source="vars" required="true" label="compare"/>
-						<varslot type="numeric" id="y" source="vars" required="true" label="against"/>
+						<varslot type="numeric" id="y" source="vars" required="false" label="against (optional)"/>
 						<radio id="alternative" label="using test hypothesis">
 							<option value="two.sided" label="Two-sided"/>
 							<option value="greater" label="greater"/>
@@ -25,7 +32,7 @@
 					<checkbox id="confint" label="compute confidence interval" checked="false" value="TRUE" value_unchecked="FALSE" />
 					<spinbox type="real" id="conflevel" label="confidence level" min="0" max="1" initial="0.95"/>
 				</frame>
-				<spinbox id="mu" label="mu" initial="0"/>
+				<spinbox id="mu" label="location (shift) to test against (mu)" initial="0"/>
 				<radio id="exact" label="compute exact p-value">
 					<option label="Always" value="yes" />
 					<option label="Automatic" value="automatic" checked="true" />


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