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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon Jan 29 13:25:10 UTC 2007


Revision: 1239
          http://svn.sourceforge.net/rkward/?rev=1239&view=rev
Author:   tfry
Date:     2007-01-29 05:25:10 -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_binomial_distribution.php
    trunk/rkward/rkward/plugins/distributions/plot_binomial_distribution.xml

Modified: trunk/rkward/rkward/plugins/distributions/plot_binomial_distribution.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_binomial_distribution.php	2007-01-29 13:20:36 UTC (rev 1238)
+++ trunk/rkward/rkward/plugins/distributions/plot_binomial_distribution.php	2007-01-29 13:25:10 UTC (rev 1239)
@@ -1,41 +1,41 @@
 <?
 	function preprocess () {
 	}
-	
+
 	function calculate () {
 	}
-	
+
 	function printout () {
-		$fun = getRK_val ("function");
-		if ($fun == "dbinom") $label = "density";
-		else $label = "distribution";
-	
-		$min = getRK_val ("min");
-		$nq = getRK_val ("nq");
-		$space = getRK_val ("space");
-		$size = getRK_val ("size");
-		$prob = getRK_val ("prob");
-	
-		if (getRK_val ("log") == "1") {
-			if ($fun == "dbinom") {
-				$log = ", log=TRUE";
-			} else {
-				$log = ", log.p=TRUE";
-			}
-			$log_label="logarithmic";
+	$fun = getRK_val ("function");
+	if ($fun == "dbinom") {
+		$label = "mass";
+		$lower_tag = "";
+		$tail_tag = "";
+	} else {
+		$label = "distribution";
+		if (getRK_val("lower") == "1") {
+			$lower_tag = ", lower.tail = 1";
+			$tail_tag = ", \"Tail\",\"Lower\"";
 		} else {
-			$log = "";
-			$log_label="normal";
+			$lower_tag = ", lower.tail = 0";
+			$tail_tag = ", \"Tail\",\"Upper\"";
 		}
+	}
+	$min = getRK_val ("min");
+	$size = getRK_val ("size");
+	$prob = getRK_val ("prob");
+	$max = getRK_val ("max");
+	if (getRK_val ("log") == "1") $log_label="logarithmic";
+	else $log_label="normal";
 
-?>rk.header ("Plot binomial <? echo ($label); ?>", list ("Lowest quantile", "<? echo ($min); ?>", "Largest quantile", "<? echo ($min + ($nq * $space)); ?>", "Quantile spacing", "<? echo ($space); ?>", "Number of trials", "<? echo ($size); ?>", "Probability of success on each trial", "<? echo ($prob); ?>", "Function", "<? getRK ("function"); ?>", "Scaling", "<? echo ($log_label); ?>"));
+?>rk.header ("Binomial <? echo ($label); ?> function", list ("Lower quantile", "<? getRK ("min"); ?>", "Upper quantile", "<? getRK ("max"); ?>", "Number of trials", "<? echo ($size); ?>", "Probability of success on each trial", "<? echo ($prob); ?>", "Scaling", "<? echo ($log_label); ?>"<? echo ($tail_tag); ?>, "Function", "<? getRK ("function"); ?>"));
 
 rk.graph.on ()
-try (plot (<? getRK ("function"); ?> (seq (<? echo ($min); ?>, <? echo ($min + ($nq * $space)); ?>, by=<? echo ($space); ?>) , size=<? echo ($size); ?>, prob=<? echo ($prob); echo ($log); ?>)))
+try (plot (function (x) <? getRK ("function"); ?> (x, size = <? getRK ("size"); ?>, prob=<? echo ($prob); ?>, log = <? getRK ("log"); ?><? echo ($lower_tag); ?>), from=<? echo ($min); ?>, to=<? echo ($max); ?>, n=<? echo ($max - $min + 1); ?>, type="p"))
 rk.graph.off ()
 <?
 	}
-	
+
 	function cleanup () {
 	}
 ?>

Modified: trunk/rkward/rkward/plugins/distributions/plot_binomial_distribution.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_binomial_distribution.xml	2007-01-29 13:20:36 UTC (rev 1238)
+++ trunk/rkward/rkward/plugins/distributions/plot_binomial_distribution.xml	2007-01-29 13:25:10 UTC (rev 1239)
@@ -1,32 +1,32 @@
 <!DOCTYPE rkplugin>
 <!--This is the simple "Plot binomial probabilities" plugin-->
 <document>
-<code file="plot_binomial_distribution.php" />
-<dialog label="Plot binomial probabilities" >
-	<tabbook>
-	<tab label="Plot binomial probabilities" >
-		<row>
-			<column>
-				<frame label="Quantiles">
-					<spinbox  type="integer" id="min" initial="0" label="lowest quantile" />
-					<spinbox  type="integer" id="space" initial="1" min="1" label="quantile spacing" />
-					<spinbox  type="integer" id="nq" initial="100" min="1" label="number of quantiles" />
-				</frame>
+	<code file="plot_binomial_distribution.php" />
+	<dialog label="Plot binomial probabilities" >
+		<tabbook>
+			<tab label="Plot binomial probabilities" >
 				<row>
-					<spinbox type="integer" id="size" initial="100" min="0" label="Number of trials" />
-					<spinbox max_precision="4" default_precision="2" type="real" id="prob" initial="0.5" min="0" max="1" label="Probability of success on each trial" />
+					<column>
+						<frame label="Range" >
+							<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>
+						<frame label="Parameters">
+							<spinbox type="integer" id="size" min="0" initial="12" label="Number of trials" />
+							<spinbox max_precision="4" default_precision="2" type="real" id="prob" initial="0.5" min="0" max="1" label="Probability of success on each trial" />
+						</frame>
+					</column>
+					<column>
+						<radio id="function" label="Choose type of function plot" >
+							<option value="dbinom" label="Plot density function" />
+							<option value="pbinom" 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>
-			</column>
-			<column>
-				<radio id="function" label="Choose type of function plot" >
-					<option value="dbinom" label="Plot density function" />
-					<option value="pbinom" label="Plot distribution" />
-				</radio>
-				<checkbox id="log" label="Logarithmic" value="1"/>
-			<stretch/>
-			</column>
-		</row>
-	</tab>
-	</tabbook>
-</dialog>
+			</tab>
+		</tabbook>
+	</dialog>
 </document>


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