[rkward-cvs] SF.net SVN: rkward: [1521] trunk/rkward/rkward/plugins/analysis/outliers
sjar at users.sourceforge.net
sjar at users.sourceforge.net
Thu Mar 1 22:52:16 UTC 2007
Revision: 1521
http://svn.sourceforge.net/rkward/?rev=1521&view=rev
Author: sjar
Date: 2007-03-01 14:52:15 -0800 (Thu, 01 Mar 2007)
Log Message:
-----------
* fixes by using local({ })
* usage of rk.describe.alternative () where possible
Modified Paths:
--------------
trunk/rkward/rkward/plugins/analysis/outliers/chisq_out_test.php
trunk/rkward/rkward/plugins/analysis/outliers/dixon_test.php
trunk/rkward/rkward/plugins/analysis/outliers/grubbs_test.php
trunk/rkward/rkward/plugins/analysis/outliers/outlier.php
Modified: trunk/rkward/rkward/plugins/analysis/outliers/chisq_out_test.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/outliers/chisq_out_test.php 2007-03-01 22:51:47 UTC (rev 1520)
+++ trunk/rkward/rkward/plugins/analysis/outliers/chisq_out_test.php 2007-03-01 22:52:15 UTC (rev 1521)
@@ -10,40 +10,42 @@
rk.temp.objects <- list (<? echo ($vars); ?>)
rk.temp.results <- data.frame ('Variable Name'=rep (NA, length (rk.temp.objects)), check.names=FALSE)
-i=0;
-for (var in rk.temp.objects) {
- i = i+1
- rk.temp.results$'Variable Name'[i] <- rk.get.description (var, is.substitute=TRUE)
- try ({
- rk.temp.t <- chisq.out.test (eval (var), opposite = <? getRK ("opposite"); ?>, variance = var (eval (var)))
- rk.temp.variance <- var (eval (var))
- rk.temp.results$'Chisquared-Statistic'[i] <- rk.temp.t$statistic
- rk.temp.results$'p-value'[i] <- rk.temp.t$p.value
- rk.temp.results$'Alternative Hypothesis'[i] <- rk.temp.t$alternative
- rk.temp.results$'Variance'[i] <- rk.temp.variance
- })
- <? if (getRK_val ("mean")) { ?>
- try (rk.temp.results$'Mean'[i] <- mean (eval (var)))
- <? } ?>
- <? if (getRK_val ("sd")) { ?>
- try (rk.temp.results$'Standard Deviation'[i] <- sd (eval (var)))
- <? } ?>
- <? if (getRK_val ("median")) { ?>
- try (rk.temp.results$'Median'[i] <- median (eval (var)))
- <? } ?>
- <? if (getRK_val ("min")) { ?>
- try (rk.temp.results$'Minimum'[i] <- min (eval (var)))
- <? } ?>
- <? if (getRK_val ("max")) { ?>
- try (rk.temp.results$'Maximum'[i] <- max (eval (var)))
- <? } ?>
- <? if (getRK_val ("length")) { ?>
- try (rk.temp.results$'Length'[i] <- length (eval (var)))
- <? }
- if (getRK_val ("nacount")) { ?>
- try (rk.temp.results$'NAs'[i] <- length (which(is.na(eval (var)))))
- <? } ?>
-}
+local({
+ i=0;
+ for (var in rk.temp.objects) {
+ i = i+1
+ rk.temp.results$'Variable Name'[i] <<- rk.get.description (var, is.substitute=TRUE)
+ try ({
+ rk.temp.t <- chisq.out.test (eval (var), opposite = <? getRK ("opposite"); ?>, variance = var (eval (var)))
+ rk.temp.variance <- var (eval (var))
+ rk.temp.results$'X-squared'[i] <<- rk.temp.t$statistic
+ rk.temp.results$'p-value'[i] <<- rk.temp.t$p.value
+ rk.temp.results$'Alternative Hypothesis'[i] <<- rk.describe.alternative(rk.temp.t)
+ rk.temp.results$'Variance'[i] <<- rk.temp.variance
+ })
+ <? if (getRK_val ("mean")) { ?>
+ try (rk.temp.results$'Mean'[i] <<- mean (eval (var)))
+ <? } ?>
+ <? if (getRK_val ("sd")) { ?>
+ try (rk.temp.results$'Standard Deviation'[i] <<- sd (eval (var)))
+ <? } ?>
+ <? if (getRK_val ("median")) { ?>
+ try (rk.temp.results$'Median'[i] <<- median (eval (var)))
+ <? } ?>
+ <? if (getRK_val ("min")) { ?>
+ try (rk.temp.results$'Minimum'[i] <<- min (eval (var)))
+ <? } ?>
+ <? if (getRK_val ("max")) { ?>
+ try (rk.temp.results$'Maximum'[i] <<- max (eval (var)))
+ <? } ?>
+ <? if (getRK_val ("length")) { ?>
+ try (rk.temp.results$'Length'[i] <<- length (eval (var)))
+ <? }
+ if (getRK_val ("nacount")) { ?>
+ try (rk.temp.results$'NAs'[i] <<- length (which(is.na(eval (var)))))
+ <? } ?>
+ }
+})
<?
}
Modified: trunk/rkward/rkward/plugins/analysis/outliers/dixon_test.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/outliers/dixon_test.php 2007-03-01 22:51:47 UTC (rev 1520)
+++ trunk/rkward/rkward/plugins/analysis/outliers/dixon_test.php 2007-03-01 22:52:15 UTC (rev 1521)
@@ -10,23 +10,25 @@
rk.temp.objects <- list (<? echo ($vars); ?>)
rk.temp.results <- data.frame ('Variable Name'=rep (NA, length (rk.temp.objects)), check.names=FALSE)
-i=0;
-for (var in rk.temp.objects) {
- i = i+1
- rk.temp.results$'Variable Name'[i] <- rk.get.description (var, is.substitute=TRUE)
- try ({
- rk.temp.t <- dixon.test (eval (var), type = <? getRK ("type"); ?>, opposite = <? getRK ("opposite"); ?>, two.sided = <? getRK ("two_sided"); ?>)
- rk.temp.results$'Dixon Q-statistic'[i] <- rk.temp.t$statistic["Q"]
- rk.temp.results$'p-value'[i] <- rk.temp.t$p.value
- rk.temp.results$'Alternative'[i] <- rk.temp.t$"alternative"
- })
- <? if (getRK_val ("length")) { ?>
- try (rk.temp.results$'Length'[i] <- length (eval (var)))
- <? }
- if (getRK_val ("nacount")) { ?>
- try (rk.temp.results$'NAs'[i] <- length (which(is.na(eval (var)))))
- <? } ?>
-}
+local({
+ i=0;
+ for (var in rk.temp.objects) {
+ i = i+1
+ rk.temp.results$'Variable Name'[i] <<- rk.get.description (var, is.substitute=TRUE)
+ try ({
+ rk.temp.t <- dixon.test (eval (var), type = <? getRK ("type"); ?>, opposite = <? getRK ("opposite"); ?>, two.sided = <? getRK ("two_sided"); ?>)
+ rk.temp.results$'Dixon Q-statistic'[i] <<- rk.temp.t$statistic["Q"]
+ rk.temp.results$'p-value'[i] <<- rk.temp.t$p.value
+ rk.temp.results$'Alternative'[i] <<- rk.temp.t$"alternative"
+ })
+ <? if (getRK_val ("length")) { ?>
+ try (rk.temp.results$'Length'[i] <<- length (eval (var)))
+ <? }
+ if (getRK_val ("nacount")) { ?>
+ try (rk.temp.results$'NAs'[i] <<- length (which(is.na(eval (var)))))
+ <? } ?>
+ }
+})
<?
}
Modified: trunk/rkward/rkward/plugins/analysis/outliers/grubbs_test.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/outliers/grubbs_test.php 2007-03-01 22:51:47 UTC (rev 1520)
+++ trunk/rkward/rkward/plugins/analysis/outliers/grubbs_test.php 2007-03-01 22:52:15 UTC (rev 1521)
@@ -10,24 +10,26 @@
rk.temp.objects <- list (<? echo ($vars); ?>)
rk.temp.results <- data.frame ('Variable Name'=rep (NA, length (rk.temp.objects)), check.names=FALSE)
-i=0;
-for (var in rk.temp.objects) {
- i = i+1
- rk.temp.results$'Variable Name'[i] <- rk.get.description (var, is.substitute=TRUE)
- try ({
- rk.temp.t <- grubbs.test (eval (var), type = <? getRK ("type"); ?>, opposite = <? getRK ("opposite"); ?>, two.sided = <? getRK ("two_sided"); ?>)
- rk.temp.results$'G'[i] <- rk.temp.t$statistic["G"]
- rk.temp.results$'U'[i] <- rk.temp.t$statistic["U"]
- rk.temp.results$'p-value'[i] <- rk.temp.t$p.value
- rk.temp.results$'Alternative Hypothesis'[i] <- rk.temp.t$"alternative"
- })
- <? if (getRK_val ("length")) { ?>
- try (rk.temp.results$'Length'[i] <- length (eval (var)))
- <? }
- if (getRK_val ("nacount")) { ?>
- try (rk.temp.results$'NAs'[i] <- length (which(is.na(eval (var)))))
- <? } ?>
-}
+local({
+ i=0;
+ for (var in rk.temp.objects) {
+ i = i+1
+ rk.temp.results$'Variable Name'[i] <<- rk.get.description (var, is.substitute=TRUE)
+ try ({
+ rk.temp.t <- grubbs.test (eval (var), type = <? getRK ("type"); ?>, opposite = <? getRK ("opposite"); ?>, two.sided = <? getRK ("two_sided"); ?>)
+ rk.temp.results$'G'[i] <<- rk.temp.t$statistic["G"]
+ rk.temp.results$'U'[i] <<- rk.temp.t$statistic["U"]
+ rk.temp.results$'p-value'[i] <<- rk.temp.t$p.value
+ rk.temp.results$'Alternative Hypothesis'[i] <<- rk.describe.alternative (rk.temp.t)
+ })
+ <? if (getRK_val ("length")) { ?>
+ try (rk.temp.results$'Length'[i] <<- length (eval (var)))
+ <? }
+ if (getRK_val ("nacount")) { ?>
+ try (rk.temp.results$'NAs'[i] <<- length (which(is.na(eval (var)))))
+ <? } ?>
+ }
+})
<?
}
Modified: trunk/rkward/rkward/plugins/analysis/outliers/outlier.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/outliers/outlier.php 2007-03-01 22:51:47 UTC (rev 1520)
+++ trunk/rkward/rkward/plugins/analysis/outliers/outlier.php 2007-03-01 22:52:15 UTC (rev 1521)
@@ -10,36 +10,38 @@
rk.temp.objects <- list (<? echo ($vars); ?>)
rk.temp.results <- data.frame ('Variable Name'=rep (NA, length (rk.temp.objects)), check.names=FALSE)
-i=0;
-for (var in rk.temp.objects) {
- i = i+1
- rk.temp.results$'Variable Name'[i] <- rk.get.description (var, is.substitute=TRUE)
- try ({
- rk.temp.t <- outlier (eval (var), opposite = <? getRK ("opposite"); ?>, logical = <? getRK ("logical"); ?>)
- rk.temp.results$'Outlier'[i] <- rk.temp.t
- })
- <? if (getRK_val ("mean")) { ?>
- try (rk.temp.results$'Mean'[i] <- mean (eval (var)))
- <? } ?>
- <? if (getRK_val ("sd")) { ?>
- try (rk.temp.results$'Standard Deviation'[i] <- sd (eval (var)))
- <? } ?>
- <? if (getRK_val ("median")) { ?>
- try (rk.temp.results$'Median'[i] <- median (eval (var)))
- <? } ?>
- <? if (getRK_val ("min")) { ?>
- try (rk.temp.results$'Minimum'[i] <- min (eval (var)))
- <? } ?>
- <? if (getRK_val ("max")) { ?>
- try (rk.temp.results$'Maximum'[i] <- max (eval (var)))
- <? } ?>
- <? if (getRK_val ("length")) { ?>
- try (rk.temp.results$'Length'[i] <- length (eval (var)))
- <? }
- if (getRK_val ("nacount")) { ?>
- try (rk.temp.results$'NAs'[i] <- length (which(is.na(eval (var)))))
- <? } ?>
-}
+local({
+ i=0;
+ for (var in rk.temp.objects) {
+ i = i+1
+ rk.temp.results$'Variable Name'[i] <<- rk.get.description (var, is.substitute=TRUE)
+ try ({
+ rk.temp.t <- outlier (eval (var), opposite = <? getRK ("opposite"); ?>, logical = <? getRK ("logical"); ?>)
+ rk.temp.results$'Outlier'[i] <<- rk.temp.t
+ })
+ <? if (getRK_val ("mean")) { ?>
+ try (rk.temp.results$'Mean'[i] <<- mean (eval (var)))
+ <? } ?>
+ <? if (getRK_val ("sd")) { ?>
+ try (rk.temp.results$'Standard Deviation'[i] <<- sd (eval (var)))
+ <? } ?>
+ <? if (getRK_val ("median")) { ?>
+ try (rk.temp.results$'Median'[i] <<- median (eval (var)))
+ <? } ?>
+ <? if (getRK_val ("min")) { ?>
+ try (rk.temp.results$'Minimum'[i] <<- min (eval (var)))
+ <? } ?>
+ <? if (getRK_val ("max")) { ?>
+ try (rk.temp.results$'Maximum'[i] <<- max (eval (var)))
+ <? } ?>
+ <? if (getRK_val ("length")) { ?>
+ try (rk.temp.results$'Length'[i] <<- length (eval (var)))
+ <? }
+ if (getRK_val ("nacount")) { ?>
+ try (rk.temp.results$'NAs'[i] <<- length (which(is.na(eval (var)))))
+ <? } ?>
+ }
+})
<?
}
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