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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon Jan 29 13:12:15 UTC 2007


Revision: 1235
          http://svn.sourceforge.net/rkward/?rev=1235&view=rev
Author:   tfry
Date:     2007-01-29 05:12:14 -0800 (Mon, 29 Jan 2007)

Log Message:
-----------
Additional parameters, use plot.function to get better x axis labelling (Prasenjit Kapat)

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/distributions/plot_poisson_distribution.php
    trunk/rkward/rkward/plugins/distributions/plot_poisson_distribution.xml

Modified: trunk/rkward/rkward/plugins/distributions/plot_poisson_distribution.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_poisson_distribution.php	2007-01-29 12:59:30 UTC (rev 1234)
+++ trunk/rkward/rkward/plugins/distributions/plot_poisson_distribution.php	2007-01-29 13:12:14 UTC (rev 1235)
@@ -1,19 +1,39 @@
 <?
 	function preprocess () {
 	}
-	
+
 	function calculate () {
 	}
-	
+
 	function printout () {
-?>rk.header ("Plot density <? getRK ("function"); ?>", list ("Minimum", "<? getRK ("min"); ?>", "Maximum", "<? getRK ("max"); ?>", "Mean", "<? getRK ("mean"); ?>", "Function", "<? getRK ("function"); ?>"));
+	$fun = getRK_val ("function");
+	if ($fun == "dpois") {
+		$label = "mass";
+		$lower_tag = "";
+		$tail_tag = "";
+	} else {
+		$label = "distribution";
+		if (getRK_val("lower") == "1") {
+			$lower_tag = ", lower.tail = 1";
+			$tail_tag = ", \"Tail\",\"Lower\"";
+		} else {
+			$lower_tag = ", lower.tail = 0";
+			$tail_tag = ", \"Tail\",\"Upper\"";
+		}
+	}
+	$min = getRK_val ("min");
+	$max = getRK_val ("max");
+	if (getRK_val ("log") == "1") $log_label="logarithmic";
+	else $log_label="normal";
 
+?>rk.header ("Poisson <? echo ($label); ?> function", list ("Lower quantile", "<? getRK ("min"); ?>", "Upper quantile", "<? getRK ("max"); ?>", "Mean", "<? getRK ("mean"); ?>", "Scaling", "<? echo ($log_label); ?>"<? echo ($tail_tag); ?>, "Function", "<? getRK ("function"); ?>"));
+
 rk.graph.on ()
-try (plot (<? getRK ("function"); ?> (<? getRK ("min"); ?> : <? getRK ("max"); ?>, lambda = <? getRK ("mean"); ?>)))
+try (plot (function (x) <? getRK ("function"); ?> (x, lambda = <? getRK ("mean"); ?>, log = <? getRK ("log"); ?><? echo ($lower_tag); ?>), from=<? getRK ("min"); ?>, to=<? getRK ("max"); ?>, n=<? echo ($max - $min + 1); ?>, type="p"))
 rk.graph.off ()
 <?
 	}
-	
+
 	function cleanup () {
 	}
 ?>

Modified: trunk/rkward/rkward/plugins/distributions/plot_poisson_distribution.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_poisson_distribution.xml	2007-01-29 12:59:30 UTC (rev 1234)
+++ trunk/rkward/rkward/plugins/distributions/plot_poisson_distribution.xml	2007-01-29 13:12:14 UTC (rev 1235)
@@ -1,5 +1,5 @@
 <!DOCTYPE rkplugin>
-<document>
+<!--This is the simple "Plot Poisson probabilities" plugin--><document>
 	<code file="plot_poisson_distribution.php" />
 	<dialog label="Plot Poisson probabilities" >
 		<tabbook>
@@ -8,19 +8,21 @@
 					<column>
 						<row>
 							<frame label="Range" >
-							<spinbox type="real" min="0" id="min" initial="0" label="Minimum" />
-							<spinbox type="real" min="0" id="max" initial="12" label="Maximum" />
+								<spinbox type="integer" min = "0" id="min" initial="0" label="Lower quantile" />
+								<spinbox type="integer" min = "0" id="max" initial="12" label="Upper quantile" />
 							</frame>
 						</row>
 						<row>
-							<spinbox type="real" id="mean" initial="0" label="mean" />
+							<spinbox type="real" id="mean" min="0" initial="5" label="Mean" />
 						</row>
-						</column>
-						<column>
+					</column>
+					<column>
 						<radio id="function" label="Choose type of function plot" >
 							<option value="dpois" label="Plot density function" />
 							<option value="ppois" label="Plot distribution" />
 						</radio>
+						<checkbox id="log" label="Logarithmic" value="1" value_unchecked="0"/>
+						<checkbox id="lower" label="Lower Tail" value="1" value_unchecked="0" checked="true"/>
 						<stretch/>
 					</column>
 				</row>


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