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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Fri Mar 23 13:34:51 UTC 2007


Revision: 1714
          http://svn.sourceforge.net/rkward/?rev=1714&view=rev
Author:   tfry
Date:     2007-03-23 06:34:51 -0700 (Fri, 23 Mar 2007)

Log Message:
-----------
local() adjustments and simplifications

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

Modified: trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_exact_test.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_exact_test.php	2007-03-23 13:15:27 UTC (rev 1713)
+++ trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_exact_test.php	2007-03-23 13:34:51 UTC (rev 1714)
@@ -1,5 +1,9 @@
 <?
-function preprocess () {
+function preprocess () { ?>
+require(exactRankTests)
+
+names <- rk.get.description (<? getRK ("x"); ?>, <? getRK ("y"); ?>)
+<?
 }
 
 function calculate () {
@@ -10,10 +14,7 @@
 		$exact_opt = ", exact=FALSE";
 	}
 ?>
-require(exactRankTests)
-rk.temp.x <- substitute (<? getRK ("x"); ?>)
-rk.temp.y <- substitute (<? getRK ("y"); ?>)
-rk.temp <- wilcox.exact (eval (rk.temp.x), eval (rk.temp.y), alternative = "<? getRK ("alternative"); ?>", mu = <? getRK ("mu"); ?>, paired = <? getRK ("paired"); ?><? echo ($exact_opt); ?>, correct = <? getRK ("correct"); ?>, conf.int = <? getRK ("confint"); ?> <?
+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); ?>)
 
 <?
@@ -21,31 +22,23 @@
 
 function printout () {
 ?>
-rk.header ("Wilcoxon exact test", 
-	parameters=list ("Comparing", paste (rk.get.description (rk.temp.x, is.substitute=TRUE), "against", rk.get.description (rk.temp.y, is.substitute=TRUE)),
-	"H1", if (rk.temp$alternative == "less")
-		paste (rk.get.short.name (rk.temp.y), "is greater than", rk.get.short.name (rk.temp.x))
-	      else if (rk.temp$alternative == "greater")
-		paste (rk.get.short.name (rk.temp.x), "is greater than", rk.get.short.name (rk.temp.y))
-	      else
-		paste (rk.get.short.name (rk.temp.x), "and", rk.get.short.name (rk.temp.y), "differ"),"Compute Confidence Interval", "<? getRK ("confint"); ?>", "Continuity correction in normal approximation for p-value", "<? getRK ("correct"); ?>", "Compute exact p-value", "<? getRK ("exact"); ?>","mu", "<? getRK ("mu"); ?>"))
+rk.header (result$method,
+	parameters=list ("Comparing", paste (names[1], "against", names[2]),
+	"H1", rk.describe.alternative (result),
+	"Continuity correction in normal approximation for p-value", "<? getRK ("correct"); ?>",
+	"Compute exact p-value", "<? getRK ("exact"); ?>",
+	"mu", "<? getRK ("mu"); ?>"))
 
 rk.results (list (
-	'Variable Names'=rk.get.description (rk.temp.x, rk.temp.y, is.substitute=TRUE),
-	'statistic'=rk.temp$statistic,
-	'Location Shift'=rk.temp$null.value,
-	'Hypothesis'=rk.temp$alternative,
-	p=rk.temp$p.value<?
+	'Variable Names'=names,
+	'statistic'=result$statistic,
+	'Location Shift'=result$null.value,
+	'Hypothesis'=result$alternative,
+	p=result$p.value<?
 	if (getRK_val ("confint")== "TRUE") { ?>,
-	'confidence interval percent'=(100 * attr(rk.temp$conf.int, "conf.level")),
-	'confidence interval of difference'=rk.temp$conf.int,
-	'Difference in Location' = rk.temp$estimate <? } ?>))
+	'confidence interval percent'=(100 * attr(result$conf.int, "conf.level")),
+	'confidence interval of difference'=result$conf.int,
+	'Difference in Location' = result$estimate<? } ?>))
 <?
 }
-
-function cleanup () {
 ?>
-rm (list=grep ("^rk.temp", ls (), value=TRUE))
-<?
-}
-?>

Modified: trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_exact_test.xml
===================================================================
--- trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_exact_test.xml	2007-03-23 13:15:27 UTC (rev 1713)
+++ trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_exact_test.xml	2007-03-23 13:34:51 UTC (rev 1714)
@@ -1,7 +1,4 @@
 <!DOCTYPE rkplugin>
-
-<!-- This is a simple example, of how a "plugin" might be configured. -->
-
 <document>
 	<code file="wilcoxon_exact_test.php"/>
 
@@ -15,9 +12,10 @@
 						<varslot type="numeric" id="y" source="vars" required="true" label="against"/>
 						<radio id="alternative" label="using test hypothesis">
 							<option value="two.sided" label="Two-sided"/>
