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

nono_231 at users.sourceforge.net nono_231 at users.sourceforge.net
Sat Apr 28 06:21:00 UTC 2007


Revision: 1857
          http://svn.sourceforge.net/rkward/?rev=1857&view=rev
Author:   nono_231
Date:     2007-04-27 23:21:00 -0700 (Fri, 27 Apr 2007)

Log Message:
-----------
Corrections to the Crosstab plugin (dim vs length) and addition of simulation of p value to chisquare test.

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

Modified: trunk/rkward/rkward/plugins/analysis/crosstab.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/crosstab.php	2007-04-27 13:56:14 UTC (rev 1856)
+++ trunk/rkward/rkward/plugins/analysis/crosstab.php	2007-04-28 06:21:00 UTC (rev 1857)
@@ -28,19 +28,19 @@
 x <- (<? echo ($x); ?>)
 y <- cbind (<? echo ($yvarsstring); ?>)
 
-for (i in 1:length(y)){
+for (i in 1:dim(y)[2]){
 xy<-table(x,y[,i])
 rk.header ("Crosstabs", list ("Dependent", rk.get.description (<? echo ($x); ?>), "Independent", rk.get.description (<? echo ($yvarsstring); ?>)[i]))
 
 <?	if ($final) { ?>
 rk.print(xtable(cbind(xy)))
 <?	if (getRK_val ("chisq") == "TRUE") { ?>
-rk.header ("Pearson's Chi Square Test for Crosstabs", list ("Dependent", rk.get.description (<? echo ($x); ?>), "Independent", rk.get.description (<? echo ($yvarsstring); ?>)[i], "Monte Carlo", "<? getRK ("monte"); ?>" <? if (getRK_val ("monte") == "TRUE") { ?>,  "Number of replicates", <? getRK ("B"); }?> ))
+rk.header ("Pearson's Chi Square Test for Crosstabs", list ("Dependent", rk.get.description (<? echo ($x); ?>), "Independent", rk.get.description (<? echo ($yvarsstring); ?>)[i], "Simulate p vlaue", "<? getRK ("simpv");?>", "Monte Carlo", "<? getRK ("monte"); ?>" <? if (getRK_val ("monte") == "TRUE") { ?>,  "Number of replicates", <? getRK ("B"); }?> ))
 xsquared<-cbind(
-chisq.test(xy)$statistic,
- chisq.test(xy)$parameter,
- chisq.test(xy)$p.value)
- colnames(xsquared)<-c("Statistic", "df", "p-value")
+chisq.test(xy, simulate.p.value = <? getRK ("simpv");?> <?if (getRK_val ("monte") == "TRUE") { ?>,B=(<? getRK ("B"); ?>) <?}?> )$statistic,
+<?if (getRK_val ("simpv") == "FALSE") {?> chisq.test(xy, simulate.p.value = <? getRK ("simpv");?> <?if (getRK_val ("monte") == "TRUE") { ?>,B=(<? getRK ("B"); ?>) <?}?> )$parameter, <?}?>
+chisq.test(xy, simulate.p.value = <? getRK ("simpv");?> <?if (getRK_val ("monte") == "TRUE") { ?>,B=(<? getRK ("B"); ?>) <?}?> )$p.value)
+ colnames(xsquared)<-c("Statistic", <?if (getRK_val ("simpv") == "FALSE") {?> "df", <?}?> "p-value")
  rk.print(xtable(xsquared))
 <? } ?>
 <?	if (getRK_val ("barplot") == "TRUE") { ?>

Modified: trunk/rkward/rkward/plugins/analysis/crosstab.xml
===================================================================
--- trunk/rkward/rkward/plugins/analysis/crosstab.xml	2007-04-27 13:56:14 UTC (rev 1856)
+++ trunk/rkward/rkward/plugins/analysis/crosstab.xml	2007-04-28 06:21:00 UTC (rev 1857)
@@ -28,6 +28,7 @@
 				</row>
 			</tab>
 			<tab label="Chisquare Options" id="chi_options">
+				<checkbox id="simpv" label="Simulate p value" value="TRUE" value_unchecked="FALSE" checked="false" />
 				<radio id="monte" label="Method">
 					<option value="FALSE" label="Asymptotic"  checked="true" />				
 					<option value="TRUE" label="Monte Carlo" />


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