[rkward-cvs] SF.net SVN: rkward: [1077] trunk/rkward/rkward/plugins/distributions

tfry at users.sourceforge.net tfry at users.sourceforge.net
Sun Jan 7 16:31:53 UTC 2007


Revision: 1077
          http://svn.sourceforge.net/rkward/?rev=1077&view=rev
Author:   tfry
Date:     2007-01-07 08:31:53 -0800 (Sun, 07 Jan 2007)

Log Message:
-----------
Plugin coding style

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/distributions/lillie_test.php
    trunk/rkward/rkward/plugins/distributions/lillie_test.xml
    trunk/rkward/rkward/plugins/distributions/log_normal_probabilities.php
    trunk/rkward/rkward/plugins/distributions/log_normal_quantiles.php
    trunk/rkward/rkward/plugins/distributions/logistic_probabilities.php
    trunk/rkward/rkward/plugins/distributions/logistic_quantiles.php
    trunk/rkward/rkward/plugins/distributions/negative_binomial_probabilities.php
    trunk/rkward/rkward/plugins/distributions/negative_binomial_quantiles.php
    trunk/rkward/rkward/plugins/distributions/normal_probabilities.php
    trunk/rkward/rkward/plugins/distributions/normal_quantiles.php

Modified: trunk/rkward/rkward/plugins/distributions/lillie_test.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/lillie_test.php	2007-01-07 16:26:21 UTC (rev 1076)
+++ trunk/rkward/rkward/plugins/distributions/lillie_test.php	2007-01-07 16:31:53 UTC (rev 1077)
@@ -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]]$lillie <- lillie.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 <- lillie.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 ("Lilliefors (Kolmogorov-Smirnov) 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]]$lillie,"</td>"))
-		cat ("</tr>")
-}
-	cat ("</tbody>")
-cat ("</table>")
-
-
+?>
+rk.header ("Lilliefors (Kolmogorov-Smirnov) 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/lillie_test.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/lillie_test.xml	2007-01-07 16:26:21 UTC (rev 1076)
+++ trunk/rkward/rkward/plugins/distributions/lillie_test.xml	2007-01-07 16:31:53 UTC (rev 1077)
@@ -12,9 +12,10 @@
 						<varselector id="vars"/>
 					</column>
 					<column>
-						<frame label="The number of the selcted values must be larger greater than 4">
-							<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"/>
+						<text>
+							Note: Objects must have at least 5 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/log_normal_probabilities.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/log_normal_probabilities.php	2007-01-07 16:26:21 UTC (rev 1076)
+++ trunk/rkward/rkward/plugins/distributions/log_normal_probabilities.php	2007-01-07 16:31:53 UTC (rev 1077)
@@ -14,7 +14,7 @@
 	global $q;
 ?>
 rk.header ("Log Normal probability", list ("Vector of quantiles", "<? echo ($q); ?>", "meanlog", "<? getRK ("meanlog"); ?>", "sdlog", "<? getRK ("sdlog"); ?>", "Tail", "<? getRK ("tail"); ?>", "Probabilities p are given as", "<? getRK ("logp"); ?>"))
-cat ("<h3>Log Normal probabilities:  ", rk.temp, "</h3>")
+rk.results (rk.temp, titles="Log Normal probabilities")
 <?
 }
 

Modified: trunk/rkward/rkward/plugins/distributions/log_normal_quantiles.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/log_normal_quantiles.php	2007-01-07 16:26:21 UTC (rev 1076)
+++ trunk/rkward/rkward/plugins/distributions/log_normal_quantiles.php	2007-01-07 16:31:53 UTC (rev 1077)
@@ -14,7 +14,7 @@
 	global $p;
 ?>
 rk.header ("Log Normal quantile", list ("Vector of probabilities", "<? echo ($p); ?>", "meanlog", "<? getRK ("meanlog"); ?>", "sdlog", "<? getRK ("sdlog"); ?>", "Tail", "<? getRK ("tail"); ?>", "Probabilities p are given as", "<? getRK ("logp"); ?>"))
-cat ("<h3>Log Normal quantiles:  ", rk.temp, "</h3>")
+rk.results (rk.temp, titles="Log Normal quantiles")
 <?
 }
 

Modified: trunk/rkward/rkward/plugins/distributions/logistic_probabilities.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/logistic_probabilities.php	2007-01-07 16:26:21 UTC (rev 1076)
+++ trunk/rkward/rkward/plugins/distributions/logistic_probabilities.php	2007-01-07 16:31:53 UTC (rev 1077)
@@ -14,7 +14,7 @@
 	global $q;
 ?>
 rk.header ("Logistic probability", list ("Vector of quantiles", "<? echo ($q); ?>", "Location", "<? getRK ("location"); ?>", "Scale", "<? getRK ("scale"); ?>", "Tail", "<? getRK ("tail"); ?>", "Probabilities p are given as", "<? getRK ("logp"); ?>"))
