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

kapatp at users.sourceforge.net kapatp at users.sourceforge.net
Fri Mar 2 07:39:44 UTC 2007


Revision: 1526
          http://svn.sourceforge.net/rkward/?rev=1526&view=rev
Author:   kapatp
Date:     2007-03-01 23:39:43 -0800 (Thu, 01 Mar 2007)

Log Message:
-----------

* Created and new directory distributions/clt for the clt plugins
* Moved the binomial_clt plugins to new directory
*  and  are now evaluated only when  is true
* added some comments to binomial_clt php code
* Some re-indentation to the code too
*  and  are out of rk.graph.on/off brace
* try statement around all plot related function

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/Makefile.am
    trunk/rkward/rkward/plugins/under_development.pluginmap

Added Paths:
-----------
    trunk/rkward/rkward/plugins/distributions/clt/
    trunk/rkward/rkward/plugins/distributions/clt/plot_binomial_clt.php
    trunk/rkward/rkward/plugins/distributions/clt/plot_binomial_clt.rkh
    trunk/rkward/rkward/plugins/distributions/clt/plot_binomial_clt.xml

Removed Paths:
-------------
    trunk/rkward/rkward/plugins/distributions/plot_binomial_clt.php
    trunk/rkward/rkward/plugins/distributions/plot_binomial_clt.rkh
    trunk/rkward/rkward/plugins/distributions/plot_binomial_clt.xml

Modified: trunk/rkward/rkward/plugins/Makefile.am
===================================================================
--- trunk/rkward/rkward/plugins/Makefile.am	2007-03-02 00:19:21 UTC (rev 1525)
+++ trunk/rkward/rkward/plugins/Makefile.am	2007-03-02 07:39:43 UTC (rev 1526)
@@ -30,15 +30,6 @@
 	analysis/ansari_bradley/ansari_bradley_test.xml \
 	analysis/ansari_bradley/ansari_bradley_test.rkh
 
-pluginsXanalysisXTESTSdir = $(kde_datadir)/rkward/analysis/TESTS
-dist_pluginsXanalysisXTESTS_DATA = \
-	analysis/TESTS/mood_test.xml \
-	analysis/TESTS/mood_test.php \
-	analysis/TESTS/mood_test.rkh \
-	analysis/TESTS/PP_test.xml \
-	analysis/TESTS/PP_test.php \
-	analysis/TESTS/PP_test.rkh
-
 pluginsXanalysisXwilcoxondir = $(kde_datadir)/rkward/analysis/wilcoxon
 dist_pluginsXanalysisXwilcoxon_DATA = \
 	analysis/wilcoxon/wilcoxon_test.xml \
@@ -67,30 +58,39 @@
 
 pluginsXanalysisXoutliersdir = $(kde_datadir)/rkward/analysis/outliers
 dist_pluginsXanalysisXoutliers_DATA = \
+	analysis/outliers/dixon_test.xml \
+	analysis/outliers/chisq_out_test.rkh \
+	analysis/outliers/grubbs_test.xml \
+	analysis/outliers/outlier.xml \
 	analysis/outliers/chisq_out_test.php \
-	analysis/outliers/chisq_out_test.xml \
-	analysis/outliers/chisq_out_test.rkh \
+	analysis/outliers/dixon_test.rkh \
 	analysis/outliers/dixon_test.php \
-	analysis/outliers/dixon_test.xml \
-	analysis/outliers/dixon_test.rkh \
+	analysis/outliers/grubbs_test.rkh \
+	analysis/outliers/outlier.rkh \
 	analysis/outliers/grubbs_test.php \
-	analysis/outliers/grubbs_test.xml \
-	analysis/outliers/grubbs_test.rkh \
 	analysis/outliers/outlier.php \
-	analysis/outliers/outlier.xml \
-	analysis/outliers/outlier.rkh
+	analysis/outliers/chisq_out_test.xml
 
+pluginsXanalysisXTESTSdir = $(kde_datadir)/rkward/analysis/TESTS
+dist_pluginsXanalysisXTESTS_DATA = \
+	analysis/TESTS/mood_test.rkh \
+	analysis/TESTS/PP_test.rkh \
+	analysis/TESTS/mood_test.php \
+	analysis/TESTS/PP_test.php \
+	analysis/TESTS/mood_test.xml \
+	analysis/TESTS/PP_test.xml
+
 pluginsXanalysisXvariancesdir = $(kde_datadir)/rkward/analysis/variances
 dist_pluginsXanalysisXvariances_DATA = \
-	analysis/variances/bartlett_test.php \
 	analysis/variances/bartlett_test.xml \
+	analysis/variances/F_test.xml \
 	analysis/variances/bartlett_test.rkh \
+	analysis/variances/fligner_test.xml \
+	analysis/variances/bartlett_test.php \
+	analysis/variances/F_test.rkh \
+	analysis/variances/fligner_test.rkh \
 	analysis/variances/F_test.php \
