[rkward-cvs] SF.net SVN: rkward:[2615] trunk/rkward/rkward/plugins

tfry at users.sourceforge.net tfry at users.sourceforge.net
Thu Aug 20 16:05:38 UTC 2009


Revision: 2615
          http://rkward.svn.sourceforge.net/rkward/?rev=2615&view=rev
Author:   tfry
Date:     2009-08-20 16:05:37 +0000 (Thu, 20 Aug 2009)

Log Message:
-----------
Several small bugfixes and improvements for things that turned up while writing more tests

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/analysis/corr_matrix.xml
    trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_exact_test.php
    trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_test.php
    trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_test.rkh
    trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_test.xml
    trunk/rkward/rkward/plugins/plots/cor_graph.php
    trunk/rkward/rkward/plugins/uni1.2/code.php

Modified: trunk/rkward/rkward/plugins/analysis/corr_matrix.xml
===================================================================
--- trunk/rkward/rkward/plugins/analysis/corr_matrix.xml	2009-08-20 11:14:36 UTC (rev 2614)
+++ trunk/rkward/rkward/plugins/analysis/corr_matrix.xml	2009-08-20 16:05:37 UTC (rev 2615)
@@ -9,7 +9,7 @@
 			<tab id="tab_variables" label="Variables">
 				<row>
 					<varselector id="vars"/>
-					<varslot type="numeric" min_vars="2" multi="true" id="x" source="vars" required="true" label="variable(s):"/>
+					<varslot type="numeric" min_vars="2" multi="true" id="x" source="vars" required="true" label="variable(s):" num_dimensions="1"/>
 				</row>
 			</tab>
 			<tab id="tab_options" label="Options">

