[rkward-cvs] SF.net SVN: rkward: [1520] trunk/rkward/rkward/plugins/analysis/moments
sjar at users.sourceforge.net
sjar at users.sourceforge.net
Thu Mar 1 22:51:48 UTC 2007
Revision: 1520
http://svn.sourceforge.net/rkward/?rev=1520&view=rev
Author: sjar
Date: 2007-03-01 14:51:47 -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/moments/agostino_test.php
trunk/rkward/rkward/plugins/analysis/moments/anscombe_test.php
trunk/rkward/rkward/plugins/analysis/moments/bonett_test.php
trunk/rkward/rkward/plugins/analysis/moments/moment.php
trunk/rkward/rkward/plugins/analysis/moments/skewness_kurtosis_test.php
Modified: trunk/rkward/rkward/plugins/analysis/moments/agostino_test.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/moments/agostino_test.php 2007-03-01 22:50:48 UTC (rev 1519)
+++ trunk/rkward/rkward/plugins/analysis/moments/agostino_test.php 2007-03-01 22:51:47 UTC (rev 1520)
@@ -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 <- agostino.test (eval (var), alternative = "<? getRK ("alternative"); ?>")
- rk.temp.results$'skewness estimator (skew)'[i] <- rk.temp.t$statistic["skew"]
- rk.temp.results$'transformation (z)'[i] <- rk.temp.t$statistic["z"]
- rk.temp.results$'p-value'[i] <- rk.temp.t$p.value
- })
- <? 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 <- agostino.test (eval (var), alternative = "<? getRK ("alternative"); ?>")
+ rk.temp.results$'skewness estimator (skew)'[i] <<- rk.temp.t$statistic["skew"]
+ rk.temp.results$'transformation (z)'[i] <<- rk.temp.t$statistic["z"]
+ rk.temp.results$'p-value'[i] <<- rk.temp.t$p.value
+ })
+ <? 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/moments/anscombe_test.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/moments/anscombe_test.php 2007-03-01 22:50:48 UTC (rev 1519)
+++ trunk/rkward/rkward/plugins/analysis/moments/anscombe_test.php 2007-03-01 22:51:47 UTC (rev 1520)
@@ -10,23 +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 ({
+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 <- anscombe.test (eval (var), alternative = "<? getRK ("alternative"); ?>")
- rk.temp.results$'kurtosis estimator (tau)'[i] <- rk.temp.t$statistic["kurt"]
- rk.temp.results$'transformation (z)'[i] <- rk.temp.t$statistic["z"]
- rk.temp.results$'p-value'[i] <- rk.temp.t$p.value
- })
- <? 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)))))
- <? } ?>
-}
+ rk.temp.results$'Kurtosis estimator (tau)'[i] <<- rk.temp.t$statistic["kurt"]
+ rk.temp.results$'Transformation (z)'[i] <<- rk.temp.t$statistic["z"]
+ 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/moments/bonett_test.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/moments/bonett_test.php 2007-03-01 22:50:48 UTC (rev 1519)
+++ trunk/rkward/rkward/plugins/analysis/moments/bonett_test.php 2007-03-01 22:51:47 UTC (rev 1520)
@@ -10,23 +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 <- bonett.test (eval (var), alternative = "<? getRK ("alternative"); ?>")
- rk.temp.results$'kurtosis estimator (tau)'[i] <- rk.temp.t$statistic["tau"]
- rk.temp.results$'transformation (z)'[i] <- rk.temp.t$statistic["z"]
- rk.temp.results$'p-value'[i] <- rk.temp.t$p.value
- })
- <? 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 <- bonett.test (eval (var), alternative = "<? getRK ("alternative"); ?>")
+ rk.temp.results$'Kurtosis estimator (tau)'[i] <<- rk.temp.t$statistic["tau"]
+ rk.temp.results$'Transformation (z)'[i] <<- rk.temp.t$statistic["z"]
+ 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/moments/moment.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/moments/moment.php 2007-03-01 22:50:48 UTC (rev 1519)
+++ trunk/rkward/rkward/plugins/analysis/moments/moment.php 2007-03-01 22:51:47 UTC (rev 1520)
@@ -10,18 +10,20 @@
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.results$'Moment'[i] <- moment (eval (var), central = <? getRK ("central"); ?>, absolute = <? getRK ("absolute"); ?>, na.rm = <? getRK ("narm"); ?>))
- <? 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.results$'Moment'[i] <<- moment (eval (var), central = <? getRK ("central"); ?>, absolute = <? getRK ("absolute"); ?>, na.rm = <? getRK ("narm"); ?>))
+ <? 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/moments/skewness_kurtosis_test.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/moments/skewness_kurtosis_test.php 2007-03-01 22:50:48 UTC (rev 1519)
+++ trunk/rkward/rkward/plugins/analysis/moments/skewness_kurtosis_test.php 2007-03-01 22:51:47 UTC (rev 1520)
@@ -12,32 +12,34 @@
?>
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)
+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)
+ <?
+ if (getRK_val ("skewness")) { ?>
+ try (rk.temp.results$'Skewness'[i] <<- skewness (eval (var)<? echo ($narm); ?>))
+ <? }
+ if (getRK_val ("kurtosis")) { ?>
+ try ({
+ rk.temp.results$'Kurtosis'[i] <<- kurtosis (eval (var)<? echo ($narm); ?>)
+ rk.temp.results$'Excess Kurtosis'[i] <<- rk.temp.results$'Kurtosis'[i] - 3
+ })
+ <? }
+ if (getRK_val ("geary")) { ?>
+ try (rk.temp.results$'Geary kurtosis'[i] <<- geary (eval (var)<? echo ($narm); ?>))
+ <? }
+ 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)))))
+ <? } ?>
+ }
+})
<?
- if (getRK_val ("skewness")) { ?>
- try (rk.temp.results$'Skewness'[i] <- skewness (eval (var)<? echo ($narm); ?>))
-<? }
- if (getRK_val ("kurtosis")) { ?>
- try ({
- rk.temp.results$'Kurtosis'[i] <- kurtosis (eval (var)<? echo ($narm); ?>)
- rk.temp.results$'Excess Kurtosis'[i] <- rk.temp.results$'Kurtosis'[i] - 3
- })
-<? }
- if (getRK_val ("geary")) { ?>
- try (rk.temp.results$'Geary kurtosis'[i] <- geary (eval (var)<? echo ($narm); ?>))
-<? }
- 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)))))
-<? } ?>
}
-<?
-}
function printout () {
?>
rk.header ("Skewness and Kurtosis")
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