-	analysis/variances/F_test.xml \
-	analysis/variances/F_test.rkh \
-	analysis/variances/fligner_test.php \
-	analysis/variances/fligner_test.xml \
-	analysis/variances/fligner_test.rkh
+	analysis/variances/fligner_test.php
 
 pluginsXx11devicedir = $(kde_datadir)/rkward/x11device
 dist_pluginsXx11device_DATA = \
@@ -99,7 +99,10 @@
 	x11device/export.php \
 	x11device/export_new.php \
 	x11device/export_new.rkh \
-	x11device/export_new.xml
+	x11device/export_new.xml \
+	x11device/grid.xml \
+	x11device/grid.php \
+	x11device/grid.rkh
 
 pluginsX00saveloaddir = $(kde_datadir)/rkward/00saveload
 dist_pluginsX00saveload_DATA = \
@@ -178,9 +181,13 @@
 	plots/histogram_options.php \
 	plots/pareto.xml \
 	plots/pareto.rkh \
+	plots/histogram_options.rkh \
+	plots/stem.rkh \
 	plots/stem.xml \
 	plots/stem.php \
-	plots/stem.rkh
+	plots/plot_stepfun_options.rkh \
+	plots/plot_stepfun_options.php \
+	plots/plot_stepfun_options.xml
 
 pluginsXdistributionsdir = $(kde_datadir)/rkward/distributions
 dist_pluginsXdistributions_DATA = \
@@ -332,11 +339,14 @@
 	distributions/t_probabilities.php \
 	distributions/sf_test.xml \
 	distributions/plot_poisson_distribution.rkh \
-	distributions/plot_uniform_distribution.xml \
-	distributions/plot_binomial_clt.xml \
-	distributions/plot_binomial_clt.php \
-	distributions/plot_binomial_clt.rkh
+	distributions/plot_uniform_distribution.xml
 
+pluginsXdistributionsXcltdir = $(kde_datadir)/rkward/distributions/clt
+dist_pluginsXdistributionsXclt_DATA = \
+	distributions/clt/plot_binomial_clt.php \
+	distributions/clt/plot_binomial_clt.rkh \
+	distributions/clt/plot_binomial_clt.xml
+
 pluginsXwritetabledir = $(kde_datadir)/rkward/writetable
 dist_pluginsXwritetable_DATA = \
 	writetable/code.php \

