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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon Jan 29 13:20:36 UTC 2007


Revision: 1238
          http://svn.sourceforge.net/rkward/?rev=1238&view=rev
Author:   tfry
Date:     2007-01-29 05:20:36 -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_chi_squared_distribution.php
    trunk/rkward/rkward/plugins/distributions/plot_chi_squared_distribution.xml

Modified: trunk/rkward/rkward/plugins/distributions/plot_chi_squared_distribution.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_chi_squared_distribution.php	2007-01-29 13:19:20 UTC (rev 1237)
+++ trunk/rkward/rkward/plugins/distributions/plot_chi_squared_distribution.php	2007-01-29 13:20:36 UTC (rev 1238)
@@ -1,19 +1,38 @@
 <?
 	function preprocess () {
 	}
-	
+
 	function calculate () {
 	}
-	
+
 	function printout () {
-?>rk.header ("Plot density <? getRK ("function"); ?>", list ("Number of Observations", "<? getRK ("n"); ?>", "Minimum", "<? getRK ("min"); ?>", "Maximum", "<? getRK ("max"); ?>", "Degrees of freedom", "<? getRK ("df"); ?>", "Function", "<? getRK ("function"); ?>"));
 
+	$fun = getRK_val ("function");
+	if ($fun == "dchisq") {
+		$label = "density";
+		$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\"";
+		}
+	}
+	if (getRK_val ("log") == "1") $log_label="logarithmic";
+	else $log_label="normal";
+
+?>rk.header ("Chisquare <? echo ($label); ?> function", list ("Number of Observations", "<? getRK ("n"); ?>", "Lower quantile", "<? getRK ("min"); ?>", "Upper quantile", "<? getRK ("max"); ?>", "Degrees of freedom", "<? getRK ("df"); ?>", "Non-centrality", "<? getRK ("ncp"); ?>", "Scaling", "<? echo ($log_label); ?>"<? echo ($tail_tag); ?>, "Function", "<? getRK ("function"); ?>"));
+
 rk.graph.on ()
-try (plot (<? getRK ("function"); ?> (seq(<? getRK ("min"); ?> ,<? getRK ("max"); ?>, length= <? getRK ("n"); ?>) , df = <? getRK ("df"); ?>), xlab=expression(chi^2)))
+try (plot (function (x) <? getRK ("function"); ?> (x, df = <? getRK ("df"); ?>, ncp = <? getRK ("ncp"); ?>, log = <? getRK ("log"); ?><? echo ($lower_tag); ?>), from=<? getRK ("min"); ?>, to=<? getRK ("max"); ?>, n=<? getRK ("n"); ?>))
 rk.graph.off ()
 <?
 	}
-	
+
 	function cleanup () {
 	}
 ?>

Modified: trunk/rkward/rkward/plugins/distributions/plot_chi_squared_distribution.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_chi_squared_distribution.xml	2007-01-29 13:19:20 UTC (rev 1237)
+++ trunk/rkward/rkward/plugins/distributions/plot_chi_squared_distribution.xml	2007-01-29 13:20:36 UTC (rev 1238)
@@ -1,6 +1,5 @@
 <!DOCTYPE rkplugin>
-<!--This is the simple "Plot Chi-squared probabilities" plugin-->
-<document>
+<!--This is the simple "Plot Chi-squared probabilities" plugin--><document>
 	<code file="plot_chi_squared_distribution.php" />
 	<dialog label="Plot Chi-squared probabilities" >
 		<tabbook>
@@ -16,15 +15,20 @@
 								<spinbox default_precision="4" type="real" id="max" initial="24.103" label="Maximum" />
 							</frame>
 						</row>
-						<row>
-							<spinbox max_precision="1" default_precision="1" type="real" id="df" initial="0.1" label="Degrees of freedom" />
-						</row>
+							<row>
+						<frame label="Parameters">
+								<spinbox max_precision="2" default_precision="2" type="real" min="0.01" id="df" initial="4.0" label="Degrees of freedom" />
+								<spinbox max_precision="2" default_precision="2" type="real" min="0" id="ncp" initial="0" label="Non-centrality parameter" />
+						</frame>
+							</row>
 					</column>
 					<column>
 						<radio id="function" label="Choose type of function plot" >
 							<option value="dchisq" label="Plot density function" />
 							<option value="pchisq" 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