-							<option value="greater" label="First is greater"/>
-							<option value="less" label="Second is greater"/>
+							<option value="greater" label="greater"/>
+							<option value="less" label="less"/>
 						</radio>
+						<stretch/>
 					</column>
 				</row>
 			</tab>

Modified: trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_test.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_test.php	2007-03-23 13:15:27 UTC (rev 1713)
+++ trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_test.php	2007-03-23 13:34:51 UTC (rev 1714)
@@ -1,5 +1,7 @@
 <?
-function preprocess () {
+function preprocess () { ?>
+names = rk.get.description (<? getRK ("x"); ?>, <? getRK ("y"); ?>)
+<?
 }
 
 function calculate () {
@@ -10,9 +12,7 @@
 		$exact_opt = ", exact=FALSE";
 	}
 ?>
-rk.temp.x <- substitute (<? getRK ("x"); ?>)
-rk.temp.y <- substitute (<? getRK ("y"); ?>)
-rk.temp <- wilcox.test (eval (rk.temp.x), eval (rk.temp.y), alternative = "<? getRK ("alternative"); ?>", mu = <? getRK ("mu"); ?>, paired = <? getRK ("paired"); ?><? echo ($exact_opt); ?>, correct = <? getRK ("correct"); ?>, conf.int = <? getRK ("confint"); ?> <?
+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); ?>)
 
 <?
@@ -20,31 +20,23 @@
 
 function printout () {
 ?>
-rk.header ("Wilcoxon Test",
-	parameters=list ("Comparing", paste (rk.get.description (rk.temp.x, is.substitute=TRUE), "against", rk.get.description (rk.temp.y, is.substitute=TRUE)),
-	"H1", if (rk.temp$alternative == "less")
-		paste (rk.get.short.name (rk.temp.y), "is greater than", rk.get.short.name (rk.temp.x))
-	      else if (rk.temp$alternative == "greater")
-		paste (rk.get.short.name (rk.temp.x), "is greater than", rk.get.short.name (rk.temp.y))
-	      else
-		paste (rk.get.short.name (rk.temp.x), "and", rk.get.short.name (rk.temp.y), "differ"),"Compute Confidence Interval", "<? getRK ("confint"); ?>", "Continuity correction in normal approximation for p-value", "<? getRK ("correct"); ?>", "Compute exact p-value", "<? getRK ("exact"); ?>","mu", "<? getRK ("mu"); ?>"))
+rk.header (result$method,
+	parameters=list ("Comparing", paste (names[1], "against", names[2]),
+	"H1", rk.describe.alternative (result),
+	"Continuity correction in normal approximation for p-value", "<? getRK ("correct"); ?>",
+	"Compute exact p-value", "<? getRK ("exact"); ?>",
+	"mu", "<? getRK ("mu"); ?>"))
 
 rk.results (list (
-	'Variable Names'=rk.get.description (rk.temp.x, rk.temp.y, is.substitute=TRUE),
-	'statistic'=rk.temp$statistic,
-	'Location Shift'=rk.temp$null.value,
-	'Hypothesis'=rk.temp$alternative,
-	p=rk.temp$p.value<?
-	if (getRK_val ("confint")== "TRUE") { ?>,
-	'confidence interval percent'=(100 * attr(rk.temp$conf.int, "conf.level")),
-	'confidence interval of difference'=rk.temp$conf.int,
-	'Difference in Location' = rk.temp$estimate <? } ?>))
+	'Variable Names'=names,
+	'statistic'=result$statistic,
+	'Location Shift'=result$null.value,
+	'Hypothesis'=result$alternative,
+	p=result$p.value<?
+	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<? } ?>))
 <?
 }
-
-function cleanup () {
 ?>
-rm (list=grep ("^rk.temp", ls (), value=TRUE))
-<?
-}
-?>

Modified: trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_test.xml
===================================================================
--- trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_test.xml	2007-03-23 13:15:27 UTC (rev 1713)
+++ trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_test.xml	2007-03-23 13:34:51 UTC (rev 1714)
@@ -1,7 +1,4 @@
 <!DOCTYPE rkplugin>
-
-<!-- This is a simple example, of how a "plugin" might be configured. -->
-
 <document>
 	<code file="wilcoxon_test.php"/>
 	<help file="wilcoxon_test.rkh"/>
@@ -16,9 +13,10 @@
 						<varslot type="numeric" id="y" source="vars" required="true" label="against"/>
 						<radio id="alternative" label="using test hypothesis">
 							<option value="two.sided" label="Two-sided"/>
-							<option value="greater" label="First is greater"/>
-							<option value="less" label="Second is greater"/>
+							<option value="greater" label="greater"/>
+							<option value="less" label="less"/>
 						</radio>
+						<stretch/>
 					</column>
 				</row>
 			</tab>


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