Added: trunk/rkward/rkward/plugins/distributions/clt/plot_binomial_clt.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/clt/plot_binomial_clt.php	                        (rev 0)
+++ trunk/rkward/rkward/plugins/distributions/clt/plot_binomial_clt.php	2007-03-02 07:39:43 UTC (rev 1526)
@@ -0,0 +1,141 @@
+<?php
+	function preprocess () {
+	}
+
+	function calculate () {
+	}
+
+	function printout () {
+	doPrintout (true);
+  }
+
+  function cleanup () {
+?>
+rm(rk.temp.cltdistrib)
+<?
+	}
+
+function preview () {
+	preprocess ();
+	calculate ();
+	doPrintout (false);
+	cleanup ();
+}
+
+function doPrintout ($final) {
+	$fun = getRK_val ("function");
+	$size = getRK_val ("size");
+	$prob = getRK_val ("prob");
+	$nAvg = getRK_val ("nAvg"); // number of observations to calculate the averages
+	$nDist = getRK_val ("nDist"); // number of sample to construct the distribution
+
+	$scalenorm = getRK_val ("scalenorm"); // if variables should to normalised..
+	$drawnorm = getRK_val ("drawnorm");
+
+	$distExp = $size*$prob; // mean of the distribution of sample averages
+	$distVar = $size*$prob*(1-$prob)/$nAvg; // variance of the distribution of sample averages
+
+	if ($scalenorm) {
+	 $normMu = 0; // mean for normal
+	 $normSigma = 1; // std dev for normal
+	} else {
+	 $normMu = $distExp;
+	 $normSigma = sqrt($distVar);
+	}
+
+	$plotoptions = getRK_val("plotoptions.code.printout");
+	if ($fun == "hist") {
+		$normFun = "dnorm"; // draw normal density on the histogram
+		$histcalcoptions = getRK_val ("histogram_opt.code.calculate"); // options that goes into hist() function
+		$histplotoptions = getRK_val ("histogram_opt.code.printout"); // options that goes into plot.histogram()
+		$histplotoptions .= $plotoptions; // generic plot options
+	} elseif ($fun == "dist") {
+		$ecdfoptions = "";
+		$col_y0 = getRK_val ("col_y0.code.printout");
+		$col_y1 = getRK_val ("col_y1.code.printout");
+		if (($col_y0 != "") && ($col_y1 != "")) {
+			$ecdfoptions .= ", col.01line=c({$col_y0},{$col_y1})";
+		} elseif (($col_y0 != "") || ($col_y1 != "")) {
+			$ecdfoptions .= ", col.01line={$col_y0}{$col_y1}";
+		} // col.01line option to plot.ecdf()
+
+		$addRugtoplot = getRK_val ("addRugtoplot");
+		if ($addRugtoplot) {
+			$rugoptions  = ', ticksize=' . round(getRK_val ("rug_ticksize"),2);
+			$rugoptions .= ', lwd=' . round(getRK_val ("rug_lwd"),2);
+			$rugoptions .= ', side=' . getRK_val ("rug_side");
+			$rugoptions .= getRK_val ("col_rug.code.printout");
+		}
+
+		$normFun = "pnorm"; // draw normal cdf on the ecdf plot
+		$plotoptions .= $ecdfoptions . getRK_val ("dist_stepfun.code.printout"); // plot.ecdf() and plot.stepfun() options
+	}
+
+	$yLim = ""; // initialise the ylim option
+?>
+rk.temp.cltdistrib <- list()
+# generate the entire data:
+rk.temp.cltdistrib$data <- matrix(rbinom(n=<? echo ($nAvg*$nDist); ?>, size = <? echo ($size); ?>, prob=<? echo ($prob); ?>), nrow=<? echo ($nAvg); ?>);
+# get the sample averages:
+rk.temp.cltdistrib$avg <- colMeans(rk.temp.cltdistrib$data);
+<?
+	if ($scalenorm) {
+?>
+# mean for the sample averages:
+rk.temp.cltdistrib$mean <- <? echo ($distExp); ?>;
+# variance for the sample averages:
+rk.temp.cltdistrib$var <- <? echo ($distVar); ?>;
+# normalise the variables:
+rk.temp.cltdistrib$avg <- (rk.temp.cltdistrib$avg - rk.temp.cltdistrib$mean)/sqrt(rk.temp.cltdistrib$var);
+<?
+	}
+	if ($drawnorm) {
+?>
+# generate random normal samples:
+rk.temp.cltdistrib$normX <- seq(from=min(rk.temp.cltdistrib$avg), to=max(rk.temp.cltdistrib$avg), length=<? echo ($nDist); ?>);
+rk.temp.cltdistrib$normY <- <? echo ($normFun); ?> (rk.temp.cltdistrib$normX, mean = <? echo ($normMu); ?>, sd = <? echo ($normSigma); ?>);
+<?
+	}
+  if ($fun == "hist") {
+?>
+rk.temp.cltdistrib$hist <- hist(rk.temp.cltdistrib$avg, plot=FALSE<? echo ($histcalcoptions); ?>);
+<?
+	if ($drawnorm) {
+?>
+# calculate the ylims appropriately:
+rk.temp.cltdistrib$ylim <- c(0,max(c(rk.temp.cltdistrib$hist$density, rk.temp.cltdistrib$normY)));
+<?
+		$yLim = ', ylim=rk.temp.cltdistrib$ylim';
+		}
+	}
+	if ($final) {
+?>
+rk.graph.on ()
+<?
+	}
+  if ($fun == "hist") {
+?>
+try( plot(rk.temp.cltdistrib$hist<? echo ($yLim); echo ($histplotoptions); ?>) );
+<?
+	} elseif ($fun == "dist") {
+?>
+try( plot(ecdf(rk.temp.cltdistrib$avg)<? echo ($plotoptions); ?>) );
+<?
+		if ($addRugtoplot) {
+?>
+try (rug (rk.temp.cltdistrib$avg<? echo ($rugoptions); ?>));
+<?
+		}
+	}
+	if ($drawnorm) {
+?>
+try (lines (x=rk.temp.cltdistrib$normX, y=rk.temp.cltdistrib$normY, type="<? getRK ("normpointtype"); ?>"<? getRK ("normlinecol.code.printout"); ?>));
+<?
+	}
+	if ($final) {
+?>
+rk.graph.off ()
+<?
+	}
+}
+?>