Modified: trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_exact_test.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_exact_test.php	2009-08-20 11:14:36 UTC (rev 2614)
+++ trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_exact_test.php	2009-08-20 16:05:37 UTC (rev 2615)
@@ -1,6 +1,6 @@
 <?
 function preprocess () { ?>
-require(exactRankTests)
+require(coin)
 
 names <- rk.get.description (<? getRK ("x"); ?>, <? getRK ("y"); ?>)
 <?

Modified: trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_test.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_test.php	2009-08-20 11:14:36 UTC (rev 2614)
+++ trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_test.php	2009-08-20 16:05:37 UTC (rev 2615)
@@ -1,19 +1,28 @@
 <?
-function preprocess () { ?>
-names = rk.get.description (<? getRK ("x"); ?>, <? getRK ("y"); ?>)
+function preprocess () {
+	global $y;
+	$y = getRK_val ("y");
+	if ($y != "") $y = ", " . $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.test (<? 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.test (<? 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); ?>)
 
 <?
 }
@@ -21,7 +30,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"); ?>",

Modified: trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_test.rkh
===================================================================
--- trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_test.rkh	2009-08-20 11:14:36 UTC (rev 2614)
+++ trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_test.rkh	2009-08-20 16:05:37 UTC (rev 2615)
@@ -5,25 +5,27 @@
 	</summary>
 
 	<usage>
-		Since this is a rather powerful test please refere to <link href="rkward://rhelp/wilcox.test"/> to make sure you carry out a Wilcoxon rank sum test (Mann-Whitney test) or Wilcoxon signed rank test accordingly.
+		Select a single vector (or paired test) to perform a Wilcoxon signed rank test on the null that the true distribution of x (or the difference between the paired vectors) is symmetric about 0 (or the specified location).
+
+		Select two vectors to perform a Wilcoxon rank sum test (equivalent to the Mann-Whitney test: see <link href="rkward://rhelp/wilcox.test"/> for details) on the null that the distributions of x and y differ (by 0 or the specified location shift).
 	</usage>
 
 	<settings>
 		<caption id="tab_variables"/>
 		<setting id="x">Select the data to be computed. The vectors need to be numeric.</setting>
-		<setting id="alternative">Here you can specify the alternative hypothesis. It must be one of "two sided", "greater" or "less".</setting>
-		<setting id="paired">Check if you want a paired test.</setting>
+		<setting id="alternative">The alternative hypothesis. "greater" means that x is shifted to the right of y / of the location parameter.</setting>
+		<setting id="paired">Check this for a paired test (Wilcoxon signed rank test of the difference between the two vectors).</setting>
 		<caption id="tab_options"/>
-		<setting id="confint">Check this if you want to compute a confidence interval.</setting>
-		<setting id="conflevel">Here you can define the confidence level of the interval (95% is typical).</setting>
-		<setting id="mu">This number is specifying an optional parameter used to form the null hypothesis. Please refer to R-help for more details.</setting>
-		<setting id="exact">Check if  an exact p-value should be computed. By default an asymptomatic p-value is calculated. If you have less than 50 cases per group without binding than an exact test should be performed. See <link href="rkward://rhelp/wilcox.exact"/></setting>
+		<setting id="confint">Check this if you want the confidence interval to be computed/printed.</setting>
+		<setting id="conflevel">Confidence level of the printed confidence interval.</setting>
+		<setting id="mu">The location / location shift to form the null hypothesis.</setting>
+		<setting id="exact">Should an exact p-value be computed? By default ("Automatic") an asymptomatic p-value is calculated if and only if you have less than 50 cases per group without binding than an exact test should be performed. To compute an exact p-value in the presence of ties, use <link href="rkward://component/wilcoxon_exact_test"/></setting>
 		<setting id="correct">If checked a continuity correction in the normal approximation for the p-value is applied.</setting>
 	</settings>
 	<related>
 		<ul>
 			<li><link href="rkward://rhelp/wilcox.test"/></li>
+			<li><link href="rkward://component/wilcoxon_exact_test"/></li>
 		</ul>
-
 	</related>
 </document>

Modified: trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_test.xml
===================================================================
--- trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_test.xml	2009-08-20 11:14:36 UTC (rev 2614)
+++ trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_test.xml	2009-08-20 16:05:37 UTC (rev 2615)
@@ -3,6 +3,12 @@
 	<code file="wilcoxon_test.php"/>
 	<help file="wilcoxon_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 test">
 		<tabbook>
 			<tab label="Basic settings" id="tab_variables">
@@ -10,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"/>
@@ -26,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" />

Modified: trunk/rkward/rkward/plugins/plots/cor_graph.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/cor_graph.php	2009-08-20 11:14:36 UTC (rev 2614)
+++ trunk/rkward/rkward/plugins/plots/cor_graph.php	2009-08-20 16:05:37 UTC (rev 2615)
@@ -55,7 +55,7 @@
 	if ($final) { ?>
 rk.graph.off ()
 
-print("Signif. codes:  0 '***', 0.001 '**', 0.01 '*', 0.05 '.'', 0.1 ' ', 1")
+rk.print("Legend:\t'***': p < 0.001 -- '**': p < 0.01 -- '*': p < 0.05 -- '.'': p < 0.1")
 <?  }
 }
 ?>

Modified: trunk/rkward/rkward/plugins/uni1.2/code.php
===================================================================
--- trunk/rkward/rkward/plugins/uni1.2/code.php	2009-08-20 11:14:36 UTC (rev 2614)
+++ trunk/rkward/rkward/plugins/uni1.2/code.php	2009-08-20 16:05:37 UTC (rev 2615)
@@ -35,12 +35,12 @@
 <?	}
 	if (($nmin = getRK_val ("nbminimum")) != "0") { ?>
 	if (length (var) >= <? echo ($nmin); ?>) {
-		results[i, 'Minimum values'] <- paste (sort(var, decreasing=FALSE, na.last=TRUE) [1:<? echo ($nmin); ?>])
+		results[i, 'Minimum values'] <- paste (sort(var, decreasing=FALSE, na.last=TRUE)[1:<? echo ($nmin); ?>], collapse=" ")
 	}
 <? 	}
 	if (($nmax = getRK_val ("nbmaximum")) != "0") { ?>
-	if (length (var) >= <? echo ($nmin); ?>) {
-		results[i, 'Maximum values'] <- paste (sort(var, decreasing=TRUE, na.last=TRUE) [1:<? echo ($nmin); ?>])
+	if (length (var) >= <? echo ($nmax); ?>) {
+		results[i, 'Maximum values'] <- paste (sort(var, decreasing=TRUE, na.last=TRUE)[1:<? echo ($nmax); ?>], collapse=" ")
 	}
 <? 	}
 	if (getRK_val ("median")) { ?>


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