[rkward-cvs] SF.net SVN: rkward: [1076] trunk/rkward/rkward/plugins/distributions
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Sun Jan 7 16:26:21 UTC 2007
Revision: 1076
http://svn.sourceforge.net/rkward/?rev=1076&view=rev
Author: tfry
Date: 2007-01-07 08:26:21 -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/cvm_test.xml
trunk/rkward/rkward/plugins/distributions/exponential_probabilities.php
trunk/rkward/rkward/plugins/distributions/exponential_quantiles.php
trunk/rkward/rkward/plugins/distributions/f_probabilities.php
trunk/rkward/rkward/plugins/distributions/f_quantiles.php
trunk/rkward/rkward/plugins/distributions/gamma_probabilities.php
trunk/rkward/rkward/plugins/distributions/gamma_quantiles.php
trunk/rkward/rkward/plugins/distributions/geom_probabilities.php
trunk/rkward/rkward/plugins/distributions/geom_quantiles.php
trunk/rkward/rkward/plugins/distributions/gumbel_probabilities.php
trunk/rkward/rkward/plugins/distributions/gumbel_quantiles.php
trunk/rkward/rkward/plugins/distributions/hypergeometric_probabilities.php
trunk/rkward/rkward/plugins/distributions/hypergeometric_quantiles.php
Modified: trunk/rkward/rkward/plugins/distributions/cvm_test.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/cvm_test.php 2007-01-07 16:14:57 UTC (rev 1075)
+++ trunk/rkward/rkward/plugins/distributions/cvm_test.php 2007-01-07 16:26:21 UTC (rev 1076)
@@ -6,57 +6,43 @@
$vars = "substitute (" . str_replace ("\n", "), substitute (", trim (getRK_val ("x"))) . ")";
?>
- 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.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;
+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]]$cvm_test <- cvm.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 <- cvm.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 ("Cramer-von Mises 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]]$cvm_test,"</td>"))
- cat ("</tr>")
-}
- cat ("</tbody>")
-cat ("</table>")
-
-
+?>
+rk.header ("Cramer-von Mises 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/cvm_test.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/cvm_test.xml 2007-01-07 16:14:57 UTC (rev 1075)
+++ trunk/rkward/rkward/plugins/distributions/cvm_test.xml 2007-01-07 16:26:21 UTC (rev 1076)
@@ -12,9 +12,10 @@
<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>
@@ -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>
Modified: trunk/rkward/rkward/plugins/distributions/exponential_probabilities.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/exponential_probabilities.php 2007-01-07 16:14:57 UTC (rev 1075)
+++ trunk/rkward/rkward/plugins/distributions/exponential_probabilities.php 2007-01-07 16:26:21 UTC (rev 1076)
@@ -15,7 +15,7 @@
global $q;
?>
rk.header ("Exponential probabilities", list ("Vector of quantiles", "<? echo ($q); ?>", "Rate", "<? getRK ("rate"); ?>", "Tail", "<? getRK ("tail"); ?>", "Probabilities p are given as", "<? getRK ("logp"); ?>"))
-cat ("<h3>Exponential probabilities: ", rk.temp, "</h3>")
+rk.results (rk.temp, titles="Exponential probabilities")
<?
}
Modified: trunk/rkward/rkward/plugins/distributions/exponential_quantiles.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/exponential_quantiles.php 2007-01-07 16:14:57 UTC (rev 1075)
+++ trunk/rkward/rkward/plugins/distributions/exponential_quantiles.php 2007-01-07 16:26:21 UTC (rev 1076)
@@ -14,7 +14,7 @@
global $p;
?>
rk.header ("Exponential quantiles", list ("Vector of probabilities", "<? echo ($p); ?>", "Rate", "<? getRK ("rate"); ?>", "Tail", "<? getRK ("tail"); ?>", "Probabilities p are given as", "<? getRK ("logp"); ?>"))
-cat ("<h3>Exponential quantiles: ", rk.temp, "</h3>")
+rk.results (rk.temp, titles="Exponential quantiles")
<?
}
Modified: trunk/rkward/rkward/plugins/distributions/f_probabilities.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/f_probabilities.php 2007-01-07 16:14:57 UTC (rev 1075)
+++ trunk/rkward/rkward/plugins/distributions/f_probabilities.php 2007-01-07 16:26:21 UTC (rev 1076)
@@ -14,7 +14,7 @@
global $q;
?>
rk.header ("F probability", list ("Vector of quantiles", "<? echo ($q); ?>", "Numerator degrees of freedom", "<? getRK ("df1"); ?>", "Denominator degrees of freedom", "<? getRK ("df2"); ?>", "non-centrality parameter", "<? getRK ("ncp"); ?>", "Tail", "<? getRK ("tail"); ?>"));
-cat ("<h3>F probabilities: ", rk.temp, "</h3>")
+rk.results (rk.temp, titles="F probabilities")
<?
}
Modified: trunk/rkward/rkward/plugins/distributions/f_quantiles.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/f_quantiles.php 2007-01-07 16:14:57 UTC (rev 1075)
+++ trunk/rkward/rkward/plugins/distributions/f_quantiles.php 2007-01-07 16:26:21 UTC (rev 1076)
@@ -14,7 +14,7 @@
global $p;
?>
rk.header ("F quantile", list ("Vector of probabilities", "<? echo ($p); ?>", "Numerator degrees of freedom", "<? getRK ("df1"); ?>", "Denominator degrees of freedom", "<? getRK ("df2"); ?>", "Tail", "<? getRK ("tail"); ?>"));
-cat ("<h3>F quantiles: ", rk.temp, "</h3>")
+rk.results (rk.temp, titles="F quantiles")
<?
}
Modified: trunk/rkward/rkward/plugins/distributions/gamma_probabilities.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/gamma_probabilities.php 2007-01-07 16:14:57 UTC (rev 1075)
+++ trunk/rkward/rkward/plugins/distributions/gamma_probabilities.php 2007-01-07 16:26:21 UTC (rev 1076)
@@ -14,7 +14,7 @@
global $q;
?>
rk.header ("Gamma probability", list ("Vector of quantiles", "<? echo ($q); ?>", "Shape", "<? getRK ("shape"); ?>", "Rate", "<? getRK ("rate"); ?>", "Tail", "<? getRK ("tail"); ?>", "Probabilities p are given as", "<? getRK ("logp"); ?>"))
-cat ("<h3>Gamma probabilities: ", rk.temp, "</h3>")
+rk.results (rk.temp, titles="Gamma probabilities")
<?
}
Modified: trunk/rkward/rkward/plugins/distributions/gamma_quantiles.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/gamma_quantiles.php 2007-01-07 16:14:57 UTC (rev 1075)
+++ trunk/rkward/rkward/plugins/distributions/gamma_quantiles.php 2007-01-07 16:26:21 UTC (rev 1076)
@@ -15,7 +15,7 @@
global $p;
?>
rk.header ("Gamma quantile", list ("Vector of probabilities", "<? echo ($p); ?>", "Shape", "<? getRK ("shape"); ?>", "Rate", "<? getRK ("rate"); ?>", "Tail", "<? getRK ("tail"); ?>", "Probabilities p are given as", "<? getRK ("logp"); ?>"))
-cat ("<h3>Gamma quantiles: ", rk.temp, "</h3>")
+rk.results (rk.temp, titles="Gamma quantiles")
<?
}
Modified: trunk/rkward/rkward/plugins/distributions/geom_probabilities.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/geom_probabilities.php 2007-01-07 16:14:57 UTC (rev 1075)
+++ trunk/rkward/rkward/plugins/distributions/geom_probabilities.php 2007-01-07 16:26:21 UTC (rev 1076)
@@ -14,7 +14,7 @@
global $q;
?>
rk.header ("Geometric probability", list ("Vector of quantiles", "<? echo ($q); ?>", "Probability of success in each trial", "<? getRK ("prob"); ?>", "Tail", "<? getRK ("tail"); ?>", "Probabilities p are given as", "<? getRK ("logp"); ?>"))
-cat ("<h3>Geometric probabilities: ", rk.temp, "</h3>")
+rk.results (rk.temp, titles="Geometric probabilities")
<?
}
Modified: trunk/rkward/rkward/plugins/distributions/geom_quantiles.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/geom_quantiles.php 2007-01-07 16:14:57 UTC (rev 1075)
+++ trunk/rkward/rkward/plugins/distributions/geom_quantiles.php 2007-01-07 16:26:21 UTC (rev 1076)
@@ -14,7 +14,7 @@
global $p;
?>
rk.header ("Geometric quantile", list ("Vector of probabilities", "<? echo ($p); ?>", "Probability of success in each trial", "<? getRK ("prob"); ?>", "Tail", "<? getRK ("tail"); ?>", "Probabilities p are given as", "<? getRK ("logp"); ?>"))
-cat ("<h3>Geometric quantiles: ", rk.temp, "</h3>")
+rk.results (rk.temp, titles="Geometric quantiles")
<?
}
Modified: trunk/rkward/rkward/plugins/distributions/gumbel_probabilities.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/gumbel_probabilities.php 2007-01-07 16:14:57 UTC (rev 1075)
+++ trunk/rkward/rkward/plugins/distributions/gumbel_probabilities.php 2007-01-07 16:26:21 UTC (rev 1076)
@@ -14,7 +14,7 @@
global $q;
?>
rk.header ("Gumbel probability", list ("Vector of quantiles", "<? echo ($q); ?>", "Shape", "<? getRK ("shape"); ?>", "Scale", "<? getRK ("scale"); ?>", "Tail", "<? getRK ("tail"); ?>", "Probabilities p are given as", "<? getRK ("logp"); ?>"))
-cat ("<h3>Gumbel probabilities: ", rk.temp, "</h3>")
+rk.results (rk.temp, titles="Gumbel probabilities")
<?
}
Modified: trunk/rkward/rkward/plugins/distributions/gumbel_quantiles.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/gumbel_quantiles.php 2007-01-07 16:14:57 UTC (rev 1075)
+++ trunk/rkward/rkward/plugins/distributions/gumbel_quantiles.php 2007-01-07 16:26:21 UTC (rev 1076)
@@ -14,7 +14,7 @@
global $p;
?>
rk.header ("Gumbel quantile", list ("Vector of probabilities", "<? echo ($p); ?>", "Shape", "<? getRK ("shape"); ?>", "Scale", "<? getRK ("scale"); ?>", "Tail", "<? getRK ("tail"); ?>", "Probabilities p are given as", "<? getRK ("logp"); ?>"))
-cat ("<h3>Gumbel quantiles: ", rk.temp, "</h3>")
+rk.results (rk.temp, titles="Gumbel quantiles")
<?
}
Modified: trunk/rkward/rkward/plugins/distributions/hypergeometric_probabilities.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/hypergeometric_probabilities.php 2007-01-07 16:14:57 UTC (rev 1075)
+++ trunk/rkward/rkward/plugins/distributions/hypergeometric_probabilities.php 2007-01-07 16:26:21 UTC (rev 1076)
@@ -14,7 +14,7 @@
global $q;
?>
rk.header ("Hypergeometric probability", list ("Vector of quantiles", "<? echo ($q); ?>", "Number of white balls in the urn", "<? getRK ("m"); ?>", "Number of black balls in the urn", "<? getRK ("n"); ?>", "Number of balls drawn from the urn", "<? getRK ("k"); ?>", "Tail", "<? getRK ("tail"); ?>", "Probabilities p are given as", "<? getRK ("logp"); ?>"))
-cat ("<h3>Hypergeometric probabilities: ", rk.temp, "</h3>")
+rk.results (rk.temp, titles="Hypergeometric probabilities")
<?
}
Modified: trunk/rkward/rkward/plugins/distributions/hypergeometric_quantiles.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/hypergeometric_quantiles.php 2007-01-07 16:14:57 UTC (rev 1075)
+++ trunk/rkward/rkward/plugins/distributions/hypergeometric_quantiles.php 2007-01-07 16:26:21 UTC (rev 1076)
@@ -14,7 +14,7 @@
global $p;
?>
rk.header ("Hypergeometric quantile", list ("Vector of probabilities", "<? echo ($p); ?>", "Number of white balls in the urn", "<? getRK ("m"); ?>", "Number of black balls in the urn", "<? getRK ("n"); ?>", "Number of balls drawn from the urn", "<? getRK ("k"); ?>", "Tail", "<? getRK ("tail"); ?>", "Probabilities p are given as", "<? getRK ("logp"); ?>"))
-cat ("<h3>Hypergeometric quantiles: ", rk.temp, "</h3>")
+rk.results (rk.temp, titles="Hypergeometric quantiles")
<?
}
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