Added: trunk/rkward/rkward/plugins/distributions/clt/plot_binomial_clt.rkh
===================================================================
--- trunk/rkward/rkward/plugins/distributions/clt/plot_binomial_clt.rkh	                        (rev 0)
+++ trunk/rkward/rkward/plugins/distributions/clt/plot_binomial_clt.rkh	2007-03-02 07:39:43 UTC (rev 1526)
@@ -0,0 +1,42 @@
+<!DOCTYPE rkhelp>
+<document>
+	<summary>
+		Normal approximation to Binomial Sample averages. Most of this help file is generic description of CLT plugins. Sample averages from a contending distribution (Binomial here) are compared to a target Normal distributoin. The comparision is made based on either histograms or distribution functions or quatile-quantile plots. For brevity, D will denote the contending distribution (Binomial here).
+	</summary>
+	<usage>
+		Choose the Binomial parameters, the sample sizes needed for CLT and a choice of function. The function specific options are provided in different tabs.
+	</usage>
+	<settings>
+		<caption id="tab_plot_distrib_clt"/>
+		<setting id="frame_binomparam">See RkWard help on 'Plot Binomial distribution'.</setting>
+		<setting id="nAvg">These many samples (nAvg) are used to calculate sample average. For a fixed value of the parameters, one would be interested in seeing how the distribution of the sample averages change as this number increases.</setting>
+		<setting id="nDist">These many sets-of-samples (nDist) are used to get some idea about the distribution of the sample averages. Each set provides an average. Then these averages are used to construct the 'Histogram' or the 'QQplot' or the 'Distribution function'.</setting>
+		<setting id="function">Choose one of 'Histogram', 'QQplot' or 'Distribution function' to compare the distribution of the sample averages of D with that of Normal distribution. As of now, only 'Histogram' has been implemented.</setting>
+		<setting id="scalenorm">Should the sample averages be normalised, by subtracting the mean, E(D), of D and dividing by the standard deviation, S(D)/sqrt(nAvg), where S(D) is the standard deviation of D? If done so, then the target Normal distribution is taken to be the standard one, that is, with mean 0 and variance 1. Otherwise the target distribution is Normal with the mean E(D) and standard deviation S(D)/sqrt(nAvg).</setting>
+		<setting id="drawnorm">Should a Normal curve be drawn? For the case of 'Histogram', nDist random samples are drawn from the target Normal distribution and their density values are plotted.</setting>
+		<setting id="normpointtype">Pointtype for the Normal curve.</setting>
+		<setting id="normlinecol">Color of the Normal curve, defaults to 'red'.</setting>
+		<setting id="plotoptions">Various plot options.</setting>
+		<setting id="preview">Preview button.</setting>
+		<caption id="tab_histoptions"/>
+		<setting id="histogram_opt">The 'Frequency' checkbox is unavailable because, in this situation, drawing the histogram with <i>freq=TRUE</i> doesnot make sense. Also, since histogram is the main plot, 'Add to current plot' checkbox has also been disabled. See RkWard help on <link href="rkward://component/histogram_options"/> for other histogram centric details.</setting>
+		<caption id="tab_distfunction"/>
+		<setting id="dist_stepfun" label="Stepfunction options">See the help on step-function options plugin. The 'Add to current plot' option is unavailable.</setting>
+		<setting id="frame_col_y0"></setting>
+		<setting id="frame_col_y1"> The above two options are used to set the color for the horizontal lines at y = 0 and y = 1 respectively. Specifically, this is the <i>col.01line</i> argument to <b>ecdf</b>. If only the one is provided (i.e the other is set as 'Default') then both the line are of the specified color. Otherwise (i.e., when both the colors are provided) both the colors are provided as a character vector.</setting>
+		<caption id="frame_rug"/>
+		<setting id="addRugtoplot"> Check this option to add a <b>rug</b> to the current plot. See the R reference on 'rug' for more detials. All the available options, namely, 'Side of Rug', 'Tick size', Tick width' and 'Color' are self evident.</setting>
+	</settings>
+	<related>
+		<ul>
+			<li><link href="rkward://rhelp/Binomial"/></li>
+			<li><link href="rkward://component/plot_beta_distribution"/></li>
+			<li><link href="rkward://rhelp/Normal"/></li>
+			<li><link href="rkward://rhelp/hist"/></li>
+			<li><link href="rkward://rhelp/rect"/></li>
+			<li><link href="rkward://component/plot_stepfun_options"/></li>
+			<li><link href="rkward://rhelp/rug"/></li>
+		</ul>
+	</related>
+</document>
+

