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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon Jan 29 12:39:50 UTC 2007


Revision: 1231
          http://svn.sourceforge.net/rkward/?rev=1231&view=rev
Author:   tfry
Date:     2007-01-29 04:39:50 -0800 (Mon, 29 Jan 2007)

Log Message:
-----------
Adding new distribution plots (Prasenjit Kapat)

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/all.pluginmap
    trunk/rkward/rkward/plugins/under_development.pluginmap

Added Paths:
-----------
    trunk/rkward/rkward/plugins/distributions/plot_gamma_distribution.php
    trunk/rkward/rkward/plugins/distributions/plot_gamma_distribution.xml
    trunk/rkward/rkward/plugins/distributions/plot_geometric_distribution.php
    trunk/rkward/rkward/plugins/distributions/plot_geometric_distribution.xml
    trunk/rkward/rkward/plugins/distributions/plot_hypergeometric_distribution.php
    trunk/rkward/rkward/plugins/distributions/plot_hypergeometric_distribution.xml
    trunk/rkward/rkward/plugins/distributions/plot_negbinomial_distribution.php
    trunk/rkward/rkward/plugins/distributions/plot_negbinomial_distribution.xml

Modified: trunk/rkward/rkward/plugins/all.pluginmap
===================================================================
--- trunk/rkward/rkward/plugins/all.pluginmap	2007-01-27 07:13:45 UTC (rev 1230)
+++ trunk/rkward/rkward/plugins/all.pluginmap	2007-01-29 12:39:50 UTC (rev 1231)
@@ -6,6 +6,5 @@
 	<include file="distributions.pluginmap"/>
 	<include file="plots.pluginmap"/>
 	<include file="x11device.pluginmap"/>
-	<include file="under_development.pluginmap"/>
 </document>
  

Added: trunk/rkward/rkward/plugins/distributions/plot_gamma_distribution.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_gamma_distribution.php	                        (rev 0)
+++ trunk/rkward/rkward/plugins/distributions/plot_gamma_distribution.php	2007-01-29 12:39:50 UTC (rev 1231)
@@ -0,0 +1,38 @@
+<?
+	function preprocess () {
+	}
+
+	function calculate () {
+	}
+
+	function printout () {
+
+	$fun = getRK_val ("function");
+	if ($fun == "dchisq") {
+		$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\"";
+		}
+	}
+	if (getRK_val ("log") == "1") $log_label="logarithmic";
+	else $log_label="normal";
+
+?>rk.header ("Plot density <? getRK ("function"); ?>", list ("Number of Observations", "<? getRK ("n"); ?>", "Minimum", "<? getRK ("min"); ?>","Maximum", "<? getRK ("max"); ?>", "Shape", "<? getRK ("shape"); ?>", "Rate", "<? getRK ("rate"); ?>", "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"); ?>) , shape = <? getRK ("shape"); ?>, rate = <? getRK ("rate"); ?>)))
+rk.graph.off ()
+<?
+	}
+
+	function cleanup () {
+	}
+?>

Added: trunk/rkward/rkward/plugins/distributions/plot_gamma_distribution.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_gamma_distribution.xml	                        (rev 0)
+++ trunk/rkward/rkward/plugins/distributions/plot_gamma_distribution.xml	2007-01-29 12:39:50 UTC (rev 1231)
@@ -0,0 +1,34 @@
+<!DOCTYPE rkplugin>
+<!--This is the simple "Plot gamma probabilities" plugin--><document>
+	<code file="plot_gamma_distribution.php" />
+	<dialog label="Plot gamma probabilities" >
+		<tabbook>
+			<tab label="Plot gamma probabilities" >
+				<row>
+					<column>
+						<row>
+							<spinbox max_precision="2" default_precision="2" type="real" id="n" initial="100" label="Number of Observations" />
+						</row>
+						<row>
+							<frame label="Range" >
+								<spinbox max_precision="2" default_precision="2" type="real" id="min" initial="0" label="Minimum" />
+								<spinbox max_precision="2" default_precision="2" type="real" id="max" initial="4.6" label="Maximum" />
+							</frame>
+						</row>
+						<row>
+							<spinbox max_precision="2" default_precision="2" type="real" id="shape" initial="1" label="a (shape)" />
+							<spinbox max_precision="2" default_precision="2" type="real" id="rate" initial="1" label="lambda (rate)" label="rate or 1/scale" />
+						</row>
+					</column>
+					<column>
+						<radio id="function" label="Choose type of function plot" >
+							<option value="dgamma" label="Plot density function" />
+							<option value="pgamma" label="Plot distribution" />
+						</radio>
+						<stretch/>
+					</column>
+				</row>
+			</tab>
+		</tabbook>
+	</dialog>
+</document>

