[rkward-cvs] SF.net SVN: rkward: [1715] trunk/rkward/rkward/plugins/analysis/ ansari_bradley

tfry at users.sourceforge.net tfry at users.sourceforge.net
Fri Mar 23 13:54:42 UTC 2007


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

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

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/analysis/ansari_bradley/ansari_bradley_exact_test.php
    trunk/rkward/rkward/plugins/analysis/ansari_bradley/ansari_bradley_exact_test.xml
    trunk/rkward/rkward/plugins/analysis/ansari_bradley/ansari_bradley_test.php
    trunk/rkward/rkward/plugins/analysis/ansari_bradley/ansari_bradley_test.xml

Modified: trunk/rkward/rkward/plugins/analysis/ansari_bradley/ansari_bradley_exact_test.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/ansari_bradley/ansari_bradley_exact_test.php	2007-03-23 13:34:51 UTC (rev 1714)
+++ trunk/rkward/rkward/plugins/analysis/ansari_bradley/ansari_bradley_exact_test.php	2007-03-23 13:54:42 UTC (rev 1715)
@@ -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 <- ansari.exact (eval (rk.temp.x), eval (rk.temp.y), alternative = "<? getRK ("alternative"); ?>"<? echo ($exact_opt); ?>, conf.int = <? getRK ("confint"); ?> <?
+result <- ansari.exact (<? getRK ("x"); ?>, <? getRK ("y"); ?>, alternative = "<? getRK ("alternative"); ?>"<? echo ($exact_opt); ?>, conf.int = <? getRK ("confint"); ?> <?
 if (($conflevel = getRK_val ("conflevel")) != "0.95") echo (", conf.level=" . $conflevel); ?>)
 
 <?
@@ -21,24 +22,19 @@
 
 function printout () {
 ?>
-rk.header ("Ansari-Bradley two-sample 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)),"Confidence Interval", "<? getRK ("confint"); ?>", "Confidence Level",<? getRK ("conflevel"); ?>, "Compute exact p-value", "<? getRK ("exact"); ?>"))
+rk.header (result$method,
+	parameters=list ("Comparing", paste (names[1], "against", names[2]),
+	'H1', rk.describe.alternative (result),
+	"Compute exact p-value", "<? getRK ("exact"); ?>"))
 
 rk.results (list (
-	'Variable Names'=rk.get.description (rk.temp.x, rk.temp.y, is.substitute=TRUE),
-	'statistic'=rk.temp$statistic,
-	'null.value'=rk.temp$null.value,
-	'Hypothesis'=rk.temp$alternative,
-	p=rk.temp$p.value<?
+	'Variable Names'=names,
+	'statistic'=result$statistic,
+	'null.value'=result$null.value,
+	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 <? } ?>))
+	'confidence interval percent'=(100 * attr(result$conf.int, "conf.level")),
+	'confidence interval of difference'=result$conf.int<? } ?>))
 <?
 }
-
-function cleanup () {
 ?>
-rm (list=grep ("^rk.temp", ls (), value=TRUE))
-<?
-}
-?>

Modified: trunk/rkward/rkward/plugins/analysis/ansari_bradley/ansari_bradley_exact_test.xml
===================================================================
--- trunk/rkward/rkward/plugins/analysis/ansari_bradley/ansari_bradley_exact_test.xml	2007-03-23 13:34:51 UTC (rev 1714)
+++ trunk/rkward/rkward/plugins/analysis/ansari_bradley/ansari_bradley_exact_test.xml	2007-03-23 13:54:42 UTC (rev 1715)
@@ -1,7 +1,4 @@
 <!DOCTYPE rkplugin>
-
-<!-- This is a simple example, of how a "plugin" might be configured. -->
-
 <document>
 	<code file="ansari_bradley_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/ansari_bradley/ansari_bradley_test.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/ansari_bradley/ansari_bradley_test.php	2007-03-23 13:34:51 UTC (rev 1714)
+++ trunk/rkward/rkward/plugins/analysis/ansari_bradley/ansari_bradley_test.php	2007-03-23 13:54:42 UTC (rev 1715)
@@ -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 <- ansari.test (eval (rk.temp.x), eval (rk.temp.y), alternative = "<? getRK ("alternative"); ?>"<? echo ($exact_opt); ?>, conf.int = <? getRK ("confint"); ?> <?
+result <- ansari.test (<? getRK ("x"); ?>, <? getRK ("y"); ?>, alternative = "<? getRK ("alternative"); ?>"<? echo ($exact_opt); ?>, conf.int = <? getRK ("confint"); ?> <?
 if (($conflevel = getRK_val ("conflevel")) != "0.95") echo (", conf.level=" . $conflevel); ?>)
 
 <?
@@ -20,18 +20,20 @@
 
 function printout () {
 ?>
-rk.header ("Ansari-Bradley two-sample test",
-	parameters=list ("Comparing", paste (rk.get.description (rk.temp.x, is.substitute=TRUE), "against", rk.get.description (rk.temp.y, is.substitute=TRUE)),"Compute exact p-value", "<? getRK ("exact"); ?>","Confidence Interval", "<? getRK ("confint"); ?>"))
+rk.header (result$method,
+	parameters=list (
+		"Comparing", paste (names[1], "against", names[2]),
+		"Alternative Hypothesis", rk.describe.alternative(result),
+		"Compute exact p-value", "<? getRK ("exact"); ?>"))
 
 rk.results (list (
-	'Variable Names'=rk.get.description (rk.temp.x, rk.temp.y, is.substitute=TRUE),
-	'statistic'=rk.temp$statistic,
-	'null.value'=rk.temp$null.value,
-	'Alternative Hypothesis'=rk.describe.alternative(rk.temp),
-	p=rk.temp$p.value<?
+	'Variable Names'=names,
+	'statistic'=result$statistic,
+	'null.value'=result$null.value,
+	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 <? } ?>))
+	'confidence interval percent'=(100 * attr(result$conf.int, "conf.level")),
+	'confidence interval of difference'=result$conf.int<? } ?>))
 <?
 }
 

Modified: trunk/rkward/rkward/plugins/analysis/ansari_bradley/ansari_bradley_test.xml
===================================================================
--- trunk/rkward/rkward/plugins/analysis/ansari_bradley/ansari_bradley_test.xml	2007-03-23 13:34:51 UTC (rev 1714)
+++ trunk/rkward/rkward/plugins/analysis/ansari_bradley/ansari_bradley_test.xml	2007-03-23 13:54:42 UTC (rev 1715)
@@ -1,5 +1,4 @@
 <!DOCTYPE rkplugin>
-
 <document>
 	<code file="ansari_bradley_test.php"/>
 	<help file="ansari_bradley_test.rkh"/>
@@ -14,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