Added: trunk/rkward/rkward/plugins/distributions/clt/plot_binomial_clt.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/clt/plot_binomial_clt.xml	                        (rev 0)
+++ trunk/rkward/rkward/plugins/distributions/clt/plot_binomial_clt.xml	2007-03-02 07:39:43 UTC (rev 1526)
@@ -0,0 +1,117 @@
+<!DOCTYPE rkplugin>
+<document>
+	<code file="plot_binomial_clt.php" />
+	<help file="plot_binomial_clt.rkh" />
+	<logic>
+		<set id="plotoptions.allow_log" to="false"/>
+		<set id="plotoptions.allow_type" to="false"/>
+		<set id="plotoptions.main.text" to="Binomial"/>
+		<set id="plotoptions.xlab.text" to="Sample Averages"/>
+
+		<set id="normlinecol.default_color" to="red" />
+
+		<set id="histogram_opt.varname" to="rk.temp.cltdistrib$avg" />
+		<set id="histogram_opt.allow_freq" to="false" />
+		<set id="histogram_opt.allow_barlabels" to="true" />
+		<set id="histogram_opt.allow_addtoplot" to="false" />
+
+		<convert id="isHistogram" sources="function.string" mode="equals" standard="hist"/>
+		<connect client="tab_histoptions.enabled" governor="isHistogram"/>
+
+		<convert id="isDist" sources="function.string" mode="equals" standard="dist"/>
+		<connect client="tab_distfunction.enabled" governor="isDist"/>
+
+		<connect client="normpointtype.enabled" governor="drawnorm.state"/>
+		<connect client="normlinecol.color.enabled" governor="drawnorm.state"/>
+
+		<set id="dist_stepfun.allow_addtoplot" to="false" />
+		<set id="dist_stepfun.default_verticals" to="false" />
+
+		<connect client="rug_side.enabled" governor="addRugtoplot.state" />
+		<connect client="rug_ticksize.enabled" governor="addRugtoplot.state"/>
+		<connect client="rug_lwd.enabled" governor="addRugtoplot.state"/>
+		<connect client="col_rug.color.enabled" governor="addRugtoplot.state"/>
+
+		<set id="col_y0.argument" to=""/>
+		<set id="col_y1.argument" to=""/>
+</logic>
+	<dialog label="Central Limit Theorem: Binomial to Normal" >
+		<tabbook>
+			<tab id="tab_plot_distrib_clt" label="Parameters" >
+				<row>
+					<column>
+						<frame label="CLT Samples" >
+							<spinbox type="integer" min = "1" id="nAvg" initial="10" label="Samples for Average" />
+							<spinbox type="integer" min = "10" id="nDist" initial="1000" label="Samples for distribution" />
+						</frame>
+						<frame id="frame_binomparam" label="Binomial Parameters">
+							<spinbox type="integer" id="size" min="1" 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="hist" label="Histogram and Density" />
+							<option value="dist" label="ECDF and Distribution" checked="true"/>
+						</radio>
+						<checkbox id="scalenorm" label="Use normalised random variable" value="1" value_unchecked="0"/>
+						<frame id="frame_lineoptions" label="Nomral Curve Options">
+							<checkbox id="drawnorm" label="Draw normal curve" value="1" value_unchecked="0" checked="true"/>
+							<dropdown id="normpointtype" label="Type of points/lines" >
+								<option value="p" label="Individual points " />
+								<option value="l" label="Lines" checked="true"/>
+								<option value="b" label="Points connected by lines (both)" />
+								<option value="o" label="Points overlaid by lines " />
+								<option value="h" label="Vertical lines (high-density)" />
+								<option value="s" label="Step-function on left edge" />
+								<option value="S" label="Step-function on right edge" />
+							</dropdown>
+							<embed id="normlinecol" component="rkward::color_chooser" label="Color" />
+						</frame>
+					</column>
+				</row>
+			<stretch/>
+				<row>
+					<embed id="plotoptions" component="rkward::plot_options" as_button="true" label="Plot Options" />
+					<preview id="preview" label="Preview"/>
+				</row>
+			</tab>
+
+			<tab id="tab_histoptions" label="Histogram">
+				<embed id="histogram_opt" component="rkward::histogram_options" label="Histogram Options"/>
+			</tab>
+
+			<tab id="tab_distfunction" label="ECDF options">
+				<embed id="dist_stepfun" component="rkward::plot_stepfun_options" label=""/>
+				<row>
+					<frame id="frame_rug" label="Rug options">
+						<row>
+							<column>
+								<checkbox id="addRugtoplot" label="Add Rug" />
+								<radio id="rug_side" label="Side of Rug">
+									<option value="1" label="Bottom" />
+									<option value="3" label="Top" />
+								</radio>
+							</column>
+							<column>
+								<spinbox id="rug_ticksize" min="0" initial="0.03" label="Tick size"/>
+								<spinbox id="rug_lwd" min="0" initial="0.5" label="Tick width" />
+								<embed id="col_rug" component="rkward::color_chooser" label="Color"/>
+							</column>
+						</row>
+					</frame>
+					<column>
+						<frame id="frame_col_y0" label="For y = 0 line">
+							<embed id="col_y0" component="rkward::color_chooser" label="Color"/>
+						</frame>
+						<frame id="frame_col_y1" label="For y = 1 line">
+							<embed id="col_y1" component="rkward::color_chooser" label="Color"/>
+						</frame>
+					</column>
+				</row>
+				<stretch/>
+			</tab>
+
+		</tabbook>
+	</dialog>
+</document>

