[rkward-cvs] SF.net SVN: rkward: [1877] trunk/rkward/rkward/plugins/distributions
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Mon May 7 21:05:30 UTC 2007
Revision: 1877
http://svn.sourceforge.net/rkward/?rev=1877&view=rev
Author: tfry
Date: 2007-05-07 14:05:29 -0700 (Mon, 07 May 2007)
Log Message:
-----------
Convert all the discrete distribution plots to using snippets
Modified Paths:
--------------
trunk/rkward/rkward/plugins/distributions/plot_binomial_distribution.php
trunk/rkward/rkward/plugins/distributions/plot_binomial_distribution.rkh
trunk/rkward/rkward/plugins/distributions/plot_binomial_distribution.xml
trunk/rkward/rkward/plugins/distributions/plot_dist_common.php
trunk/rkward/rkward/plugins/distributions/plot_dist_common_snippets.xml
trunk/rkward/rkward/plugins/distributions/plot_exponential_distribution.rkh
trunk/rkward/rkward/plugins/distributions/plot_geometric_distribution.php
trunk/rkward/rkward/plugins/distributions/plot_geometric_distribution.rkh
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.rkh
trunk/rkward/rkward/plugins/distributions/plot_hypergeometric_distribution.xml
trunk/rkward/rkward/plugins/distributions/plot_logistic_distribution.rkh
trunk/rkward/rkward/plugins/distributions/plot_lognormal_distribution.rkh
trunk/rkward/rkward/plugins/distributions/plot_negbinomial_distribution.php
trunk/rkward/rkward/plugins/distributions/plot_negbinomial_distribution.rkh
trunk/rkward/rkward/plugins/distributions/plot_negbinomial_distribution.xml
trunk/rkward/rkward/plugins/distributions/plot_normal_distribution.rkh
trunk/rkward/rkward/plugins/distributions/plot_poisson_distribution.php
trunk/rkward/rkward/plugins/distributions/plot_poisson_distribution.rkh
trunk/rkward/rkward/plugins/distributions/plot_poisson_distribution.xml
trunk/rkward/rkward/plugins/distributions/plot_tukey_distribution.rkh
trunk/rkward/rkward/plugins/distributions/plot_uniform_distribution.rkh
trunk/rkward/rkward/plugins/distributions/plot_weibull_distribution.rkh
trunk/rkward/rkward/plugins/distributions/plot_wilcoxon_distribution.php
trunk/rkward/rkward/plugins/distributions/plot_wilcoxon_distribution.rkh
trunk/rkward/rkward/plugins/distributions/plot_wilcoxon_distribution.xml
Modified: trunk/rkward/rkward/plugins/distributions/plot_binomial_distribution.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_binomial_distribution.php 2007-05-07 20:06:02 UTC (rev 1876)
+++ trunk/rkward/rkward/plugins/distributions/plot_binomial_distribution.php 2007-05-07 21:05:29 UTC (rev 1877)
@@ -1,57 +1,29 @@
<?
-function preprocess () {
-}
+include ("plot_dist_common.php");
-function calculate () {
-}
+function getParameters () {
+ global $options;
-function printout () {
- doPrintout (true);
-}
+ $options['size'] = getRK_val ("size");
+ $options['prob'] = getRK_val ("prob");
+ getDiscontRangeParameters();
-function preview () {
- preprocess ();
- calculate ();
- doPrintout (false);
-}
-
-function doPrintout ($final) {
-
- $fun = getRK_val ("function");
- $log_option = "";
- if ($fun == "dbinom") {
- $label = "mass";
- $lower_tag = "";
- $tail_tag = "";
- if (getRK_val ("log")) $log_option = ", log=TRUE";
+ if ($options['is_density']) {
+ $options['fun'] = "dbinom";
} else {
- $label = "distribution";
- if (getRK_val("lower") == "1") {
- $lower_tag = ", lower.tail = TRUE";
- $tail_tag = ", \"Tail\",\"Lower\"";
- } else {
- $lower_tag = ", lower.tail = FALSE";
- $tail_tag = ", \"Tail\",\"Upper\"";
- }
- if (getRK_val ("log")) $log_option = ", log.p=TRUE";
+ $options['fun'] = "pbinom";
}
- $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";
+}
- if ($final) { ?>
-rk.header ("Binomial <? echo ($label); ?> function", list ("Lower quantile", "<? echo ($min); ?>", "Upper quantile", "<? echo ($max); ?>", "Number of trials", "<? echo ($size); ?>", "Probability of success on each trial", "<? echo ($prob); ?>", "Scaling", "<? echo ($log_label); ?>"<? echo ($tail_tag); ?>, "Function", "<? echo ($fun); ?>"));
+function doHeader () {
+ global $options;
-rk.graph.on ()
-<? }
-?>
-try (curve (<? echo ($fun); ?> (x, size = <? echo ($size); ?>, prob=<? echo ($prob); ?><? echo ($log_option); ?><? echo ($lower_tag); ?>), from=<? echo ($min); ?>, to=<? echo ($max); ?>, n=<? echo ($max - $min + 1); ?><? getRK ("plotoptions.code.printout"); ?>))
+ echo ('rk.header ("Binomial ' . $options['label'] . ' function", list ("Lower quantile", "' . $options['min'] . '", "Upper quantile", "' . $options['max'] . '", "Number of trials", "' . $options['size'] . '", "Probability of success on each trial", "' . $options['prob'] . '"' . $options['log_label'] . $options['tail_label'] . ', "Function", "' . $options['fun'] . '"));' . "\n");
+}
-<? if ($final) { ?>
-rk.graph.off ()
-<? }
+function doFunCall () {
+ global $options;
+
+ echo ($options['fun'] . '(x, size=' . $options['size'] . ', prob=' . $options['prob'] . $options['log_option'] . $options['tail_option'] . ')');
}
?>
Modified: trunk/rkward/rkward/plugins/distributions/plot_binomial_distribution.rkh
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_binomial_distribution.rkh 2007-05-07 20:06:02 UTC (rev 1876)
+++ trunk/rkward/rkward/plugins/distributions/plot_binomial_distribution.rkh 2007-05-07 21:05:29 UTC (rev 1877)
@@ -1,31 +1,26 @@
<!DOCTYPE rkhelp>
<document>
+ <snippets>
+ <include file="plot_dist_common_snippets.xml"/>
+ </snippets>
+
<summary>
Density and distribution function plots for the Binomial distribution.
</summary>
- <usage>
-Choose appropriate values for the various parameters of the distribution and select the type of function. The "Submit" button will export the plot to the "Output" window. To dynamically visualise the plot check the "Preview" box.
- </usage>
+ <insert snippet="general_usage_help"/>
<settings>
- <setting id="function">
- <li> Density Function, or </li>
- <li> Distribution Function </li>
- </setting>
- <setting id="min">Smallest value at which the function is to be plotted.</setting>
- <setting id="max">Largest value at which the function is to be plotted. Since this is a discrete distribution the function will be evaluated at all the integers between the lower quantile and the upper quantile (inclusive of the end points).</setting>
+ <insert snippet="density_help"/>
+ <insert snippet="discont_range_help"/>
<setting id="size">See R reference on Binomial distribution.</setting>
<setting id="prob">See R reference on Binomial distribution.</setting>
- <setting id="log">See the description given on Plot Beta help page.</setting>
- <setting id="lower">See the description given on Plot Beta help page.</setting>
- <setting id="preview">See the description given on Plot Beta help page.</setting>
- <setting id="plotoptions">Various plotting parameter settings for the plot. See the help page of "Plot Options" for more details.</setting>
+ <insert snippet="common_options_help"/>
</settings>
+
<related>
<ul>
<li><link href="rkward://rhelp/Binomial"/></li>
- <li><link href="rkward://component/plot_beta_distribution"/></li>
<li><link href="rkward://component/plot_options"/></li>
<li><link href="rkward://rhelp/curve"/></li>
</ul>
Modified: trunk/rkward/rkward/plugins/distributions/plot_binomial_distribution.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_binomial_distribution.xml 2007-05-07 20:06:02 UTC (rev 1876)
+++ trunk/rkward/rkward/plugins/distributions/plot_binomial_distribution.xml 2007-05-07 21:05:29 UTC (rev 1877)
@@ -1,41 +1,27 @@
<!DOCTYPE rkplugin>
-<!--This is the simple "Plot binomial probabilities" plugin-->
<document>
<code file="plot_binomial_distribution.php" />
<help file="plot_binomial_distribution.rkh" />
<logic>
- <convert id="dodist" mode="equals" sources="function.string" standard="pbinom" />
- <connect client="lower.enabled" governor="dodist" />
- <set id="plotoptions.allow_log" to="false"/>
+ <insert snippet="common_logic"/>
<set id="plotoptions.default_pointtype" to="p"/>
</logic>
+ <snippets>
+ <snippet id="range_options">
+ <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>
+ </snippet>
+ <snippet id="dist_options">
+ <frame label="Parameters">
+ <spinbox type="integer" id="size" min="0" initial="12" label="Number of trials" />
+ <spinbox default_precision="2" type="real" id="prob" initial="0.5" min="0" max="1" label="Probability of success on each trial" />
+ </frame>
+ </snippet>
+ <include file="plot_dist_common_snippets.xml"/>
+ </snippets>
<dialog label="Plot binomial probabilities" >
- <tabbook>
- <tab label="Plot binomial 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 type="integer" id="size" min="0" initial="12" label="Number of trials" />
- <spinbox 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/>
- <preview id="preview" label="Preview"/>
- <embed id="plotoptions" component="rkward::plot_options" as_button="true" label="Plot Options" />
- </column>
- </row>
- </tab>
- </tabbook>
+ <include file="plot_dist_common_dialog_layout.xml"/>
</dialog>
</document>
Modified: trunk/rkward/rkward/plugins/distributions/plot_dist_common.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_dist_common.php 2007-05-07 20:06:02 UTC (rev 1876)
+++ trunk/rkward/rkward/plugins/distributions/plot_dist_common.php 2007-05-07 21:05:29 UTC (rev 1877)
@@ -24,6 +24,15 @@
$options['max'] = getRK_val ("max");
}
+// get the range parameters for the discontinuous distributions (it's all the same for these)
+function getDiscontRangeParameters () {
+ global $options;
+
+ $options['min'] = getRK_val ("min");
+ $options['max'] = getRK_val ("max");
+ $options['n'] = $options['max'] - $options['min'] + 1;
+}
+
function doPrintout ($final) {
global $options;
Modified: trunk/rkward/rkward/plugins/distributions/plot_dist_common_snippets.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_dist_common_snippets.xml 2007-05-07 20:06:02 UTC (rev 1876)
+++ trunk/rkward/rkward/plugins/distributions/plot_dist_common_snippets.xml 2007-05-07 21:05:29 UTC (rev 1877)
@@ -42,4 +42,8 @@
<setting id="min">Smallest value at which the function is to be plotted.</setting>
<setting id="max">Largest value at which the function is to be plotted. So, the function will be evaluated at 'n' equally spaced points between the lower quantile and the upper quantile (inclusive of end points).</setting>
</snippet>
+ <snippet id="discont_range_help">
+ <setting id="min">Smallest value at which the function is to be plotted.</setting>
+ <setting id="max">Largest value at which the function is to be plotted. Since this is a discrete distribution the function will be evaluated at all the integers between the lower quantile and the upper quantile (inclusive of the end points).</setting>
+ </snippet>
</document>
\ No newline at end of file
Modified: trunk/rkward/rkward/plugins/distributions/plot_exponential_distribution.rkh
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_exponential_distribution.rkh 2007-05-07 20:06:02 UTC (rev 1876)
+++ trunk/rkward/rkward/plugins/distributions/plot_exponential_distribution.rkh 2007-05-07 21:05:29 UTC (rev 1877)
@@ -14,7 +14,6 @@
<insert snippet="density_help"/>
<insert snippet="cont_range_help"/>
<setting id="rate">See R reference on Exponential distribution.</setting>
- <setting id="ncp">Non-centrality parameter of the Beta distribution.</setting>
<insert snippet="common_options_help"/>
</settings>
<related>
Modified: trunk/rkward/rkward/plugins/distributions/plot_geometric_distribution.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_geometric_distribution.php 2007-05-07 20:06:02 UTC (rev 1876)
+++ trunk/rkward/rkward/plugins/distributions/plot_geometric_distribution.php 2007-05-07 21:05:29 UTC (rev 1877)
@@ -1,56 +1,28 @@
<?
-function preprocess () {
-}
+include ("plot_dist_common.php");
-function calculate () {
-}
+function getParameters () {
+ global $options;
-function printout () {
- doPrintout (true);
-}
+ $options['prob'] = getRK_val ("prob");
+ getDiscontRangeParameters();
-function preview () {
- preprocess ();
- calculate ();
- doPrintout (false);
-}
-
-function doPrintout ($final) {
-
- $fun = getRK_val ("function");
- $log_option = "";
- if ($fun == "dgeom") {
- $label = "mass";
- $lower_tag = "";
- $tail_tag = "";
- if (getRK_val ("log")) $log_option = ", log=TRUE";
+ if ($options['is_density']) {
+ $options['fun'] = "dgeom";
} else {
- $label = "distribution";
- if (getRK_val("lower") == "1") {
- $lower_tag = ", lower.tail = TRUE";
- $tail_tag = ", \"Tail\",\"Lower\"";
- } else {
- $lower_tag = ", lower.tail = FALSE";
- $tail_tag = ", \"Tail\",\"Upper\"";
- }
- if (getRK_val ("log")) $log_option = ", log.p=TRUE";
+ $options['fun'] = "pgeom";
}
- $min = getRK_val ("min");
- $prob = getRK_val ("prob");
- $max = getRK_val ("max");
- if (getRK_val ("log") == "1") $log_label="logarithmic";
- else $log_label="normal";
+}
- if ($final) { ?>
-rk.header ("Geometric <? echo ($label); ?> function", list ("Lower quantile", "<? echo ($min); ?>", "Upper quantile", "<? echo ($max); ?>", "Probability of success on each trial", "<? echo ($prob); ?>", "Scaling", "<? echo ($log_label); ?>"<? echo ($tail_tag); ?>, "Function", "<? echo ($fun); ?>"));
+function doHeader () {
+ global $options;
-rk.graph.on ()
-<? }
-?>
-try (curve (<? echo ($fun); ?> (x, prob=<? echo ($prob); ?><? echo ($log_option) ?><? echo ($lower_tag); ?>), from=<? echo ($min); ?>, to=<? echo ($max); ?>, n=<? echo ($max - $min + 1); ?><? getRK ("plotoptions.code.printout"); ?>))
+ echo ('rk.header ("Geometric ' . $options['label'] . ' function", list ("Lower quantile", "' . $options['min'] . '", "Upper quantile", "' . $options['max'] . '", "Probability of success on each trial", "' . $options['prob'] . '"' . $options['log_label'] . $options['tail_label'] . ', "Function", "' . $options['fun'] . '"));' . "\n");
+}
-<? if ($final) { ?>
-rk.graph.off ()
-<? }
+function doFunCall () {
+ global $options;
+
+ echo ($options['fun'] . '(x, prob=' . $options['prob'] . $options['log_option'] . $options['tail_option'] . ')');
}
?>
Modified: trunk/rkward/rkward/plugins/distributions/plot_geometric_distribution.rkh
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_geometric_distribution.rkh 2007-05-07 20:06:02 UTC (rev 1876)
+++ trunk/rkward/rkward/plugins/distributions/plot_geometric_distribution.rkh 2007-05-07 21:05:29 UTC (rev 1877)
@@ -1,30 +1,25 @@
<!DOCTYPE rkhelp>
<document>
+ <snippets>
+ <include file="plot_dist_common_snippets.xml"/>
+ </snippets>
+
<summary>
Density and distribution function plots for the Geometric distribution.
</summary>
- <usage>
-Choose appropriate values for the various parameters of the distribution and select the type of function. The "Submit" button will export the plot to the "Output" window. To dynamically visualise the plot check the "Preview" box.
- </usage>
+ <insert snippet="general_usage_help"/>
<settings>
- <setting id="function">
- <li> Density Function, or </li>
- <li> Distribution Function </li>
- </setting>
- <setting id="min">Smallest value at which the function is to be plotted.</setting>
- <setting id="max">Largest value at which the function is to be plotted. Since this is a discrete distribution the function will be evaluated at all the integers between the lower quantile and the upper quantile (inclusive of the end points).</setting>
+ <insert snippet="density_help"/>
+ <insert snippet="discont_range_help"/>
<setting id="prob">See R reference on Geometric distribution.</setting>
- <setting id="log">See the description given on Plot Beta distribution help page.</setting>
- <setting id="lower">See the description given on Plot Beta distribution help page.</setting>
- <setting id="preview">See the description given on Plot Beta distribution help page.</setting>
- <setting id="plotoptions">Various plotting parameter settings for the plot. See the help page of "Plot Options" for more details.</setting>
+ <insert snippet="common_options_help"/>
</settings>
+
<related>
<ul>
<li><link href="rkward://rhelp/Geometric"/></li>
- <li><link href="rkward://component/plot_beta_distribution"/></li>
<li><link href="rkward://component/plot_options"/></li>
<li><link href="rkward://rhelp/curve"/></li>
</ul>
Modified: trunk/rkward/rkward/plugins/distributions/plot_geometric_distribution.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_geometric_distribution.xml 2007-05-07 20:06:02 UTC (rev 1876)
+++ trunk/rkward/rkward/plugins/distributions/plot_geometric_distribution.xml 2007-05-07 21:05:29 UTC (rev 1877)
@@ -1,40 +1,26 @@
<!DOCTYPE rkplugin>
-<!--This is the simple "Plot geometric probabilities" plugin-->
<document>
<code file="plot_geometric_distribution.php" />
<help file="plot_geometric_distribution.rkh" />
<logic>
- <convert id="dodist" mode="equals" sources="function.string" standard="pgeom" />
- <connect client="lower.enabled" governor="dodist" />
- <set id="plotoptions.allow_log" to="false"/>
+ <insert snippet="common_logic"/>
<set id="plotoptions.default_pointtype" to="p"/>
</logic>
+ <snippets>
+ <snippet id="range_options">
+ <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>
+ </snippet>
+ <snippet id="dist_options">
+ <frame label="Parameters">
+ <spinbox default_precision="2" type="real" id="prob" initial="0.5" min="0" max="1" label="Probability of success on each trial" />
+ </frame>
+ </snippet>
+ <include file="plot_dist_common_snippets.xml"/>
+ </snippets>
<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 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/>
- <preview id="preview" label="Preview"/>
- <embed id="plotoptions" component="rkward::plot_options" as_button="true" label="Plot Options" />
- </column>
- </row>
- </tab>
- </tabbook>
+ <include file="plot_dist_common_dialog_layout.xml"/>
</dialog>
</document>
Modified: trunk/rkward/rkward/plugins/distributions/plot_hypergeometric_distribution.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_hypergeometric_distribution.php 2007-05-07 20:06:02 UTC (rev 1876)
+++ trunk/rkward/rkward/plugins/distributions/plot_hypergeometric_distribution.php 2007-05-07 21:05:29 UTC (rev 1877)
@@ -1,58 +1,30 @@
<?
-function preprocess () {
-}
+include ("plot_dist_common.php");
-function calculate () {
-}
+function getParameters () {
+ global $options;
-function printout () {
- doPrintout (true);
-}
+ $options['n_val'] = getRK_val ("n_val");
+ $options['m'] = getRK_val ("m");
+ $options['k'] = getRK_val ("k");
+ getDiscontRangeParameters();
-function preview () {
- preprocess ();
- calculate ();
- doPrintout (false);
-}
-
-function doPrintout ($final) {
-
- $fun = getRK_val ("function");
- $log_option = "";
- if ($fun == "dhyper") {
- $label = "mass";
- $lower_tag = "";
- $tail_tag = "";
- if (getRK_val ("log")) $log_option = ", log=TRUE";
+ if ($options['is_density']) {
+ $options['fun'] = "dhyper";
} else {
- $label = "distribution";
- if (getRK_val("lower") == "1") {
- $lower_tag = ", lower.tail = TRUE";
- $tail_tag = ", \"Tail\",\"Lower\"";
- } else {
- $lower_tag = ", lower.tail = FALSE";
- $tail_tag = ", \"Tail\",\"Upper\"";
- }
- if (getRK_val ("log")) $log_option = ", log.p=TRUE";
+ $options['fun'] = "phyper";
}
- $min = getRK_val ("min");
- $max = getRK_val ("max");
- if (getRK_val ("log") == "1") $log_label="logarithmic";
- else $log_label="normal";
- $n = getRK_val ("n");
- $m = getRK_val ("m");
- $k = getRK_val ("k");
+}
- if ($final) { ?>
-rk.header ("Hypergeometric <? echo ($label); ?> function", list ("Lower quantile", "<? echo ($min); ?>", "Upper quantile", "<? echo ($max); ?>", "Number of white balls", "<? echo ($m); ?>", "Number of black balls", "<? echo ($n); ?>", "Number of balls drawn", "<? echo ($k); ?>", "Scaling", "<? echo ($log_label); ?>"<? echo ($tail_tag); ?>, "Function", "<? echo ($fun); ?>"));
+function doHeader () {
+ global $options;
-rk.graph.on ()
-<? }
-?>
-try (curve (<? echo ($fun); ?> (x, m = <? echo ($m); ?>, n = <? echo ($n); ?>, k = <? echo ($k); ?><? echo ($log_option) ?><? echo ($lower_tag); ?>), from=<? echo ($min); ?>, to=<? echo ($max); ?>, n=<? echo ($max - $min + 1); ?><? getRK ("plotoptions.code.printout"); ?><? echo ($type_tag); ?>))
+ echo ('rk.header ("Hypergeometric ' . $options['label'] . ' function", list ("Lower quantile", "' . $options['min'] . '", "Upper quantile", "' . $options['max'] . '", "Number of white balls", "' . $options['m'] . '", "Number of black balls", "' . $options['n_val'] . '", "Number of balls drawn", "' . $options['k'] . '"' . $options['log_label'] . $options['tail_label'] . ', "Function", "' . $options['fun'] . '"));' . "\n");
+}
-<? if ($final) { ?>
-rk.graph.off ()
-<? }
+function doFunCall () {
+ global $options;
+
+ echo ($options['fun'] . '(x, m=' . $options['m'] . ', n=' . $options['n_val'] . ', k=' . $options['k'] . $options['log_option'] . $options['tail_option'] . ')');
}
?>
Modified: trunk/rkward/rkward/plugins/distributions/plot_hypergeometric_distribution.rkh
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_hypergeometric_distribution.rkh 2007-05-07 20:06:02 UTC (rev 1876)
+++ trunk/rkward/rkward/plugins/distributions/plot_hypergeometric_distribution.rkh 2007-05-07 21:05:29 UTC (rev 1877)
@@ -1,32 +1,27 @@
<!DOCTYPE rkhelp>
<document>
+ <snippets>
+ <include file="plot_dist_common_snippets.xml"/>
+ </snippets>
+
<summary>
Density and distribution function plots for the Hypergeometric distribution.
</summary>
- <usage>
-Choose appropriate values for the various parameters of the distribution and select the type of function. The "Submit" button will export the plot to the "Output" window. To dynamically visualise the plot check the "Preview" box.
- </usage>
+ <insert snippet="general_usage_help"/>
<settings>
- <setting id="function">
- <li> Density Function, or </li>
- <li> Distribution Function </li>
- </setting>
- <setting id="min">Smallest value at which the function is to be plotted.</setting>
- <setting id="max">Largest value at which the function is to be plotted. Since this is a discrete distribution the function will be evaluated at all the integers between the lower quantile and the upper quantile (inclusive of the end points).</setting>
+ <insert snippet="density_help"/>
+ <insert snippet="discont_range_help"/>
<setting id="m">See R reference on Hypergeometric distribution.</setting>
- <setting id="n">See R reference on Hypergeometric distribution.</setting>
+ <setting id="n_val">See R reference on Hypergeometric distribution.</setting>
<setting id="k">See R reference on Hypergeometric distribution.</setting>
- <setting id="log">See the description given on Plot Beta distribution help page.</setting>
- <setting id="lower">See the description given on Plot Beta distribution help page.</setting>
- <setting id="preview">See the description given on Plot Beta distribution help page.</setting>
- <setting id="plotoptions">Various plotting parameter settings for the plot. See the help page of "Plot Options" for more details.</setting>
+ <insert snippet="common_options_help"/>
</settings>
+
<related>
<ul>
<li><link href="rkward://rhelp/Hypergeometric"/></li>
- <li><link href="rkward://component/plot_beta_distribution"/></li>
<li><link href="rkward://component/plot_options"/></li>
<li><link href="rkward://rhelp/curve"/></li>
</ul>
Modified: trunk/rkward/rkward/plugins/distributions/plot_hypergeometric_distribution.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_hypergeometric_distribution.xml 2007-05-07 20:06:02 UTC (rev 1876)
+++ trunk/rkward/rkward/plugins/distributions/plot_hypergeometric_distribution.xml 2007-05-07 21:05:29 UTC (rev 1877)
@@ -1,42 +1,28 @@
<!DOCTYPE rkplugin>
-<!--This is the simple "Plot hypergeometric probabilities" plugin-->
<document>
<code file="plot_hypergeometric_distribution.php" />
<help file="plot_hypergeometric_distribution.rkh" />
<logic>
- <convert id="dodist" mode="equals" sources="function.string" standard="phyper" />
- <connect client="lower.enabled" governor="dodist" />
- <set id="plotoptions.allow_log" to="false"/>
+ <insert snippet="common_logic"/>
<set id="plotoptions.default_pointtype" to="p"/>
</logic>
+ <snippets>
+ <snippet id="range_options">
+ <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>
+ </snippet>
+ <snippet id="dist_options">
+ <frame label="Parameters">
+ <spinbox type="integer" id="m" min="0" initial="12" label="Number of white balls (m)" />
+ <spinbox type="integer" id="n_val" 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>
+ </snippet>
+ <include file="plot_dist_common_snippets.xml"/>
+ </snippets>
<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/>
- <preview id="preview" label="Preview"/>
- <embed id="plotoptions" component="rkward::plot_options" as_button="true" label="Plot Options" />
- </column>
- </row>
- </tab>
- </tabbook>
+ <include file="plot_dist_common_dialog_layout.xml"/>
</dialog>
</document>
Modified: trunk/rkward/rkward/plugins/distributions/plot_logistic_distribution.rkh
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_logistic_distribution.rkh 2007-05-07 20:06:02 UTC (rev 1876)
+++ trunk/rkward/rkward/plugins/distributions/plot_logistic_distribution.rkh 2007-05-07 21:05:29 UTC (rev 1877)
@@ -15,7 +15,6 @@
<insert snippet="cont_range_help"/>
<setting id="loc">See R reference on Logistic distribution.</setting>
<setting id="scale">See R reference on Logistic distribution.</setting>
- <setting id="ncp">Non-centrality parameter of the Beta distribution.</setting>
<insert snippet="common_options_help"/>
</settings>
Modified: trunk/rkward/rkward/plugins/distributions/plot_lognormal_distribution.rkh
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_lognormal_distribution.rkh 2007-05-07 20:06:02 UTC (rev 1876)
+++ trunk/rkward/rkward/plugins/distributions/plot_lognormal_distribution.rkh 2007-05-07 21:05:29 UTC (rev 1877)
@@ -15,7 +15,6 @@
<insert snippet="cont_range_help"/>
<setting id="mean">See R reference on Lognormal distribution.</setting>
<setting id="sd">See R reference on Lognormal distribution.</setting>
- <setting id="ncp">Non-centrality parameter of the Beta distribution.</setting>
<insert snippet="common_options_help"/>
</settings>
Modified: trunk/rkward/rkward/plugins/distributions/plot_negbinomial_distribution.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_negbinomial_distribution.php 2007-05-07 20:06:02 UTC (rev 1876)
+++ trunk/rkward/rkward/plugins/distributions/plot_negbinomial_distribution.php 2007-05-07 21:05:29 UTC (rev 1877)
@@ -1,68 +1,47 @@
<?
-function preprocess () {
-}
+include ("plot_dist_common.php");
-function calculate () {
-}
+function getParameters () {
+ global $options;
-function printout () {
- doPrintout (true);
-}
-
-function preview () {
- preprocess ();
- calculate ();
- doPrintout (false);
-}
-
-function doPrintout ($final) {
-
- $fun = getRK_val ("function");
- $log_option = "";
- if ($fun == "dnbinom") {
- $label = "mass";
- $lower_tag = "";
- $tail_tag = "";
- if (getRK_val ("log")) $log_option = ", log=TRUE";
- } else {
- $label = "distribution";
- if (getRK_val("lower") == "1") {
- $lower_tag = ", lower.tail = TRUE";
- $tail_tag = ", \"Tail\",\"Lower\"";
- } else {
- $lower_tag = ", lower.tail = FALSE";
- $tail_tag = ", \"Tail\",\"Upper\"";
- }
- if (getRK_val ("log")) $log_option = ", log.p=TRUE";
- }
- $min = getRK_val ("min");
- $max = getRK_val ("max");
- $paramTag = "";
- $paramVal = "";
if (getRK_val ("param") == "pprob") {
$size = getRK_val ("size_trial");
+ $size_label = "Target for number of successful trials";
$paramTag = ", prob=";
$paramVal = getRK_val ("prob");
$paramLabel = "Probability of success in each trial";
} else {
$size = getRK_val ("size_disp");
+ $size_label = "Dispersion (size)";
$paramTag = ", mu=";
$paramVal = getRK_val ("mu");
$paramLabel = "Alternative parameter, mu";
}
- if (getRK_val ("log") == "1") $log_label="logarithmic";
- else $log_label="normal";
- if ($final) { ?>
-rk.header ("Negative Binomial <? echo ($label); ?> function", list ("Lower quantile", "<? echo ($min); ?>", "Upper quantile", "<? echo ($max); ?>", "Target for number of successful trials", "<? echo ($size); ?>", "<? echo ($paramLabel); ?>", "<? echo ($paramVal); ?>", "Scaling", "<? echo ($log_label); ?>"<? echo ($tail_tag); ?>, "Function", "<? echo ($fun); ?>"));
+ $options['size'] = $size;
+ $options['size_label'] = $size_label;
+ $options['param_tag'] = $paramTag;
+ $options['param_val'] = $paramVal;
+ $options['param_label'] = $paramLabel;
+ $options['prob'] = getRK_val ("prob");
+ getDiscontRangeParameters();
-rk.graph.on ()
-<? }
-?>
-try (curve (<? echo ($fun); ?> (x, size = <? echo ($size); ?><? echo ($paramTag); ?><? echo ($paramVal); ?><? echo ($log_option) ?><? echo ($lower_tag); ?>), from=<? echo ($min); ?>, to=<? echo ($max); ?>, n=<? echo ($max - $min + 1); ?><? getRK ("plotoptions.code.printout"); ?>))
+ if ($options['is_density']) {
+ $options['fun'] = "dnbinom";
+ } else {
+ $options['fun'] = "pnbinom";
+ }
+}
-<? if ($final) { ?>
-rk.graph.off ()
-<? }
+function doHeader () {
+ global $options;
+
+ echo ('rk.header ("Negative Binomial ' . $options['label'] . ' function", list ("Lower quantile", "' . $options['min'] . '", "Upper quantile", "' . $options['max'] . '", "' . $options['size_label'] . '", "' . $options['size'] . '", "' . $options['param_label'] . '", "' . $options['param_val'] . '"' . $options['log_label'] . $options['tail_label'] . ', "Function", "' . $options['fun'] . '"));' . "\n");
}
+
+function doFunCall () {
+ global $options;
+
+ echo ($options['fun'] . '(x, size=' . $options['size'] . $options['param_tag'] . $options['param_val'] . $options['log_option'] . $options['tail_option'] . ')');
+}
?>
Modified: trunk/rkward/rkward/plugins/distributions/plot_negbinomial_distribution.rkh
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_negbinomial_distribution.rkh 2007-05-07 20:06:02 UTC (rev 1876)
+++ trunk/rkward/rkward/plugins/distributions/plot_negbinomial_distribution.rkh 2007-05-07 21:05:29 UTC (rev 1877)
@@ -1,34 +1,29 @@
<!DOCTYPE rkhelp>
<document>
+ <snippets>
+ <include file="plot_dist_common_snippets.xml"/>
+ </snippets>
+
<summary>
Density and distribution function plots for the Negative Binomial distribution.
</summary>
- <usage>
-Choose appropriate values for the various parameters of the distribution and select the type of function. The "Submit" button will export the plot to the "Output" window. To dynamically visualise the plot check the "Preview" box.
- </usage>
+ <insert snippet="general_usage_help"/>
<settings>
- <setting id="function">
- <li> Density Function, or </li>
- <li> Distribution Function </li>
- </setting>
- <setting id="min">Smallest value at which the function is to be plotted.</setting>
- <setting id="max">Largest value at which the function is to be plotted. Since this is a discrete distribution the function will be evaluated at all the integers between the lower quantile and the upper quantile (inclusive of the end points).</setting>
+ <insert snippet="density_help"/>
+ <insert snippet="discont_range_help"/>
<setting id="size_trial">This is the <i>size</i> parameter when the 'probability' form of the parameterisation is used. This is always a non-negative integer. See R reference on Negative Binomial distribution.</setting>
<setting id="size_disp">This is the <i>size</i> parameter when the 'mu' form of the parameterisation is used. This is a non-negative real number. See R reference on Negative Binomial distribution.</setting>
<setting id="prob">See R reference on Negative Binomial distribution.</setting>
<setting id="mu">See R reference on Negative Binomial distribution.</setting>
<setting id="param">The type of the parameterization to be used. See R reference on Negative Binomial distribution.</setting>
- <setting id="log">See the description given on Plot Beta distribution help page.</setting>
- <setting id="lower">See the description given on Plot Beta distribution help page.</setting>
- <setting id="preview">See the description given on Plot Beta distribution help page.</setting>
- <setting id="plotoptions">Various plotting parameter settings for the plot. See the help page of "Plot Options" for more details.</setting>
+ <insert snippet="common_options_help"/>
</settings>
+
<related>
<ul>
<li><link href="rkward://rhelp/NegBinomial"/></li>
- <li><link href="rkward://component/plot_beta_distribution"/></li>
<li><link href="rkward://component/plot_options"/></li>
<li><link href="rkward://rhelp/curve"/></li>
</ul>
Modified: trunk/rkward/rkward/plugins/distributions/plot_negbinomial_distribution.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_negbinomial_distribution.xml 2007-05-07 20:06:02 UTC (rev 1876)
+++ trunk/rkward/rkward/plugins/distributions/plot_negbinomial_distribution.xml 2007-05-07 21:05:29 UTC (rev 1877)
@@ -1,59 +1,45 @@
<!DOCTYPE rkplugin>
-<!--This is the simple "Plot negative binomial probabilities" plugin-->
<document>
<code file="plot_negbinomial_distribution.php" />
<help file="plot_negbinomial_distribution.rkh" />
<logic>
- <convert id="dodist" mode="equals" sources="function.string" standard="pnbinom" />
- <connect client="lower.enabled" governor="dodist" />
+ <insert snippet="common_logic"/>
+ <set id="plotoptions.default_pointtype" to="p"/>
+
<convert id="useprob" mode="equals" sources="param.string" standard="pprob" />
<connect client="prob.enabled" governor="useprob" />
<connect client="size_trial.visible" governor="useprob" />
- <convert id="usemu" mode="equals" sources="param.string" standard="pmu" />
- <connect client="mu.enabled" governor="usemu" />
- <connect client="size_disp.visible" governor="usemu" />
- <set id="plotoptions.allow_log" to="false"/>
- <set id="plotoptions.default_pointtype" to="p"/>
+ <connect client="mu.enabled" governor="useprob.not" />
+ <connect client="size_disp.visible" governor="useprob.not" />
</logic>
- <dialog label="Plot negative binomial probabilities" >
- <tabbook>
- <tab label="Plot negative binomial probabilities" >
+ <snippets>
+ <snippet id="range_options">
+ <frame label="Range" >
+ <spinbox type="integer" min = "0" id="min" initial="0" label="Lower quantile" />
+ <spinbox type="integer" min = "0" id="max" initial="24" label="Upper quantile" />
+ </frame>
+ </snippet>
+ <snippet id="dist_options">
+ <frame label="Parameters">
+ <spinbox type="integer" id="size_trial" min="1" initial="12" label="Target number of successful trials" />
+ <spinbox id="size_disp" min="0.01" initial="12.00" label="Dispersion (Size)"/>
<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="24" label="Upper quantile" />
- </frame>
- <frame label="Parameters">
- <spinbox type="integer" id="size_trial" min="1" initial="12" label="Target number of successful trials" />
- <spinbox id="size_disp" min="0.01" initial="12.00" label="Dispersion (Size)"/>
- <row>
- <column>
- <spinbox default_precision="2" type="real" id="prob" initial="0.75" min="0" max="1" label="Probability of success on each trial" />
- <spinbox default_precision="2" type="real" id="mu" initial="4" min="0.01" label="Mean (alternate parameter, mu)" />
- </column>
- <column>
+ <spinbox default_precision="2" type="real" id="prob" initial="0.75" min="0" max="1" label="Probability of success on each trial" />
+ <spinbox default_precision="2" type="real" id="mu" initial="4" min="0.01" label="Mean (alternate parameter, mu)" />
+ </column>
+ <column>
<radio id="param" label="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/>
- <preview id="preview" label="Preview"/>
- <embed id="plotoptions" component="rkward::plot_options" as_button="true" label="Plot Options" />
- </column>
</row>
- </tab>
- </tabbook>
+ </frame>
+ </snippet>
+ <include file="plot_dist_common_snippets.xml"/>
+ </snippets>
+ <dialog label="Plot negative binomial probabilities" >
+ <include file="plot_dist_common_dialog_layout.xml"/>
</dialog>
</document>
Modified: trunk/rkward/rkward/plugins/distributions/plot_normal_distribution.rkh
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_normal_distribution.rkh 2007-05-07 20:06:02 UTC (rev 1876)
+++ trunk/rkward/rkward/plugins/distributions/plot_normal_distribution.rkh 2007-05-07 21:05:29 UTC (rev 1877)
@@ -15,7 +15,6 @@
<insert snippet="cont_range_help"/>
<setting id="mean">See R reference on Normal distribution.</setting>
<setting id="sd">See R reference on Normal distribution.</setting>
- <setting id="ncp">Non-centrality parameter of the Beta distribution.</setting>
<insert snippet="common_options_help"/>
</settings>
Modified: trunk/rkward/rkward/plugins/distributions/plot_poisson_distribution.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_poisson_distribution.php 2007-05-07 20:06:02 UTC (rev 1876)
+++ trunk/rkward/rkward/plugins/distributions/plot_poisson_distribution.php 2007-05-07 21:05:29 UTC (rev 1877)
@@ -1,56 +1,28 @@
<?
-function preprocess () {
-}
+include ("plot_dist_common.php");
-function calculate () {
-}
+function getParameters () {
+ global $options;
-function printout () {
- doPrintout (true);
-}
+ $options['mean'] = getRK_val ("mean");
+ getDiscontRangeParameters();
-function preview () {
- preprocess ();
- calculate ();
- doPrintout (false);
-}
-
-function doPrintout ($final) {
-
- $fun = getRK_val ("function");
- $log_option = "";
- if ($fun == "dpois") {
- $label = "mass";
- $lower_tag = "";
- $tail_tag = "";
- if (getRK_val ("log")) $log_option = ", log=TRUE";
+ if ($options['is_density']) {
+ $options['fun'] = "dpois";
} else {
- $label = "distribution";
- if (getRK_val("lower") == "1") {
- $lower_tag = ", lower.tail = TRUE";
- $tail_tag = ", \"Tail\",\"Lower\"";
- } else {
- $lower_tag = ", lower.tail = FALSE";
- $tail_tag = ", \"Tail\",\"Upper\"";
- }
- if (getRK_val ("log")) $log_option = ", log.p=TRUE";
+ $options['fun'] = "ppois";
}
- $min = getRK_val ("min");
- $max = getRK_val ("max");
- if (getRK_val ("log") == "1") $log_label="logarithmic";
- else $log_label="normal";
- $mean = getRK_val ("mean");
+}
- if ($final) { ?>
-rk.header ("Poisson <? echo ($label); ?> function", list ("Lower quantile", "<? echo ($min); ?>", "Upper quantile", "<? echo ($max); ?>", "Mean", "<? echo ($mean); ?>", "Scaling", "<? echo ($log_label); ?>"<? echo ($tail_tag); ?>, "Function", "<? echo ($fun); ?>"));
+function doHeader () {
+ global $options;
-rk.graph.on ()
-<? }
-?>
-try (curve (<? echo ($fun); ?> (x, lambda = <? echo ($mean); ?><? echo ($log_option) ?><? echo ($lower_tag); ?>), from=<? echo ($min); ?>, to=<? echo ($max); ?>, n=<? echo ($max - $min + 1); ?><? getRK ("plotoptions.code.printout"); ?>))
+ echo ('rk.header ("Poisson ' . $options['label'] . ' function", list ("Lower quantile", "' . $options['min'] . '", "Upper quantile", "' . $options['max'] . '", "Mean", "' . $options['mean'] . '"' . $options['log_label'] . $options['tail_label'] . ', "Function", "' . $options['fun'] . '"));' . "\n");
+}
-<? if ($final) { ?>
-rk.graph.off ()
-<? }
+function doFunCall () {
+ global $options;
+
+ echo ($options['fun'] . '(x, lambda=' . $options['mean'] . $options['log_option'] . $options['tail_option'] . ')');
}
?>
Modified: trunk/rkward/rkward/plugins/distributions/plot_poisson_distribution.rkh
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_poisson_distribution.rkh 2007-05-07 20:06:02 UTC (rev 1876)
+++ trunk/rkward/rkward/plugins/distributions/plot_poisson_distribution.rkh 2007-05-07 21:05:29 UTC (rev 1877)
@@ -1,30 +1,25 @@
<!DOCTYPE rkhelp>
<document>
+ <snippets>
+ <include file="plot_dist_common_snippets.xml"/>
+ </snippets>
+
<summary>
Density and distribution function plots for the Poisson distribution.
</summary>
- <usage>
-Choose appropriate values for the various parameters of the distribution and select the type of function. The "Submit" button will export the plot to the "Output" window. To dynamically visualise the plot check the "Preview" box.
- </usage>
+ <insert snippet="general_usage_help"/>
<settings>
- <setting id="function">
- <li> Density Function, or </li>
- <li> Distribution Function </li>
- </setting>
- <setting id="min">Smallest value at which the function is to be plotted.</setting>
- <setting id="max">Largest value at which the function is to be plotted. Since this is a discrete distribution the function will be evaluated at all the integers between the lower quantile and the upper quantile (inclusive of the end points).</setting>
+ <insert snippet="density_help"/>
+ <insert snippet="discont_range_help"/>
<setting id="mean">See R reference on Poisson distribution.</setting>
- <setting id="log">See the description given on Plot Beta distribution help page.</setting>
- <setting id="lower">See the description given on Plot Beta distribution help page.</setting>
- <setting id="preview">See the description given on Plot Beta distribution help page.</setting>
- <setting id="plotoptions">Various plotting parameter settings for the plot. See the help page of "Plot Options" for more details.</setting>
+ <insert snippet="common_options_help"/>
</settings>
+
<related>
<ul>
<li><link href="rkward://rhelp/Poisson"/></li>
- <li><link href="rkward://component/plot_beta_distribution"/></li>
<li><link href="rkward://component/plot_options"/></li>
<li><link href="rkward://rhelp/curve"/></li>
</ul>
Modified: trunk/rkward/rkward/plugins/distributions/plot_poisson_distribution.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_poisson_distribution.xml 2007-05-07 20:06:02 UTC (rev 1876)
+++ trunk/rkward/rkward/plugins/distributions/plot_poisson_distribution.xml 2007-05-07 21:05:29 UTC (rev 1877)
@@ -1,43 +1,26 @@
<!DOCTYPE rkplugin>
-<!--This is the simple "Plot Poisson probabilities" plugin--><document>
+<document>
<code file="plot_poisson_distribution.php" />
<help file="plot_poisson_distribution.rkh" />
<logic>
- <convert id="dodist" mode="equals" sources="function.string" standard="ppois" />
- <connect client="lower.enabled" governor="dodist" />
- <set id="plotoptions.allow_log" to="false"/>
+ <insert snippet="common_logic"/>
<set id="plotoptions.default_pointtype" to="p"/>
</logic>
+ <snippets>
+ <snippet id="range_options">
+ <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>
+ </snippet>
+ <snippet id="dist_options">
+ <frame label="Paramters" >
+ <spinbox type="real" id="mean" min="0" initial="5" label="Mean" />
+ </frame>
+ </snippet>
+ <include file="plot_dist_common_snippets.xml"/>
+ </snippets>
<dialog label="Plot Poisson probabilities" >
- <tabbook>
- <tab label="Plot Poisson probabilities" >
- <row>
- <column>
- <row>
- <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>
- </row>
- <row>
- <frame label="Paramters" >
- <spinbox type="real" id="mean" min="0" initial="5" label="Mean" />
- </frame>
- </row>
- </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/>
- <preview id="preview" label="Preview"/>
- <embed id="plotoptions" component="rkward::plot_options" as_button="true" label="Plot Options" />
- </column>
- </row>
- </tab>
- </tabbook>
+ <include file="plot_dist_common_dialog_layout.xml"/>
</dialog>
</document>
Modified: trunk/rkward/rkward/plugins/distributions/plot_tukey_distribution.rkh
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_tukey_distribution.rkh 2007-05-07 20:06:02 UTC (rev 1876)
+++ trunk/rkward/rkward/plugins/distributions/plot_tukey_distribution.rkh 2007-05-07 21:05:29 UTC (rev 1877)
@@ -16,7 +16,6 @@
<setting id="nmeans">See R reference on Tukey distribution.</setting>
<setting id="df">See R reference on Tukey distribution.</setting>
<setting id="nranges">See R reference on Tukey distribution.</setting>
- <setting id="ncp">Non-centrality parameter of the Beta distribution.</setting>
<insert snippet="common_options_help"/>
</settings>
Modified: trunk/rkward/rkward/plugins/distributions/plot_uniform_distribution.rkh
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_uniform_distribution.rkh 2007-05-07 20:06:02 UTC (rev 1876)
+++ trunk/rkward/rkward/plugins/distributions/plot_uniform_distribution.rkh 2007-05-07 21:05:29 UTC (rev 1877)
@@ -15,7 +15,6 @@
<insert snippet="cont_range_help"/>
<setting id="llim">See R reference on Uniform distribution.</setting>
<setting id="ulim">See R reference on Uniform distribution.</setting>
- <setting id="ncp">Non-centrality parameter of the Beta distribution.</setting>
<insert snippet="common_options_help"/>
</settings>
Modified: trunk/rkward/rkward/plugins/distributions/plot_weibull_distribution.rkh
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_weibull_distribution.rkh 2007-05-07 20:06:02 UTC (rev 1876)
+++ trunk/rkward/rkward/plugins/distributions/plot_weibull_distribution.rkh 2007-05-07 21:05:29 UTC (rev 1877)
@@ -15,7 +15,6 @@
<insert snippet="cont_range_help"/>
<setting id="shape">See R reference on Weibull distribution.</setting>
<setting id="scale">See R reference on Weibull distribution.</setting>
- <setting id="ncp">Non-centrality parameter of the Beta distribution.</setting>
<insert snippet="common_options_help"/>
</settings>
Modified: trunk/rkward/rkward/plugins/distributions/plot_wilcoxon_distribution.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_wilcoxon_distribution.php 2007-05-07 20:06:02 UTC (rev 1876)
+++ trunk/rkward/rkward/plugins/distributions/plot_wilcoxon_distribution.php 2007-05-07 21:05:29 UTC (rev 1877)
@@ -1,58 +1,29 @@
<?
-function preprocess () {
-}
+include ("plot_dist_common.php");
-function calculate () {
-}
+function getParameters () {
+ global $options;
-function printout () {
- doPrintout (true);
-}
+ $options['nm'] = getRK_val ("nm");
+ $options['nn'] = getRK_val ("nn");
+ getDiscontRangeParameters();
-function preview () {
- preprocess ();
- calculate ();
- doPrintout (false);
-}
-
-function doPrintout ($final) {
-
- $fun = getRK_val ("function");
- $log_option = "";
- if ($fun == "dwilcox") {
- $label = "density";
- $lower_tag = "";
- $tail_tag = "";
- if (getRK_val ("log")) $log_option = ", log=TRUE";
+ if ($options['is_density']) {
+ $options['fun'] = "dwilcox";
} else {
- $label = "distribution";
- if (getRK_val("lower") == "1") {
- $lower_tag = ", lower.tail = TRUE";
- $tail_tag = ", \"Tail\",\"Lower\"";
- } else {
- $lower_tag = ", lower.tail = FALSE";
- $tail_tag = ", \"Tail\",\"Upper\"";
- }
- if (getRK_val ("log")) $log_option = ", log.p=TRUE";
+ $options['fun'] = "pwilcox";
}
- $min = getRK_val ("min");
- $max = getRK_val ("max");
- $nm = getRK_val ("nm");
- $nn = getRK_val ("nn");
- $n = $max - $min + 1;
- if (getRK_val ("log") == "1") $log_label="logarithmic";
- else $log_label="normal";
+}
- if ($final) { ?>
-rk.header ("Wilcoxon <? echo ($label); ?> function", list ("Lower quantile", "<? echo ($min); ?>","Upper quantile", "<? echo ($max); ?>", "First sample size", "<? echo ($nm); ?>", "Second sample size", "<? echo ($nn); ?>", "Scaling", "<? echo ($log_label); ?>"<? echo ($tail_tag); ?>, "Function", "<? echo ($fun); ?>"));
+function doHeader () {
+ global $options;
-rk.graph.on ()
-<? }
-?>
-try (curve (<? echo ($fun); ?> (x, m = <? echo ($nm); ?>, n = <? echo ($nn); ?><? echo ($log_option) ?><? echo ($lower_tag); ?>), from=<? echo ($min); ?>, to=<? echo ($max); ?>, n=<? echo ($n); ?><? getRK ("plotoptions.code.printout"); ?>))
+ echo ('rk.header ("Binomial ' . $options['label'] . ' function", list ("Lower quantile", "' . $options['min'] . '", "Upper quantile", "' . $options['max'] . '", "First sample size", "' . $options['nm'] . '", "Second sample size", "' . $options['nn'] . '"' . $options['log_label'] . $options['tail_label'] . ', "Function", "' . $options['fun'] . '"));' . "\n");
+}
-<? if ($final) { ?>
-rk.graph.off ()
-<? }
+function doFunCall () {
+ global $options;
+
+ echo ($options['fun'] . '(x, m=' . $options['nm'] . ', n=' . $options['nn'] . $options['log_option'] . $options['tail_option'] . ')');
}
?>
Modified: trunk/rkward/rkward/plugins/distributions/plot_wilcoxon_distribution.rkh
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_wilcoxon_distribution.rkh 2007-05-07 20:06:02 UTC (rev 1876)
+++ trunk/rkward/rkward/plugins/distributions/plot_wilcoxon_distribution.rkh 2007-05-07 21:05:29 UTC (rev 1877)
@@ -1,31 +1,26 @@
<!DOCTYPE rkhelp>
<document>
+ <snippets>
+ <include file="plot_dist_common_snippets.xml"/>
+ </snippets>
+
<summary>
Density and distribution function plots for the Wilcoxon distribution.
</summary>
- <usage>
-Choose appropriate values for the various parameters of the distribution and select the type of function. The "Submit" button will export the plot to the "Output" window. To dynamically visualise the plot check the "Preview" box.
- </usage>
+ <insert snippet="general_usage_help"/>
<settings>
- <setting id="function">
- <li> Density Function, or </li>
- <li> Distribution Function </li>
- </setting>
- <setting id="min">Smallest value at which the function is to be plotted.</setting>
- <setting id="max">Largest value at which the function is to be plotted. Since this is a discrete distribution the function will be evaluated at all the integers between the lower quantile and the upper quantile (inclusive of the end points).</setting>
+ <insert snippet="density_help"/>
+ <insert snippet="discont_range_help"/>
<setting id="nm">See R reference on Wilcoxon distribution.</setting>
<setting id="nn">See R reference on Wilcoxon distribution.</setting>
- <setting id="log">See the description given on Plot Beta distribution help page.</setting>
- <setting id="lower">See the description given on Plot Beta distribution help page.</setting>
- <setting id="preview">See the description given on Plot Beta distribution help page.</setting>
- <setting id="plotoptions">Various plotting parameter settings for the plot. See the help page of "Plot Options" for more details.</setting>
+ <insert snippet="common_options_help"/>
</settings>
+
<related>
<ul>
<li><link href="rkward://rhelp/Wilcoxon"/></li>
- <li><link href="rkward://component/plot_beta_distribution"/></li>
<li><link href="rkward://component/plot_options"/></li>
<li><link href="rkward://rhelp/curve"/></li>
</ul>
Modified: trunk/rkward/rkward/plugins/distributions/plot_wilcoxon_distribution.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_wilcoxon_distribution.xml 2007-05-07 20:06:02 UTC (rev 1876)
+++ trunk/rkward/rkward/plugins/distributions/plot_wilcoxon_distribution.xml 2007-05-07 21:05:29 UTC (rev 1877)
@@ -1,44 +1,27 @@
<!DOCTYPE rkplugin>
-<!--This is the simple "Plot wilcoxon probabilities" plugin--><document>
+<document>
<code file="plot_wilcoxon_distribution.php" />
<help file="plot_wilcoxon_distribution.rkh" />
<logic>
- <convert id="dodist" mode="equals" sources="function.string" standard="pwilcox" />
- <connect client="lower.enabled" governor="dodist" />
- <set id="plotoptions.allow_log" to="false"/>
+ <insert snippet="common_logic"/>
<set id="plotoptions.default_pointtype" to="p"/>
</logic>
+ <snippets>
+ <snippet id="range_options">
+ <frame label="Range" >
+ <spinbox type="integer" id="min" initial="0" min = "0" label="Lower quantile" />
+ <spinbox type="integer" id="max" initial="24" min="0" label="Upper quantile (at most m*n)" />
+ </frame>
+ </snippet>
+ <snippet id="dist_options">
+ <frame label="Parameters">
+ <spinbox type="integer" id="nm" min="1" initial="4" label="Number of Observations in first sample (m)" />
+ <spinbox type="integer" id="nn" min="1" initial="6" label="Number of Observations in second sample (n)" />
+ </frame>
+ </snippet>
+ <include file="plot_dist_common_snippets.xml"/>
+ </snippets>
<dialog label="Plot Wilcoxon Rank Sum statistic probabilities" >
- <tabbook>
- <tab label="Plot Wilcoxon Rank Sum statistic probabilities" >
- <row>
- <column>
- <row>
- <frame label="Range" >
- <spinbox type="integer" id="min" initial="0" min = "0" label="Lower quantile" />
- <spinbox type="integer" id="max" initial="24" min="0" label="Upper quantile (atmost m*n)" />
- </frame>
- </row>
- <row>
- <frame label="Parameters">
- <spinbox type="integer" id="nm" min="1" initial="4" label="Number of Observations in first sample (m)" />
- <spinbox type="integer" id="nn" min="1" initial="6" label="Number of Observations in second sample (n)" />
- </frame>
- </row>
- </column>
- <column>
- <radio id="function" label="Choose type of function plot" >
- <option value="dwilcox" label="Plot density function" />
- <option value="pwilcox" 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/>
- <preview id="preview" label="Preview"/>
- <embed id="plotoptions" component="rkward::plot_options" as_button="true" label="Plot Options" />
- </column>
- </row>
- </tab>
- </tabbook>
+ <include file="plot_dist_common_dialog_layout.xml"/>
</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