[rkward-cvs] SF.net SVN: rkward: [1078] trunk/rkward/rkward/plugins/distributions
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Sun Jan 7 16:44:16 UTC 2007
Revision: 1078
http://svn.sourceforge.net/rkward/?rev=1078&view=rev
Author: tfry
Date: 2007-01-07 08:44:15 -0800 (Sun, 07 Jan 2007)
Log Message:
-----------
Plugin coding style
Modified Paths:
--------------
trunk/rkward/rkward/plugins/distributions/cvm_test.php
trunk/rkward/rkward/plugins/distributions/pearson_test.php
trunk/rkward/rkward/plugins/distributions/pearson_test.xml
trunk/rkward/rkward/plugins/distributions/poisson_probabilities.php
trunk/rkward/rkward/plugins/distributions/poisson_quantiles.php
trunk/rkward/rkward/plugins/distributions/sf_test.php
trunk/rkward/rkward/plugins/distributions/sf_test.xml
Modified: trunk/rkward/rkward/plugins/distributions/cvm_test.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/cvm_test.php 2007-01-07 16:31:53 UTC (rev 1077)
+++ trunk/rkward/rkward/plugins/distributions/cvm_test.php 2007-01-07 16:44:15 UTC (rev 1078)
@@ -8,8 +8,6 @@
?>
require(nortest)
-rk.temp.options <- list (dolength=<? getRK ("length"); ?>, donacount=<? getRK ("nacount"); ?>)
-
rk.temp.vars <- list (<? echo ($vars); ?>)
rk.temp.results <- data.frame ('Variable Name'=rep (NA, length (rk.temp.vars)), check.names=FALSE)
i=0;
Modified: trunk/rkward/rkward/plugins/distributions/pearson_test.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/pearson_test.php 2007-01-07 16:31:53 UTC (rev 1077)
+++ trunk/rkward/rkward/plugins/distributions/pearson_test.php 2007-01-07 16:44:15 UTC (rev 1078)
@@ -7,58 +7,43 @@
$adjust = getRK_val ("adjust");
?>
- require(nortest)
-
- rk.temp.options <- list (dolength=<? getRK ("length"); ?>, donacount=<? getRK ("nacount"); ?>)
+require(nortest)
- rk.temp.results <- list ()
- i=0; for (var in list (<? echo ($vars); ?>)) {
+rk.temp.vars <- list (<? echo ($vars); ?>)
+rk.temp.results <- data.frame ('Variable Name'=rep (NA, length (rk.temp.vars)), check.names=FALSE)
+i=0;
+for (var in rk.temp.vars) {
i = i+1
- rk.temp.results[[i]] <- list ()
- rk.temp.results[[i]]$object <- rk.get.description (var, is.substitute=TRUE)
- rk.temp.results[[i]]$pearson_test <- pearson.test (eval (var), <? echo $adjust ?> )
- if (rk.temp.options$dolength) try (rk.temp.results[[i]]$length <- length (eval (var)))
- if (rk.temp.options$donacount) try (rk.temp.results[[i]]$nacount <- length (which(is.na(eval (var)))))
+ rk.temp.results$'Variable Name'[i] <- rk.get.description (var, is.substitute=TRUE)
+ <? if (getRK_val ("length")) { ?>
+ rk.temp.results$'Length'[i] <- try (length (eval (var)))
+ <? }
+ if (getRK_val ("nacount")) { ?>
+ rk.temp.results$'NAs'[i] <- try (length (which(is.na(eval (var)))))
+ <? } ?>
+ try ({
+ rk.temp.test <- pearson.test (eval (var), <? echo $adjust; ?>)
+ rk.temp.results$'Statistic'[i] <- paste (names (rk.temp.test$statistic), rk.temp.test$statistic, sep=" = ")
+ rk.temp.results$'p-value'[i] <- rk.temp.test$p.value
+ rk.temp.results$'number of classes'[i] <- rk.temp.test$n.classes
+ rk.temp.results$'degrees of freedom'[i] <- rk.temp.test$df
+ })
}
-
-
<?
}
function printout () {
-?>
- rk.header ("Pearson chi-square Normality Test")
-cat ("<table border=\"1\">")
- cat ("<tbody>")
- cat ("<tr>")
- cat ("<td>Variable Name</td>")
- if (rk.temp.options$dolength) cat ("<td>Length</td>")
- if (rk.temp.options$donacount) cat ("<td>NAs</td>")
- cat ("<td>Statistic</td>")
- cat ("<td>p-value</td>")
- cat ("<td>Method</td>")
- cat ("<td>variable</td>")
- cat ("<td>n.classes</td>")
- cat ("<td>adjust</td>")
- cat ("</tr>")
-for (i in 1:length (rk.temp.results)) {
- cat ("<tr><td>", rk.temp.results[[i]]$object, "</td>")
- if (rk.temp.options$dolength) cat ("<td>", rk.temp.results[[i]]$length, "</td>")
- if (rk.temp.options$donacount) cat ("<td>", rk.temp.results[[i]]$nacount, "</td>")
- cat (paste ("<td>", rk.temp.results[[i]]$pearson_test,"</td>"))
- cat ("</tr>")
-}
- cat ("</tbody>")
-cat ("</table>")
-
-
+?>
+rk.header ("Pearson chi-square Normality Test")
+rk.results (rk.temp.results)
<?
}
function cleanup () {
?>
- rm (rk.temp.results)
- rm (rk.temp.options)
- rm (var)
+rm (rk.temp.results)
+rm (rk.temp.vars)
+rm (rk.temp.test)
+rm (var)
<?
}
?>
\ No newline at end of file
Modified: trunk/rkward/rkward/plugins/distributions/pearson_test.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/pearson_test.xml 2007-01-07 16:31:53 UTC (rev 1077)
+++ trunk/rkward/rkward/plugins/distributions/pearson_test.xml 2007-01-07 16:44:15 UTC (rev 1078)
@@ -12,22 +12,22 @@
<varselector id="vars"/>
</column>
<column>
- <frame label="The number of the selcted values must be greater than 7">
- <varslot type="numeric" multi="true" id="x" source="vars" required="true" label="variable(s):"/>
- </frame>
+ <varslot type="numeric" multi="true" id="x" source="vars" required="true" label="variable(s):" min_length="8"/>
+ <text>
+ Note: Objects must have at least 8 values
+ </text>
<stretch/>
</column>
</row>
</tab>
<tab label="Options">
- <frame>
<radio id="adjust" label="p-value from chi^2-distribution from:">
<option value="adjust = TRUE" label="n.classes-3 degrees of freedom" />
<option value="adjust = FALSE" label="n.classes-1 degrees of freedom" />
</radio>
- </frame>
<checkbox id="length" label="Show Length" value_unchecked="0" value="1" checked="true" />
<checkbox id="nacount" label="Show Missing Values" value_unchecked="0" value="1" checked="false" />
+ <stretch/>
</tab>
</tabbook>
</dialog>
Modified: trunk/rkward/rkward/plugins/distributions/poisson_probabilities.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/poisson_probabilities.php 2007-01-07 16:31:53 UTC (rev 1077)
+++ trunk/rkward/rkward/plugins/distributions/poisson_probabilities.php 2007-01-07 16:44:15 UTC (rev 1078)
@@ -14,7 +14,7 @@
global $q;
?>
rk.header ("Poisson probability", list ("Vector of quantiles", "<? echo ($q); ?>", "Lambda", "<? getRK ("lambda"); ?>", "Tail", "<? getRK ("tail"); ?>", "Probabilities p are given as", "<? getRK ("logp"); ?>"))
-cat ("<h3>Poisson probabilities: ", rk.temp, "</h3>")
+rk.results (rk.temp, "Poisson probabilities")
<?
}
Modified: trunk/rkward/rkward/plugins/distributions/poisson_quantiles.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/poisson_quantiles.php 2007-01-07 16:31:53 UTC (rev 1077)
+++ trunk/rkward/rkward/plugins/distributions/poisson_quantiles.php 2007-01-07 16:44:15 UTC (rev 1078)
@@ -14,7 +14,7 @@
global $p;
?>
rk.header ("Poisson quantile", list ("Vector of probabilities", "<? echo ($p); ?>", "Lambda", "<? getRK ("lambda"); ?>", "Tail", "<? getRK ("tail"); ?>", "Probabilities p are given as", "<? getRK ("logp"); ?>"))
-cat ("<h3>Poisson quantiles: ", rk.temp, "</h3>")
+rk.results (rk.temp, "Poisson quantiles")
<?
}
Modified: trunk/rkward/rkward/plugins/distributions/sf_test.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/sf_test.php 2007-01-07 16:31:53 UTC (rev 1077)
+++ trunk/rkward/rkward/plugins/distributions/sf_test.php 2007-01-07 16:44:15 UTC (rev 1078)
@@ -6,57 +6,41 @@
$vars = "substitute (" . str_replace ("\n", "), substitute (", trim (getRK_val ("x"))) . ")";
?>
- require(nortest)
+require(nortest)
- rk.temp.options <- list (dolength=<? getRK ("length"); ?>, donacount=<? getRK ("nacount"); ?>)
-
- rk.temp.results <- list ()
- i=0; for (var in list (<? echo ($vars); ?>)) {
+rk.temp.vars <- list (<? echo ($vars); ?>)
+rk.temp.results <- data.frame ('Variable Name'=rep (NA, length (rk.temp.vars)), check.names=FALSE)
+i=0;
+for (var in rk.temp.vars) {
i = i+1
- rk.temp.results[[i]] <- list ()
- rk.temp.results[[i]]$object <- rk.get.description (var, is.substitute=TRUE)
- rk.temp.results[[i]]$sf_test <- sf.test (eval (var))
- if (rk.temp.options$dolength) try (rk.temp.results[[i]]$length <- length (eval (var)))
- if (rk.temp.options$donacount) try (rk.temp.results[[i]]$nacount <- length (which(is.na(eval (var)))))
+ rk.temp.results$'Variable Name'[i] <- rk.get.description (var, is.substitute=TRUE)
+ <? if (getRK_val ("length")) { ?>
+ rk.temp.results$'Length'[i] <- try (length (eval (var)))
+ <? }
+ if (getRK_val ("nacount")) { ?>
+ rk.temp.results$'NAs'[i] <- try (length (which(is.na(eval (var)))))
+ <? } ?>
+ try ({
+ rk.temp.test <- sf.test (eval (var))
+ rk.temp.results$'Statistic'[i] <- paste (names (rk.temp.test$statistic), rk.temp.test$statistic, sep=" = ")
+ rk.temp.results$'p-value'[i] <- rk.temp.test$p.value
+ })
}
-
-
<?
}
function printout () {
?>
- rk.header ("Shapiro-Francia Normality Test")
-
-cat ("<table border=\"1\">")
- cat ("<tbody>")
- cat ("<tr>")
- cat ("<td>Variable Name</td>")
- if (rk.temp.options$dolength) cat ("<td>Length</td>")
- if (rk.temp.options$donacount) cat ("<td>NAs</td>")
- cat ("<td>Statistic</td>")
- cat ("<td>p-value</td>")
- cat ("<td>Test</td>")
- cat ("<td>variable</td>")
- cat ("</tr>")
-for (i in 1:length (rk.temp.results)) {
- cat ("<tr><td>", rk.temp.results[[i]]$object, "</td>")
- if (rk.temp.options$dolength) cat ("<td>", rk.temp.results[[i]]$length, "</td>")
- if (rk.temp.options$donacount) cat ("<td>", rk.temp.results[[i]]$nacount, "</td>")
- cat (paste ("<td>", rk.temp.results[[i]]$sf_test,"</td>"))
- cat ("</tr>")
-}
- cat ("</tbody>")
-cat ("</table>")
-
-
+rk.header ("Shapiro-Francia Normality Test")
+rk.results (rk.temp.results)
<?
}
function cleanup () {
?>
- rm (rk.temp.results)
- rm (rk.temp.options)
- rm (var)
+rm (rk.temp.results)
+rm (rk.temp.vars)
+rm (rk.temp.test)
+rm (var)
<?
}
?>
\ No newline at end of file
Modified: trunk/rkward/rkward/plugins/distributions/sf_test.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/sf_test.xml 2007-01-07 16:31:53 UTC (rev 1077)
+++ trunk/rkward/rkward/plugins/distributions/sf_test.xml 2007-01-07 16:44:15 UTC (rev 1078)
@@ -12,9 +12,10 @@
<varselector id="vars"/>
</column>
<column>
- <frame label="The number of the selcted values must be between 5 and 5000">
- <varslot type="numeric" multi="true" id="x" source="vars" required="true" label="variable(s):"/>
- </frame>
+ <varslot type="numeric" multi="true" id="x" source="vars" required="true" label="variable(s):" min_length="5" max_lenght="5000"/>
+ <text>
+ Note: Objects must have between 5 and 5000 values
+ </text>
<stretch/>
</column>
</row>
@@ -22,6 +23,7 @@
<tab label="Options">
<checkbox id="length" label="Show Length" value_unchecked="0" value="1" checked="true" />
<checkbox id="nacount" label="Show Missing Values" value_unchecked="0" value="1" checked="false" />
+ <stretch/>
</tab>
</tabbook>
</dialog>
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