Deleted: trunk/rkward/rkward/plugins/distributions/plot_binomial_clt.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_binomial_clt.php	2007-03-02 00:19:21 UTC (rev 1525)
+++ trunk/rkward/rkward/plugins/distributions/plot_binomial_clt.php	2007-03-02 07:39:43 UTC (rev 1526)
@@ -1,109 +0,0 @@
-<?php
-	function preprocess () {
-	}
-
-	function calculate () {
-	}
-
-	function printout () {
-	doPrintout (true);
-  }
-
-  function cleanup () {
-?>
-rm(rk.temp.cltdistrib)
-<?
-  }
-
-function preview () {
-	preprocess ();
-	calculate ();
-	doPrintout (false);
-	cleanup ();
-}
-
-function doPrintout ($final) {
-	$fun = getRK_val ("function");
-	$size = getRK_val ("size");
-	$prob = getRK_val ("prob");
-	$nAvg = getRK_val ("nAvg");
-	$nDist = getRK_val ("nDist");
-
-	$scalenorm = getRK_val ("scalenorm");
-	$drawnorm = getRK_val ("drawnorm");
-
-	$distExp = $size*$prob;
-	$distVar = $size*$prob*(1-$prob)/$nAvg;
-
-	if ($scalenorm) {
-	 $normMu = 0;
-	 $normSigma = 1;
-	} else {
-	 $normMu = $distExp;
-	 $normSigma = sqrt($distVar);
-	}
-
-	$plotoptions = getRK_val("plotoptions.code.printout");
-	if ($fun == "hist") {
-		$normFun = "dnorm";
-		$histcalcoptions = getRK_val ("histogram_opt.code.calculate");
-		$histplotoptions = getRK_val ("histogram_opt.code.printout");
-		$histplotoptions .= $plotoptions;
-	} elseif ($fun == "dist") {
-		$ecdfoptions = "";
-		$col_y0 = getRK_val ("col_y0.code.printout");
-		$col_y1 = getRK_val ("col_y1.code.printout");
-		if (($col_y0 != "") && ($col_y1 != "")) {
-			$ecdfoptions .= ", col.01line=c({$col_y0},{$col_y1})";
-		} elseif (($col_y0 != "") || ($col_y1 != "")) {
-			$ecdfoptions .= ", col.01line={$col_y0}{$col_y1}";
-		}
-
-		$addRugtoplot = getRK_val ("addRugtoplot");
-		if ($addRugtoplot) {
-			$rugoptions  = ', ticksize=' . round(getRK_val ("rug_ticksize"),2);
-			$rugoptions .= ', lwd=' . round(getRK_val ("rug_lwd"),2);
-			$rugoptions .= ', side=' . getRK_val ("rug_side");
-			$rugoptions .= getRK_val ("col_rug.code.printout");
-		}
-
-		$normFun = "pnorm";
-		$plotoptions .= $ecdfoptions . getRK_val ("dist_stepfun.code.printout");
-	}
-
-	$yLim = "";
-?>
-rk.temp.cltdistrib <- list()
-rk.temp.cltdistrib$data <- matrix(rbinom(n=<? echo ($nAvg*$nDist); ?>, size = <? echo ($size); ?>, prob=<? echo ($prob); ?>), nrow=<? echo ($nAvg); ?>);
-rk.temp.cltdistrib$avg <- colMeans(rk.temp.cltdistrib$data);
-rk.temp.cltdistrib$mean <- <? echo ($distExp); ?>;
-rk.temp.cltdistrib$var <- <? echo ($distVar); ?>;
-<? if ($scalenorm) { ?>
-rk.temp.cltdistrib$avg <- (rk.temp.cltdistrib$avg - rk.temp.cltdistrib$mean)/sqrt(rk.temp.cltdistrib$var);
-<? }
- if ($drawnorm) { ?>
-rk.temp.cltdistrib$normX <- seq(from=min(rk.temp.cltdistrib$avg), to=max(rk.temp.cltdistrib$avg), length=<? echo ($nDist); ?>);
-rk.temp.cltdistrib$normY <- <? echo ($normFun); ?> (rk.temp.cltdistrib$normX, mean = <? echo ($normMu); ?>, sd = <? echo ($normSigma); ?>);
-<? }
-	if ($final) { ?>
-rk.graph.on ()
-<? }
-  if ($fun == "hist") {
-?>
-rk.temp.cltdistrib$hist <- hist(rk.temp.cltdistrib$avg, plot=FALSE<? echo ($histcalcoptions); ?>);
-<? if ($drawnorm) { ?>
-rk.temp.cltdistrib$ylim <- c(0,max(c(rk.temp.cltdistrib$hist$density, rk.temp.cltdistrib$normY)));
-<? $yLim = ', ylim=rk.temp.cltdistrib$ylim'; } ?>
-try( plot(rk.temp.cltdistrib$hist<? echo ($yLim); echo ($histplotoptions); ?>) );
-<?  } elseif ($fun == "dist") {?>
-try( plot(ecdf(rk.temp.cltdistrib$avg)<? echo ($plotoptions); ?>) );
-<?	if ($addRugtoplot) { ?>	rug (rk.temp.cltdistrib$avg<? echo ($rugoptions); ?>)
-<? } }
- if ($drawnorm) { ?>
-  try (lines (x=rk.temp.cltdistrib$normX, y=rk.temp.cltdistrib$normY, type="<? getRK ("normpointtype"); ?>"<? getRK ("normlinecol.code.printout"); ?>));
-<? }
-	if ($final) { ?>
-rk.graph.off ()
-<? }
-}
-?>

