[rkward-cvs] SF.net SVN: rkward: [1050] trunk/rkward/rkward/plugins/00means/00ttests/ 00independent_samples/code.php

tfry at users.sourceforge.net tfry at users.sourceforge.net
Tue Jan 2 15:50:45 UTC 2007


Revision: 1050
          http://svn.sourceforge.net/rkward/?rev=1050&view=rev
Author:   tfry
Date:     2007-01-02 07:50:45 -0800 (Tue, 02 Jan 2007)

Log Message:
-----------
Convert t-test plugin to use rk.header () and rk.results ()

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/00means/00ttests/00independent_samples/code.php

Modified: trunk/rkward/rkward/plugins/00means/00ttests/00independent_samples/code.php
===================================================================
--- trunk/rkward/rkward/plugins/00means/00ttests/00independent_samples/code.php	2007-01-02 15:50:00 UTC (rev 1049)
+++ trunk/rkward/rkward/plugins/00means/00ttests/00independent_samples/code.php	2007-01-02 15:50:45 UTC (rev 1050)
@@ -8,33 +8,35 @@
 rk.temp.var.equal <- <? getRK ("varequal"); ?> 
 rk.temp <- t.test (eval (rk.temp.x), eval (rk.temp.y), "<? getRK ("hypothesis"); ?>", var.equal=rk.temp.var.equal<?; if (($conflevel = getRK_val ("conflevel")) != "0.95") echo (", conf.level=" . $conflevel); ?>)
 rk.temp.print.conf.level <- <? if (getRK_val ("confint")) echo "TRUE"; else echo "FALSE"; ?>
+
 <?
 	}
 	
 	function printout () {
-?>cat ("<h1>T-test (independent samples)</h1>\n")
-cat (paste ("<h2>Comparing", deparse (rk.temp.x), "against", deparse (rk.temp.y), "</h2>\n"))
-if (rk.temp$alternative == "less") {
-	cat (paste ("<h3>H1:", rk.get.short.name (rk.temp.y), "is greater than", rk.get.short.name (rk.temp.x), "</h3>"))
-} else if (rk.temp$alternative == "greater") {
-	cat (paste ("<h3>H1:", rk.get.short.name (rk.temp.x), "is greater than", rk.get.short.name (rk.temp.y), "</h3>"))
-} else {
-	cat (paste ("<h3>H1:", rk.get.short.name (rk.temp.x), "and", rk.get.short.name (rk.temp.y), "differ</h3>"))
-}
-if (rk.temp.var.equal) {
-	cat ("<h4>Assuming equal variances</h4>")
-} else {
-	cat ("<h4>Not assuming equal variances</h4>")
-}
-cat ("<table border=\"1\">")
-cat ("<tr><td>Variable</td><td>estimated mean</td><td>degrees of freedom</td><td>t</td><td>p</td>")
-if (rk.temp.print.conf.level) cat (paste ("<td>confidence interval of difference (", 100 * attr(rk.temp$conf.int, "conf.level"), "%)</td>", sep=""))
-cat ("</tr>\n")
-cat (paste ("<tr><td>", rk.get.description (rk.temp.x), "</td><td>", rk.temp$estimate[1], "</td><td rowspan=\"2\">", rk.temp$parameter, "</td><td rowspan=\"2\">", rk.temp$statistic, "</td><td rowspan=\"2\">", rk.temp$p.value, "</td>", sep=""))
-if (rk.temp.print.conf.level) cat (paste ("<td rowspan=\"2\">[", rk.temp$conf.int[1], " .. ", rk.temp$conf.int[2],"]</td>", sep=""))
-cat ("</tr>\n")
-cat (paste ("<tr><td>", rk.get.description (rk.temp.y), "</td><td>", rk.temp$estimate[2], "</td></tr>", sep=""))
-cat ("</table>")
+?>
+rk.header ("T-test (independent samples)", 
+	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"),
+	"Equal variances:", if (rk.temp.var.equal) "assumed" else "not assumed"))
+
+rk.results (list (
+	rk.get.description (rk.temp.x),
+	rk.temp$estimate,
+	rk.temp$parameter,
+	rk.temp$statistic,
+	rk.temp$p.value,
+	if (rk.temp.print.conf.level) rk.temp$conf.int),
+	titles=c ("Variable",
+	"estimated mean",
+	"degrees of freedom",
+	"t",
+	"p",
+	if (rk.temp.print.conf.level) paste ("confidence interval of difference (", 100 * attr(rk.temp$conf.int, "conf.level"), "%)")))
 <?
 	}
 	


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