-cat ("<h3>Logistic probabilities:  ", rk.temp, "</h3>")
+rk.results (rk.temp, titles="Logistic probabilities")
 <?
 }
 

Modified: trunk/rkward/rkward/plugins/distributions/logistic_quantiles.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/logistic_quantiles.php	2007-01-07 16:26:21 UTC (rev 1076)
+++ trunk/rkward/rkward/plugins/distributions/logistic_quantiles.php	2007-01-07 16:31:53 UTC (rev 1077)
@@ -14,7 +14,7 @@
 	global $p;
 ?>
 rk.header ("Logistic quantile", list ("Vector of probabilities", "<? echo ($p); ?>", "Location", "<? getRK ("location"); ?>", "Scale", "<? getRK ("scale"); ?>", "Tail", "<? getRK ("tail"); ?>", "Probabilities p are given as", "<? getRK ("logp"); ?>"))
-cat ("<h3>Logistic quantiles:  ", rk.temp, "</h3>")
+rk.results (rk.temp, titles="Logistic quantiles")
 <?
 }
 

Modified: trunk/rkward/rkward/plugins/distributions/negative_binomial_probabilities.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/negative_binomial_probabilities.php	2007-01-07 16:26:21 UTC (rev 1076)
+++ trunk/rkward/rkward/plugins/distributions/negative_binomial_probabilities.php	2007-01-07 16:31:53 UTC (rev 1077)
@@ -15,7 +15,7 @@
 	global $q;
 ?>
 rk.header ("Negative Binomial probability", list ("Vector of quantiles", "<? echo ($q); ?>", "Size", "<? getRK ("size"); ?>", "Probability of success in each trial", "<? getRK ("prob"); ?>", "Tail", "<? getRK ("tail"); ?>", "Probabilities p are given as", "<? getRK ("logp"); ?>"))
-cat ("<h3>Negative Binomial probabilities:  ", rk.temp, "</h3>")
+rk.results (rk.temp, titles="Negative Binomial probabilities")
 <?
 }
 

Modified: trunk/rkward/rkward/plugins/distributions/negative_binomial_quantiles.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/negative_binomial_quantiles.php	2007-01-07 16:26:21 UTC (rev 1076)
+++ trunk/rkward/rkward/plugins/distributions/negative_binomial_quantiles.php	2007-01-07 16:31:53 UTC (rev 1077)
@@ -14,7 +14,7 @@
 	global $p;
 ?>
 rk.header ("Negative Binomial quantile", list ("Vector of probabilities", "<? echo ($p); ?>", "Size", "<? getRK ("size"); ?>", "Probability of success in each trial", "<? getRK ("prob"); ?>", "Tail", "<? getRK ("tail"); ?>", "Probabilities p are given as", "<? getRK ("logp"); ?>"))
-cat ("<h3>Negative Binomial quantiles:  ", rk.temp, "</h3>")
+rk.results (rk.temp, titles="Negative Binomial quantiles")
 <?
 }
 

Modified: trunk/rkward/rkward/plugins/distributions/normal_probabilities.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/normal_probabilities.php	2007-01-07 16:26:21 UTC (rev 1076)
+++ trunk/rkward/rkward/plugins/distributions/normal_probabilities.php	2007-01-07 16:31:53 UTC (rev 1077)
@@ -14,7 +14,7 @@
 	global $q;
 ?>
 rk.header ("Normal probability", list ("Vector of quantiles", "<? echo ($q); ?>", "mu", "<? getRK ("mean"); ?>", "sigma", "<? getRK ("sd"); ?>", "Tail", "<? getRK ("tail"); ?>", "Probabilities p are given as", "<? getRK ("logp"); ?>"));
-cat ("<h3>Normal probabilities:  ", rk.temp, "</h3>")
+rk.results (rk.temp, titles="Normal probabilities")
 <?
 }
 

Modified: trunk/rkward/rkward/plugins/distributions/normal_quantiles.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/normal_quantiles.php	2007-01-07 16:26:21 UTC (rev 1076)
+++ trunk/rkward/rkward/plugins/distributions/normal_quantiles.php	2007-01-07 16:31:53 UTC (rev 1077)
@@ -14,7 +14,7 @@
 	global $p;
 ?>
 rk.header ("Normal quantile", list ("Vector of probabilities", "<? echo ($p); ?>", "mu", "<? getRK ("mean"); ?>", "sigma", "<? getRK ("sd"); ?>", "Tail", "<? getRK ("tail"); ?>", "Probabilities p are given as", "<? getRK ("logp"); ?>"));
-cat ("<h3>Normal quantiles:  ", rk.temp, "</h3>")
+rk.results (rk.temp, titles="Normal 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