Deleted: trunk/rkward/rkward/plugins/distributions/plot_binomial_clt.rkh
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_binomial_clt.rkh	2007-03-02 00:19:21 UTC (rev 1525)
+++ trunk/rkward/rkward/plugins/distributions/plot_binomial_clt.rkh	2007-03-02 07:39:43 UTC (rev 1526)
@@ -1,42 +0,0 @@
-<!DOCTYPE rkhelp>
-<document>
-	<summary>
-		Normal approximation to Binomial Sample averages. Most of this help file is generic description of CLT plugins. Sample averages from a contending distribution (Binomial here) are compared to a target Normal distributoin. The comparision is made based on either histograms or distribution functions or quatile-quantile plots. For brevity, D will denote the contending distribution (Binomial here).
-	</summary>
-	<usage>
-		Choose the Binomial parameters, the sample sizes needed for CLT and a choice of function. The function specific options are provided in different tabs.
-	</usage>
-	<settings>
-		<caption id="tab_plot_distrib_clt"/>
-		<setting id="frame_binomparam">See RkWard help on 'Plot Binomial distribution'.</setting>
-		<setting id="nAvg">These many samples (nAvg) are used to calculate sample average. For a fixed value of the parameters, one would be interested in seeing how the distribution of the sample averages change as this number increases.</setting>
-		<setting id="nDist">These many sets-of-samples (nDist) are used to get some idea about the distribution of the sample averages. Each set provides an average. Then these averages are used to construct the 'Histogram' or the 'QQplot' or the 'Distribution function'.</setting>
-		<setting id="function">Choose one of 'Histogram', 'QQplot' or 'Distribution function' to compare the distribution of the sample averages of D with that of Normal distribution. As of now, only 'Histogram' has been implemented.</setting>
-		<setting id="scalenorm">Should the sample averages be normalised, by subtracting the mean, E(D), of D and dividing by the standard deviation, S(D)/sqrt(nAvg), where S(D) is the standard deviation of D? If done so, then the target Normal distribution is taken to be the standard one, that is, with mean 0 and variance 1. Otherwise the target distribution is Normal with the mean E(D) and standard deviation S(D)/sqrt(nAvg).</setting>
-		<setting id="drawnorm">Should a Normal curve be drawn? For the case of 'Histogram', nDist random samples are drawn from the target Normal distribution and their density values are plotted.</setting>
-		<setting id="normpointtype">Pointtype for the Normal curve.</setting>
-		<setting id="normlinecol">Color of the Normal curve, defaults to 'red'.</setting>
-		<setting id="plotoptions">Various plot options.</setting>
-		<setting id="preview">Preview button.</setting>
-		<caption id="tab_histoptions"/>
-		<setting id="histogram_opt">The 'Frequency' checkbox is unavailable because, in this situation, drawing the histogram with <i>freq=TRUE</i> doesnot make sense. Also, since histogram is the main plot, 'Add to current plot' checkbox has also been disabled. See RkWard help on <link href="rkward://component/histogram_options"/> for other histogram centric details.</setting>
-		<caption id="tab_distfunction"/>
-		<setting id="dist_stepfun" label="Stepfunction options">See the help on step-function options plugin. The 'Add to current plot' option is unavailable.</setting>
-		<setting id="frame_col_y0"></setting>
-		<setting id="frame_col_y1"> The above two options are used to set the color for the horizontal lines at y = 0 and y = 1 respectively. Specifically, this is the <i>col.01line</i> argument to <b>ecdf</b>. If only the one is provided (i.e the other is set as 'Default') then both the line are of the specified color. Otherwise (i.e., when both the colors are provided) both the colors are provided as a character vector.</setting>
-		<caption id="frame_rug"/>
-		<setting id="addRugtoplot"> Check this option to add a <b>rug</b> to the current plot. See the R reference on 'rug' for more detials. All the available options, namely, 'Side of Rug', 'Tick size', Tick width' and 'Color' are self evident.</setting>
-	</settings>
-	<related>
-		<ul>
-			<li><link href="rkward://rhelp/Binomial"/></li>
-			<li><link href="rkward://component/plot_beta_distribution"/></li>
-			<li><link href="rkward://rhelp/Normal"/></li>
-			<li><link href="rkward://rhelp/hist"/></li>
-			<li><link href="rkward://rhelp/rect"/></li>
-			<li><link href="rkward://component/plot_stepfun_options"/></li>
-			<li><link href="rkward://rhelp/rug"/></li>
-		</ul>
-	</related>
-</document>
-