Added: trunk/rkward/rkward/plugins/distributions/plot_geometric_distribution.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_geometric_distribution.php	                        (rev 0)
+++ trunk/rkward/rkward/plugins/distributions/plot_geometric_distribution.php	2007-01-29 12:39:50 UTC (rev 1231)
@@ -0,0 +1,40 @@
+<?
+	function preprocess () {
+	}
+
+	function calculate () {
+	}
+
+	function printout () {
+	$fun = getRK_val ("function");
+	if ($fun == "dgeom") {
+		$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");
+	$prob = getRK_val ("prob");
+	$max = getRK_val ("max");
+	if (getRK_val ("log") == "1") $log_label="logarithmic";
+	else $log_label="normal";
+
+?>rk.header ("Geometric <? echo ($label); ?> function", list ("Lower quantile", "<? getRK ("min"); ?>", "Upper quantile", "<? getRK ("max"); ?>", "Probability of success on each trial", "<? echo ($prob); ?>", "Scaling", "<? echo ($log_label); ?>"<? echo ($tail_tag); ?>, "Function", "<? getRK ("function"); ?>"));
+
+rk.graph.on ()
+try (plot (function (x) <? getRK ("function"); ?> (x, 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 () {
+	}
+?>

Added: trunk/rkward/rkward/plugins/distributions/plot_geometric_distribution.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_geometric_distribution.xml	                        (rev 0)
+++ trunk/rkward/rkward/plugins/distributions/plot_geometric_distribution.xml	2007-01-29 12:39:50 UTC (rev 1231)
@@ -0,0 +1,31 @@
+<!DOCTYPE rkplugin>
+<!--This is the simple "Plot geometric probabilities" plugin-->
+<document>
+	<code file="plot_geometric_distribution.php" />
+	<dialog label="Plot geometric probabilities" >
+		<tabbook>
+			<tab label="Plot geometric probabilities" >
+				<row>
+					<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 max_precision="2" 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="dgeom" label="Plot density function" />
+							<option value="pgeom" 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>
+			</tab>
+		</tabbook>
+	</dialog>
+</document>

Added: trunk/rkward/rkward/plugins/distributions/plot_hypergeometric_distribution.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_hypergeometric_distribution.php	                        (rev 0)
+++ trunk/rkward/rkward/plugins/distributions/plot_hypergeometric_distribution.php	2007-01-29 12:39:50 UTC (rev 1231)
@@ -0,0 +1,39 @@
+<?
+	function preprocess () {
+	}
+
+	function calculate () {
+	}
+
+	function printout () {
+	$fun = getRK_val ("function");
+	if ($fun == "dhyper") {
+		$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 ("Hypergeometric <? echo ($label); ?> function", list ("Lower quantile", "<? getRK ("min"); ?>", "Upper quantile", "<? getRK ("max"); ?>", "Number of white balls", "<? getRK ("m"); ?>",  "Number of black balls", "<? getRK ("n"); ?>", "Number of balls drawn", "<? getRK ("k"); ?>", "Scaling", "<? echo ($log_label); ?>"<? echo ($tail_tag); ?>, "Function", "<? getRK ("function"); ?>"));
+
+rk.graph.on ()
+try (plot (function (x) <? getRK ("function"); ?> (x, m = <? getRK ("m"); ?>, n = <? getRK ("n"); ?>, k = <? getRK ("k"); ?>, log = <? getRK ("log"); ?><? echo ($lower_tag); ?>), from=<? echo ($min); ?>, to=<? echo ($max); ?>, n=<? echo ($max - $min + 1); ?>, type="p"))
+rk.graph.off ()
+<?
+	}
+
+	function cleanup () {
+	}
+?>

Added: trunk/rkward/rkward/plugins/distributions/plot_hypergeometric_distribution.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_hypergeometric_distribution.xml	                        (rev 0)
+++ trunk/rkward/rkward/plugins/distributions/plot_hypergeometric_distribution.xml	2007-01-29 12:39:50 UTC (rev 1231)
@@ -0,0 +1,33 @@
+<!DOCTYPE rkplugin>
+<!--This is the simple "Plot hypergeometric probabilities" plugin-->
+<document>
+	<code file="plot_hypergeometric_distribution.php" />
+	<dialog label="Plot hypergeometric probabilities" >
+		<tabbook>
+			<tab label="Plot hypergeometric probabilities" >
+				<row>
+					<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 (at most k)" />
+						</frame>
+						<frame label="Parameters">
+							<spinbox type="integer" id="m" min="0" initial="12" label="Number of white balls (m)" />
+							<spinbox type="integer" id="n" min="0" initial="12" label="Number of black balls (n)" />
+							<spinbox type="integer" id="k" min="0" initial="15" label="Number of balls drawn (k)" />
+						</frame>
+					</column>
+					<column>
+						<radio id="function" label="Choose type of function plot" >
+							<option value="dhyper" label="Plot density function" />
+							<option value="phyper" 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>
+			</tab>
+		</tabbook>
+	</dialog>
+</document>

Added: trunk/rkward/rkward/plugins/distributions/plot_negbinomial_distribution.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_negbinomial_distribution.php	                        (rev 0)
+++ trunk/rkward/rkward/plugins/distributions/plot_negbinomial_distribution.php	2007-01-29 12:39:50 UTC (rev 1231)
@@ -0,0 +1,51 @@
+<?
+	function preprocess () {
+	}
+
+	function calculate () {
+	}
+
+	function printout () {
+	$fun = getRK_val ("function");
+	if ($fun == "dnbinom") {
+		$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");
+	$size = getRK_val ("size");
+	$paramTag = "";
+	$paramVal = "";
+ 	if (getRK_val ("param") == "pprob") {
+		$paramTag = ", prob=";
+		$paramVal = getRK_val ("prob");
+		$paramLabel = "Probability of success in each trial";
+	} else {
+		$paramTag = ", mu=";
+		$paramVal = getRK_val ("mu");
+		$paramLabel = "Alternative parameter, mu";
+	}
+	if (getRK_val ("log") == "1") $log_label="logarithmic";
+	else $log_label="normal";
+
+?>rk.header ("Negative Binomial <? echo ($label); ?> function", list ("Lower quantile", "<? getRK ("min"); ?>", "Upper quantile", "<? getRK ("max"); ?>", "Target for number of successful trials", "<? echo ($size); ?>", "<? echo ($paramLabel); ?>", "<? echo ($paramVal); ?>", "Scaling", "<? echo ($log_label); ?>"<? echo ($tail_tag); ?>, "Function", "<? getRK ("function"); ?>"));
+
+rk.graph.on ()
+try (plot (function (x) <? getRK ("function"); ?> (x, size = <? getRK ("size"); ?><? echo ($paramTag); ?><? echo ($paramVal); ?>, log = <? getRK ("log"); ?><? echo ($lower_tag); ?>), from=<? echo ($min); ?>, to=<? echo ($max); ?>, n=<? echo ($max - $min + 1); ?>, type="p"))
+rk.graph.off ()
+<?
+	}
+
+	function cleanup () {
+	}
+?>

Added: trunk/rkward/rkward/plugins/distributions/plot_negbinomial_distribution.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_negbinomial_distribution.xml	                        (rev 0)
+++ trunk/rkward/rkward/plugins/distributions/plot_negbinomial_distribution.xml	2007-01-29 12:39:50 UTC (rev 1231)
@@ -0,0 +1,43 @@
+<!DOCTYPE rkplugin>
+<!--This is the simple "Plot negative binomial probabilities" plugin-->
+<document>
+	<code file="plot_negbinomial_distribution.php" />
+	<dialog label="Plot negative binomial probabilities" >
+		<tabbook>
+			<tab label="Plot negative binomial probabilities" >
+				<row>
+					<column>
+						<frame label="Range" >
+							<spinbox type="integer" min = "0" id="min" initial="12" label="Lower quantile (at least size)" />
+							<spinbox type="integer" min = "0" id="max" initial="24" label="Upper quantile" />
+						</frame>
+						<frame label="Parameters">
+							<spinbox max_precision="2" default_precision="0" type="real" id="size" min="0.01" initial="12" label="Target number of successful trials (size)" />
+							<row>
+							<column>
+							<spinbox max_precision="2" default_precision="2" type="real" id="prob" initial="0.75" min="0" max="1" label="Probability of success on each trial" />
+							<spinbox max_precision="2" default_precision="2" type="real" id="mu" initial="4" min="0.01" label="Mean (alternate parameter, mu)" />
+						</column>
+						<column>
+						<radio id="param" label="Choose the type of Parameterization" >
+							<option value="pprob" label="Success probability" />
+							<option value="pmu" label="Mean (mu)" />
+						</radio>
+						</column>
+					</row>
+						</frame>
+					</column>
+					<column>
+						<radio id="function" label="Choose type of function plot" >
+							<option value="dnbinom" label="Plot density function" />
+							<option value="pnbinom" 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>
+			</tab>
+		</tabbook>
+	</dialog>
+</document>

Modified: trunk/rkward/rkward/plugins/under_development.pluginmap
===================================================================
--- trunk/rkward/rkward/plugins/under_development.pluginmap	2007-01-27 07:13:45 UTC (rev 1230)
+++ trunk/rkward/rkward/plugins/under_development.pluginmap	2007-01-29 12:39:50 UTC (rev 1231)
@@ -10,6 +10,11 @@
 		<component type="standard" id="barplot" file="plots/barplot.xml" label="Barplot" />
 		<component type="standard" id="cor_graph" file="plots/cor_graph.xml" label="Correlation Matrix Plot" />
 		<component type="standard" id="scatterplot_matrix" file="plots/scatterplot_matrix.xml" label="Scatterplot Matrix" />
+
+		<component type="standard" id="plot_negbinomial_distribution" file="distributions/plot_negbinomial_distribution.xml" label="Plot negative binomial distribution" />
+		<component type="standard" id="plot_hypergeometric_distribution" file="distributions/plot_hypergeometric_distribution.xml" label="Plot hypergeometric distribution" />
+		<component type="standard" id="plot_geometric_distribution" file="distributions/plot_geometric_distribution.xml" label="Plot geometric distribution" />
+		<component type="standard" id="plot_gamma_distribution" file="distributions/plot_gamma_distribution.xml" label="Plot Gamma distribution" />
 	</components>
 
 	<hierarchy>
@@ -31,6 +36,24 @@
 			<entry component="scatterplot_matrix" />
 		</menu>
 		<menu id="distributions" label="Distributions" index="7">
+			<menu id="univariate_continuous_distributions" label="Univariate continuous distributions" index="1">
+				<menu id="gamma_distribution" label="Gamma Distribution" index="5">
+					<entry component="gamma_quantiles" label="Gamma quantiles" index="1"/>
+					<entry component="gamma_probabilities" label="Gamma probabilities" index="0"/>
+					<entry component="plot_gamma_distribution" label="Plot Gamma distribution" index="2"/>
+				</menu>
+			</menu>
+			<menu id="univariate_discrete_distributions" label="Univariate discrete distributions" index="2">
+				<menu id="geom_distribution" label="Geometric Distribution" index="1">
+					<entry component="plot_geometric_distribution" label="Plot geometric distribution" index="2"/>
+				</menu>
+				<menu id="hypergeometric_distribution" label="Hypergeometric Distribution" index="2">
+					<entry component="plot_hypergeometric_distribution" label="Plot hypergeometric distribution" index="2"/>
+				</menu>
+				<menu id="negative_binomial_distribution" label="Negative Binomial Distribution" index="3">
+					<entry component="plot_negbinomial_distribution" label="Plot negative binomial distribution" index="2"/>
+				</menu>
+			</menu>
 		</menu>
 	</hierarchy>
 


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