Deleted: trunk/rkward/rkward/plugins/distributions/plot_binomial_clt.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_binomial_clt.xml	2007-03-02 00:19:21 UTC (rev 1525)
+++ trunk/rkward/rkward/plugins/distributions/plot_binomial_clt.xml	2007-03-02 07:39:43 UTC (rev 1526)
@@ -1,117 +0,0 @@
-<!DOCTYPE rkplugin>
-<document>
-	<code file="plot_binomial_clt.php" />
-	<help file="plot_binomial_clt.rkh" />
-	<logic>
-		<set id="plotoptions.allow_log" to="false"/>
-		<set id="plotoptions.allow_type" to="false"/>
-		<set id="plotoptions.main.text" to="Binomial"/>
-		<set id="plotoptions.xlab.text" to="Sample Averages"/>
-
-		<set id="normlinecol.default_color" to="red" />
-
-		<set id="histogram_opt.varname" to="rk.temp.cltdistrib$avg" />
-		<set id="histogram_opt.allow_freq" to="false" />
-		<set id="histogram_opt.allow_barlabels" to="true" />
-		<set id="histogram_opt.allow_addtoplot" to="false" />
-
-		<convert id="isHistogram" sources="function.string" mode="equals" standard="hist"/>
-		<connect client="tab_histoptions.enabled" governor="isHistogram"/>
-
-		<convert id="isDist" sources="function.string" mode="equals" standard="dist"/>
-		<connect client="tab_distfunction.enabled" governor="isDist"/>
-
-		<connect client="normpointtype.enabled" governor="drawnorm.state"/>
-		<connect client="normlinecol.color.enabled" governor="drawnorm.state"/>
-
-		<set id="dist_stepfun.allow_addtoplot" to="false" />
-		<set id="dist_stepfun.default_verticals" to="false" />
-
-		<connect client="rug_side.enabled" governor="addRugtoplot.state" />
-		<connect client="rug_ticksize.enabled" governor="addRugtoplot.state"/>
-		<connect client="rug_lwd.enabled" governor="addRugtoplot.state"/>
-		<connect client="col_rug.color.enabled" governor="addRugtoplot.state"/>
-
-		<set id="col_y0.argument" to=""/>
-		<set id="col_y1.argument" to=""/>
-</logic>
-	<dialog label="Central Limit Theorem: Binomial to Normal" >
-		<tabbook>
-			<tab id="tab_plot_distrib_clt" label="Parameters" >
-				<row>
-					<column>
-						<frame label="CLT Samples" >
-							<spinbox type="integer" min = "1" id="nAvg" initial="10" label="Samples for Average" />
-							<spinbox type="integer" min = "10" id="nDist" initial="1000" label="Samples for distribution" />
-						</frame>
-						<frame id="frame_binomparam" label="Binomial Parameters">
-							<spinbox type="integer" id="size" min="1" 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="hist" label="Histogram and Density" />
-							<option value="dist" label="ECDF and Distribution" />
-						</radio>
-						<checkbox id="scalenorm" label="Use normalised random variable" value="1" value_unchecked="0"/>
-						<frame id="frame_lineoptions" label="Nomral Curve Options">
-							<checkbox id="drawnorm" label="Draw normal curve" value="1" value_unchecked="0" checked="true"/>
-							<dropdown id="normpointtype" label="Type of points/lines" >
-								<option value="p" label="Individual points " />
-								<option value="l" label="Lines" checked="true"/>
-								<option value="b" label="Points connected by lines (both)" />
-								<option value="o" label="Points overlaid by lines " />
-								<option value="h" label="Vertical lines (high-density)" />
-								<option value="s" label="Step-function on left edge" />
-								<option value="S" label="Step-function on right edge" />
-							</dropdown>
-							<embed id="normlinecol" component="rkward::color_chooser" label="Color" />
-						</frame>
-					</column>
-				</row>
-			<stretch/>
-				<row>
-					<embed id="plotoptions" component="rkward::plot_options" as_button="true" label="Plot Options" />
-					<preview id="preview" label="Preview"/>
-				</row>
-			</tab>
-
-			<tab id="tab_histoptions" label="Histogram">
-				<embed id="histogram_opt" component="rkward::histogram_options" label="Histogram Options"/>
-			</tab>
-
-			<tab id="tab_distfunction" label="ECDF options">
-				<embed id="dist_stepfun" component="rkward::plot_stepfun_options" label=""/>
-				<row>
-					<frame id="frame_rug" label="Rug options">
-						<row>
-							<column>
-								<checkbox id="addRugtoplot" label="Add Rug" />
-								<radio id="rug_side" label="Side of Rug">
-									<option value="1" label="Bottom" />
-									<option value="3" label="Top" />
-								</radio>
-							</column>
-							<column>
-								<spinbox id="rug_ticksize" min="0" initial="0.03" label="Tick size"/>
-								<spinbox id="rug_lwd" min="0" initial="0.5" label="Tick width" />
-								<embed id="col_rug" component="rkward::color_chooser" label="Color"/>
-							</column>
-						</row>
-					</frame>
-					<column>
-						<frame id="frame_col_y0" label="For y = 0 line">
-							<embed id="col_y0" component="rkward::color_chooser" label="Color"/>
-						</frame>
-						<frame id="frame_col_y1" label="For y = 1 line">
-							<embed id="col_y1" component="rkward::color_chooser" label="Color"/>
-						</frame>
-					</column>
-				</row>
-				<stretch/>
-			</tab>
-
-		</tabbook>
-	</dialog>
-</document>

Modified: trunk/rkward/rkward/plugins/under_development.pluginmap
===================================================================
--- trunk/rkward/rkward/plugins/under_development.pluginmap	2007-03-02 00:19:21 UTC (rev 1525)
+++ trunk/rkward/rkward/plugins/under_development.pluginmap	2007-03-02 07:39:43 UTC (rev 1526)
@@ -5,7 +5,7 @@
 		<component type="standard" id="export_x11_device_new" file="x11device/export_new.xml" label="Export (new)" />
 		<component type="standard" id="setworkdir" file="00saveload/setworkdir.xml" label="Set Working Directory" />
 
-		<component type="standard" id="plot_binomial_clt" file="distributions/plot_binomial_clt.xml" label="Binomial CLT" />
+		<component type="standard" id="plot_binomial_clt" file="distributions/clt/plot_binomial_clt.xml" label="Binomial CLT" />
 		<component type="standard" id="pareto" file="plots/pareto.xml" label="Pareto Chart" />
 
 		<component type="standard" id="moment" file="analysis/moments/moment.xml" label="Moment" />


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