[rkward-cvs] SF.net SVN: rkward: [1017] trunk/rkward/rkward/plugins
sjar at users.sourceforge.net
sjar at users.sourceforge.net
Sat Dec 30 23:33:12 UTC 2006
Revision: 1017
http://svn.sourceforge.net/rkward/?rev=1017&view=rev
Author: sjar
Date: 2006-12-30 15:33:11 -0800 (Sat, 30 Dec 2006)
Log Message:
-----------
* Initial support for Normality tests depending on nortest package
-> need for improvements i. e. correct handling of seqence lengt
* some improvements and corrections on histogram and ecdf plot
* initial support for density plot and stripcharts
Modified Paths:
--------------
trunk/rkward/rkward/plugins/distributions.pluginmap
trunk/rkward/rkward/plugins/plots/histogram.php
trunk/rkward/rkward/plugins/plots/histogram.xml
trunk/rkward/rkward/plugins/plots.pluginmap
Added Paths:
-----------
trunk/rkward/rkward/plugins/distributions/ad_test.php
trunk/rkward/rkward/plugins/distributions/ad_test.xml
trunk/rkward/rkward/plugins/distributions/cvm_test.php
trunk/rkward/rkward/plugins/distributions/cvm_test.xml
trunk/rkward/rkward/plugins/distributions/lillie_test.php
trunk/rkward/rkward/plugins/distributions/lillie_test.xml
trunk/rkward/rkward/plugins/distributions/pearson_test.php
trunk/rkward/rkward/plugins/distributions/pearson_test.xml
trunk/rkward/rkward/plugins/distributions/sf_test.php
trunk/rkward/rkward/plugins/distributions/sf_test.xml
trunk/rkward/rkward/plugins/distributions/shapiro_test.php
trunk/rkward/rkward/plugins/distributions/shapiro_test.xml
trunk/rkward/rkward/plugins/plots/density_plot.php
trunk/rkward/rkward/plugins/plots/density_plot.xml
trunk/rkward/rkward/plugins/plots/stripchart_plot.php
trunk/rkward/rkward/plugins/plots/stripchart_plot.xml
Added: trunk/rkward/rkward/plugins/distributions/ad_test.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/ad_test.php (rev 0)
+++ trunk/rkward/rkward/plugins/distributions/ad_test.php 2006-12-30 23:33:11 UTC (rev 1017)
@@ -0,0 +1,60 @@
+<?
+ function preprocess () {
+ }
+
+ function calculate () {
+ $vars = "substitute (" . str_replace ("\n", "), substitute (", trim (getRK_val ("x"))) . ")";
+
+?>
+ require(nortest)
+
+ rk.temp.options <- list (dolength=<? getRK ("length"); ?>, donacount=<? getRK ("nacount"); ?>)
+
+ rk.temp.results <- list ()
+ i=0; for (var in list (<? echo ($vars); ?>)) {
+ i = i+1
+ rk.temp.results[[i]] <- list ()
+ rk.temp.results[[i]]$object <- rk.get.description (var, is.substitute=TRUE)
+ rk.temp.results[[i]]$ad_test <- ad.test (eval (var))
+ if (rk.temp.options$dolength) try (rk.temp.results[[i]]$length <- length (eval (var)))
+ if (rk.temp.options$donacount) try (rk.temp.results[[i]]$nacount <- length (which(is.na(eval (var)))))
+}
+
+
+<?
+ }
+ function printout () {
+?> cat ("<h1>Anderson-Darling Normality Test</h1>\n")
+
+cat ("<table border=\"1\">")
+ cat ("<tbody>")
+ cat ("<tr>")
+ cat ("<td>Variable Name</td>")
+ if (rk.temp.options$dolength) cat ("<td>Length</td>")
+ if (rk.temp.options$donacount) cat ("<td>NAs</td>")
+ cat ("<td>W</td>")
+ cat ("<td>p-value</td>")
+ cat ("<td>Test</td>")
+ cat ("<td>variable</td>")
+ cat ("</tr>")
+for (i in 1:length (rk.temp.results)) {
+ cat ("<tr><td>", rk.temp.results[[i]]$object, "</td>")
+ if (rk.temp.options$dolength) cat ("<td>", rk.temp.results[[i]]$length, "</td>")
+ if (rk.temp.options$donacount) cat ("<td>", rk.temp.results[[i]]$nacount, "</td>")
+ cat (paste ("<td>", rk.temp.results[[i]]$ad_test,"</td>"))
+ cat ("</tr>")
+}
+ cat ("</tbody>")
+cat ("</table>")
+
+
+<?
+ }
+ function cleanup () {
+
+?>
+ rm (rk.temp.results)
+ rm (var)
+<?
+ }
+?>
\ No newline at end of file
Property changes on: trunk/rkward/rkward/plugins/distributions/ad_test.php
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/rkward/rkward/plugins/distributions/ad_test.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/ad_test.xml (rev 0)
+++ trunk/rkward/rkward/plugins/distributions/ad_test.xml 2006-12-30 23:33:11 UTC (rev 1017)
@@ -0,0 +1,28 @@
+<!DOCTYPE rkplugin>
+
+<!-- This is the Anderson-Darling test for Normality -->
+
+<document>
+ <code file="ad_test.php"/>
+ <dialog label="Anderson-Darling Normality Test">
+ <tabbook>
+ <tab label="Select Variables" >
+ <row>
+ <column>
+ <varselector id="vars"/>
+ </column>
+ <column>
+ <frame label="The number of the selcted values must be greater than 7">
+ <varslot type="numeric" multi="true" id="x" source="vars" required="true" label="variable(s):"/>
+ </frame>
+ <stretch/>
+ </column>
+ </row>
+ </tab>
+ <tab label="Options">
+ <checkbox id="length" label="Show Length" value_unchecked="0" value="1" checked="true" />
+ <checkbox id="nacount" label="Show Missing Values" value_unchecked="0" value="1" checked="false" />
+ </tab>
+ </tabbook>
+ </dialog>
+</document>
Property changes on: trunk/rkward/rkward/plugins/distributions/ad_test.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/rkward/rkward/plugins/distributions/cvm_test.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/cvm_test.php (rev 0)
+++ trunk/rkward/rkward/plugins/distributions/cvm_test.php 2006-12-30 23:33:11 UTC (rev 1017)
@@ -0,0 +1,60 @@
+<?
+ function preprocess () {
+ }
+
+ function calculate () {
+ $vars = "substitute (" . str_replace ("\n", "), substitute (", trim (getRK_val ("x"))) . ")";
+
+?>
+ require(nortest)
+
+ rk.temp.options <- list (dolength=<? getRK ("length"); ?>, donacount=<? getRK ("nacount"); ?>)
+
+ rk.temp.results <- list ()
+ i=0; for (var in list (<? echo ($vars); ?>)) {
+ i = i+1
+ rk.temp.results[[i]] <- list ()
+ rk.temp.results[[i]]$object <- rk.get.description (var, is.substitute=TRUE)
+ rk.temp.results[[i]]$cvm_test <- cvm.test (eval (var))
+ if (rk.temp.options$dolength) try (rk.temp.results[[i]]$length <- length (eval (var)))
+ if (rk.temp.options$donacount) try (rk.temp.results[[i]]$nacount <- length (which(is.na(eval (var)))))
+}
+
+
+<?
+ }
+ function printout () {
+?> cat ("<h1>Cramer-von Mises Normality Test</h1>\n")
+
+cat ("<table border=\"1\">")
+ cat ("<tbody>")
+ cat ("<tr>")
+ cat ("<td>Variable Name</td>")
+ if (rk.temp.options$dolength) cat ("<td>Length</td>")
+ if (rk.temp.options$donacount) cat ("<td>NAs</td>")
+ cat ("<td>Statistic</td>")
+ cat ("<td>p-value</td>")
+ cat ("<td>Test</td>")
+ cat ("<td>variable</td>")
+ cat ("</tr>")
+for (i in 1:length (rk.temp.results)) {
+ cat ("<tr><td>", rk.temp.results[[i]]$object, "</td>")
+ if (rk.temp.options$dolength) cat ("<td>", rk.temp.results[[i]]$length, "</td>")
+ if (rk.temp.options$donacount) cat ("<td>", rk.temp.results[[i]]$nacount, "</td>")
+ cat (paste ("<td>", rk.temp.results[[i]]$cvm_test,"</td>"))
+ cat ("</tr>")
+}
+ cat ("</tbody>")
+cat ("</table>")
+
+
+<?
+ }
+ function cleanup () {
+
+?>
+ rm (rk.temp.results)
+ rm (var)
+<?
+ }
+?>
\ No newline at end of file
Property changes on: trunk/rkward/rkward/plugins/distributions/cvm_test.php
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/rkward/rkward/plugins/distributions/cvm_test.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/cvm_test.xml (rev 0)
+++ trunk/rkward/rkward/plugins/distributions/cvm_test.xml 2006-12-30 23:33:11 UTC (rev 1017)
@@ -0,0 +1,28 @@
+<!DOCTYPE rkplugin>
+
+<!-- This is the Cramer-von Mises test for Normality -->
+
+<document>
+ <code file="cvm_test.php"/>
+ <dialog label="Cramer-von Mises Normality Test">
+ <tabbook>
+ <tab label="Select Variables" >
+ <row>
+ <column>
+ <varselector id="vars"/>
+ </column>
+ <column>
+ <frame label="The number of the selcted values must be greater than 7">
+ <varslot type="numeric" multi="true" id="x" source="vars" required="true" label="variable(s):"/>
+ </frame>
+ <stretch/>
+ </column>
+ </row>
+ </tab>
+ <tab label="Options">
+ <checkbox id="length" label="Show Length" value_unchecked="0" value="1" checked="true" />
+ <checkbox id="nacount" label="Show Missing Values" value_unchecked="0" value="1" checked="false" />
+ </tab>
+ </tabbook>
+ </dialog>
+</document>
Property changes on: trunk/rkward/rkward/plugins/distributions/cvm_test.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/rkward/rkward/plugins/distributions/lillie_test.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/lillie_test.php (rev 0)
+++ trunk/rkward/rkward/plugins/distributions/lillie_test.php 2006-12-30 23:33:11 UTC (rev 1017)
@@ -0,0 +1,60 @@
+<?
+ function preprocess () {
+ }
+
+ function calculate () {
+ $vars = "substitute (" . str_replace ("\n", "), substitute (", trim (getRK_val ("x"))) . ")";
+
+?>
+ require(nortest)
+
+ rk.temp.options <- list (dolength=<? getRK ("length"); ?>, donacount=<? getRK ("nacount"); ?>)
+
+ rk.temp.results <- list ()
+ i=0; for (var in list (<? echo ($vars); ?>)) {
+ i = i+1
+ rk.temp.results[[i]] <- list ()
+ rk.temp.results[[i]]$object <- rk.get.description (var, is.substitute=TRUE)
+ rk.temp.results[[i]]$lillie <- lillie.test (eval (var))
+ if (rk.temp.options$dolength) try (rk.temp.results[[i]]$length <- length (eval (var)))
+ if (rk.temp.options$donacount) try (rk.temp.results[[i]]$nacount <- length (which(is.na(eval (var)))))
+}
+
+
+<?
+ }
+ function printout () {
+?> cat ("<h1>Lilliefors (Kolmogorov-Smirnov) Normality test</h1>\n")
+
+cat ("<table border=\"1\">")
+ cat ("<tbody>")
+ cat ("<tr>")
+ cat ("<td>Variable Name</td>")
+ if (rk.temp.options$dolength) cat ("<td>Length</td>")
+ if (rk.temp.options$donacount) cat ("<td>NAs</td>")
+ cat ("<td>Statistic</td>")
+ cat ("<td>p-value</td>")
+ cat ("<td>Test</td>")
+ cat ("<td>variable</td>")
+ cat ("</tr>")
+for (i in 1:length (rk.temp.results)) {
+ cat ("<tr><td>", rk.temp.results[[i]]$object, "</td>")
+ if (rk.temp.options$dolength) cat ("<td>", rk.temp.results[[i]]$length, "</td>")
+ if (rk.temp.options$donacount) cat ("<td>", rk.temp.results[[i]]$nacount, "</td>")
+ cat (paste ("<td>", rk.temp.results[[i]]$lillie,"</td>"))
+ cat ("</tr>")
+}
+ cat ("</tbody>")
+cat ("</table>")
+
+
+<?
+ }
+ function cleanup () {
+
+?>
+ rm (rk.temp.results)
+ rm (var)
+<?
+ }
+?>
\ No newline at end of file
Property changes on: trunk/rkward/rkward/plugins/distributions/lillie_test.php
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/rkward/rkward/plugins/distributions/lillie_test.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/lillie_test.xml (rev 0)
+++ trunk/rkward/rkward/plugins/distributions/lillie_test.xml 2006-12-30 23:33:11 UTC (rev 1017)
@@ -0,0 +1,28 @@
+<!DOCTYPE rkplugin>
+
+<!-- This is the Lilliefors (Kolmogorov-Smirnov) Normality test-->
+
+<document>
+ <code file="lillie_test.php"/>
+ <dialog label="Lilliefors (Kolmogorov-Smirnov) Normality Test">
+ <tabbook>
+ <tab label="Select Variables" >
+ <row>
+ <column>
+ <varselector id="vars"/>
+ </column>
+ <column>
+ <frame label="The number of the selcted values must be larger greater than 4">
+ <varslot type="numeric" multi="true" id="x" source="vars" required="true" label="variable(s):"/>
+ </frame>
+ <stretch/>
+ </column>
+ </row>
+ </tab>
+ <tab label="Options">
+ <checkbox id="length" label="Show Length" value_unchecked="0" value="1" checked="true" />
+ <checkbox id="nacount" label="Show Missing Values" value_unchecked="0" value="1" checked="false" />
+ </tab>
+ </tabbook>
+ </dialog>
+</document>
Property changes on: trunk/rkward/rkward/plugins/distributions/lillie_test.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/rkward/rkward/plugins/distributions/pearson_test.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/pearson_test.php (rev 0)
+++ trunk/rkward/rkward/plugins/distributions/pearson_test.php 2006-12-30 23:33:11 UTC (rev 1017)
@@ -0,0 +1,64 @@
+<?
+ function preprocess () {
+ }
+
+ function calculate () {
+ $vars = "substitute (" . str_replace ("\n", "), substitute (", trim (getRK_val ("x"))) . ")";
+ $nclasses = getRK_val ("nclasses");
+ $adjust = getRK_val ("adjust");
+
+?>
+ require(nortest)
+
+ rk.temp.options <- list (dolength=<? getRK ("length"); ?>, donacount=<? getRK ("nacount"); ?>)
+
+ rk.temp.results <- list ()
+ i=0; for (var in list (<? echo ($vars); ?>)) {
+ i = i+1
+ rk.temp.results[[i]] <- list ()
+ rk.temp.results[[i]]$object <- rk.get.description (var, is.substitute=TRUE)
+ rk.temp.results[[i]]$pearson_test <- pearson.test (eval (var), n.classes = <? echo $nclasses ?>, <? echo $adjust ?> )
+ if (rk.temp.options$dolength) try (rk.temp.results[[i]]$length <- length (eval (var)))
+ if (rk.temp.options$donacount) try (rk.temp.results[[i]]$nacount <- length (which(is.na(eval (var)))))
+}
+
+
+<?
+ }
+ function printout () {
+?> cat ("<h1>Pearson chi-square Normality Test</h1>\n")
+
+cat ("<table border=\"1\">")
+ cat ("<tbody>")
+ cat ("<tr>")
+ cat ("<td>Variable Name</td>")
+ if (rk.temp.options$dolength) cat ("<td>Length</td>")
+ if (rk.temp.options$donacount) cat ("<td>NAs</td>")
+ cat ("<td>Statistic</td>")
+ cat ("<td>p-value</td>")
+ cat ("<td>Method</td>")
+ cat ("<td>variable</td>")
+ cat ("<td>n.classes</td>")
+ cat ("<td>adjust</td>")
+ cat ("</tr>")
+for (i in 1:length (rk.temp.results)) {
+ cat ("<tr><td>", rk.temp.results[[i]]$object, "</td>")
+ if (rk.temp.options$dolength) cat ("<td>", rk.temp.results[[i]]$length, "</td>")
+ if (rk.temp.options$donacount) cat ("<td>", rk.temp.results[[i]]$nacount, "</td>")
+ cat (paste ("<td>", rk.temp.results[[i]]$pearson_test,"</td>"))
+ cat ("</tr>")
+}
+ cat ("</tbody>")
+cat ("</table>")
+
+
+<?
+ }
+ function cleanup () {
+
+?>
+ rm (rk.temp.results)
+ rm (var)
+<?
+ }
+?>
\ No newline at end of file
Property changes on: trunk/rkward/rkward/plugins/distributions/pearson_test.php
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/rkward/rkward/plugins/distributions/pearson_test.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/pearson_test.xml (rev 0)
+++ trunk/rkward/rkward/plugins/distributions/pearson_test.xml 2006-12-30 23:33:11 UTC (rev 1017)
@@ -0,0 +1,35 @@
+<!DOCTYPE rkplugin>
+
+<!-- This is the Cramer-von Mises test for Normality -->
+
+<document>
+ <code file="pearson_test.php"/>
+ <dialog label="Pearson chi-square Normality Test">
+ <tabbook>
+ <tab label="Select Variables" >
+ <row>
+ <column>
+ <varselector id="vars"/>
+ </column>
+ <column>
+ <frame label="The number of the selcted values must be greater than 7">
+ <varslot type="numeric" multi="true" id="x" source="vars" required="true" label="variable(s):"/>
+ </frame>
+ <stretch/>
+ </column>
+ </row>
+ </tab>
+ <tab label="Options">
+ <frame>
+ <input id="nclasses" label="Number of Classes" initial="ceiling(2 * (n^(2/5)))" />
+ <radio id="adjust" label="p-value from chi^2-distribution from:">
+ <option value="adjust = TRUE" label="n.classes-3 degrees of freedom" />
+ <option value="adjust = FALSE" label="n.classes-1 degrees of freedom" />
+ </radio>
+ </frame>
+ <checkbox id="length" label="Show Length" value_unchecked="0" value="1" checked="true" />
+ <checkbox id="nacount" label="Show Missing Values" value_unchecked="0" value="1" checked="false" />
+ </tab>
+ </tabbook>
+ </dialog>
+</document>
Property changes on: trunk/rkward/rkward/plugins/distributions/pearson_test.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/rkward/rkward/plugins/distributions/sf_test.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/sf_test.php (rev 0)
+++ trunk/rkward/rkward/plugins/distributions/sf_test.php 2006-12-30 23:33:11 UTC (rev 1017)
@@ -0,0 +1,60 @@
+<?
+ function preprocess () {
+ }
+
+ function calculate () {
+ $vars = "substitute (" . str_replace ("\n", "), substitute (", trim (getRK_val ("x"))) . ")";
+
+?>
+ require(nortest)
+
+ rk.temp.options <- list (dolength=<? getRK ("length"); ?>, donacount=<? getRK ("nacount"); ?>)
+
+ rk.temp.results <- list ()
+ i=0; for (var in list (<? echo ($vars); ?>)) {
+ i = i+1
+ rk.temp.results[[i]] <- list ()
+ rk.temp.results[[i]]$object <- rk.get.description (var, is.substitute=TRUE)
+ rk.temp.results[[i]]$sf_test <- sf.test (eval (var))
+ if (rk.temp.options$dolength) try (rk.temp.results[[i]]$length <- length (eval (var)))
+ if (rk.temp.options$donacount) try (rk.temp.results[[i]]$nacount <- length (which(is.na(eval (var)))))
+}
+
+
+<?
+ }
+ function printout () {
+?> cat ("<h1>Shapiro-Francia Normality Test</h1>\n")
+
+cat ("<table border=\"1\">")
+ cat ("<tbody>")
+ cat ("<tr>")
+ cat ("<td>Variable Name</td>")
+ if (rk.temp.options$dolength) cat ("<td>Length</td>")
+ if (rk.temp.options$donacount) cat ("<td>NAs</td>")
+ cat ("<td>Statistic</td>")
+ cat ("<td>p-value</td>")
+ cat ("<td>Test</td>")
+ cat ("<td>variable</td>")
+ cat ("</tr>")
+for (i in 1:length (rk.temp.results)) {
+ cat ("<tr><td>", rk.temp.results[[i]]$object, "</td>")
+ if (rk.temp.options$dolength) cat ("<td>", rk.temp.results[[i]]$length, "</td>")
+ if (rk.temp.options$donacount) cat ("<td>", rk.temp.results[[i]]$nacount, "</td>")
+ cat (paste ("<td>", rk.temp.results[[i]]$sf_test,"</td>"))
+ cat ("</tr>")
+}
+ cat ("</tbody>")
+cat ("</table>")
+
+
+<?
+ }
+ function cleanup () {
+
+?>
+ rm (rk.temp.results)
+ rm (var)
+<?
+ }
+?>
\ No newline at end of file
Property changes on: trunk/rkward/rkward/plugins/distributions/sf_test.php
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/rkward/rkward/plugins/distributions/sf_test.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/sf_test.xml (rev 0)
+++ trunk/rkward/rkward/plugins/distributions/sf_test.xml 2006-12-30 23:33:11 UTC (rev 1017)
@@ -0,0 +1,28 @@
+<!DOCTYPE rkplugin>
+
+<!-- This is the Shapiro-Francia test for Normality -->
+
+<document>
+ <code file="sf_test.php"/>
+ <dialog label="Shapiro-Wilk Normality Test">
+ <tabbook>
+ <tab label="Select Variables" >
+ <row>
+ <column>
+ <varselector id="vars"/>
+ </column>
+ <column>
+ <frame label="The number of the selcted values must be between 5 and 5000">
+ <varslot type="numeric" multi="true" id="x" source="vars" required="true" label="variable(s):"/>
+ </frame>
+ <stretch/>
+ </column>
+ </row>
+ </tab>
+ <tab label="Options">
+ <checkbox id="length" label="Show Length" value_unchecked="0" value="1" checked="true" />
+ <checkbox id="nacount" label="Show Missing Values" value_unchecked="0" value="1" checked="false" />
+ </tab>
+ </tabbook>
+ </dialog>
+</document>
Property changes on: trunk/rkward/rkward/plugins/distributions/sf_test.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/rkward/rkward/plugins/distributions/shapiro_test.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/shapiro_test.php (rev 0)
+++ trunk/rkward/rkward/plugins/distributions/shapiro_test.php 2006-12-30 23:33:11 UTC (rev 1017)
@@ -0,0 +1,58 @@
+<?
+ function preprocess () {
+ }
+
+ function calculate () {
+ $vars = "substitute (" . str_replace ("\n", "), substitute (", trim (getRK_val ("x"))) . ")";
+
+?>
+ rk.temp.options <- list (dolength=<? getRK ("length"); ?>, donacount=<? getRK ("nacount"); ?>)
+
+ rk.temp.results <- list ()
+ i=0; for (var in list (<? echo ($vars); ?>)) {
+ i = i+1
+ rk.temp.results[[i]] <- list ()
+ rk.temp.results[[i]]$object <- rk.get.description (var, is.substitute=TRUE)
+ rk.temp.results[[i]]$shapiro <- shapiro.test (eval (var))
+ if (rk.temp.options$dolength) try (rk.temp.results[[i]]$length <- length (eval (var)))
+ if (rk.temp.options$donacount) try (rk.temp.results[[i]]$nacount <- length (which(is.na(eval (var)))))
+}
+
+
+<?
+ }
+ function printout () {
+?> cat ("<h1>Shapiro-Wilk Normality Test</h1>\n")
+
+cat ("<table border=\"1\">")
+ cat ("<tbody>")
+ cat ("<tr>")
+ cat ("<td>Variable Name</td>")
+ if (rk.temp.options$dolength) cat ("<td>Length</td>")
+ if (rk.temp.options$donacount) cat ("<td>NAs</td>")
+ cat ("<td>W</td>")
+ cat ("<td>p-value</td>")
+ cat ("<td>Test</td>")
+ cat ("<td>variable</td>")
+ cat ("</tr>")
+for (i in 1:length (rk.temp.results)) {
+ cat ("<tr><td>", rk.temp.results[[i]]$object, "</td>")
+ if (rk.temp.options$dolength) cat ("<td>", rk.temp.results[[i]]$length, "</td>")
+ if (rk.temp.options$donacount) cat ("<td>", rk.temp.results[[i]]$nacount, "</td>")
+ cat (paste ("<td>", rk.temp.results[[i]]$shapiro,"</td>"))
+ cat ("</tr>")
+}
+ cat ("</tbody>")
+cat ("</table>")
+
+
+<?
+ }
+ function cleanup () {
+
+?>
+ rm (rk.temp.results)
+ rm (var)
+<?
+ }
+?>
\ No newline at end of file
Property changes on: trunk/rkward/rkward/plugins/distributions/shapiro_test.php
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/rkward/rkward/plugins/distributions/shapiro_test.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/shapiro_test.xml (rev 0)
+++ trunk/rkward/rkward/plugins/distributions/shapiro_test.xml 2006-12-30 23:33:11 UTC (rev 1017)
@@ -0,0 +1,28 @@
+<!DOCTYPE rkplugin>
+
+<!-- This is the Shapiro-Wilk’s test for Normality -->
+
+<document>
+ <code file="shapiro_test.php"/>
+ <dialog label="Shapiro-Wilk Normality Test">
+ <tabbook>
+ <tab label="Select Variables" >
+ <row>
+ <column>
+ <varselector id="vars"/>
+ </column>
+ <column>
+ <frame label="The number of the selcted values must be between 3 and 5000">
+ <varslot type="numeric" multi="true" id="x" source="vars" required="true" label="variable(s):"/>
+ </frame>
+ <stretch/>
+ </column>
+ </row>
+ </tab>
+ <tab label="Options">
+ <checkbox id="length" label="Show Length" value_unchecked="0" value="1" checked="true" />
+ <checkbox id="nacount" label="Show Missing Values" value_unchecked="0" value="1" checked="false" />
+ </tab>
+ </tabbook>
+ </dialog>
+</document>
Property changes on: trunk/rkward/rkward/plugins/distributions/shapiro_test.xml
___________________________________________________________________
Name: svn:executable
+ *
Modified: trunk/rkward/rkward/plugins/distributions.pluginmap
===================================================================
--- trunk/rkward/rkward/plugins/distributions.pluginmap 2006-12-30 21:56:34 UTC (rev 1016)
+++ trunk/rkward/rkward/plugins/distributions.pluginmap 2006-12-30 23:33:11 UTC (rev 1017)
@@ -3,6 +3,13 @@
<document base_prefix="distributions/" namespace="rkward">
<components>
+ <component type="standard" id="shapiro_test" file="shapiro_test.xml" label="Shapiro-Wilk Normality Test" />
+ <component type="standard" id="ad_test" file="ad_test.xml" label="Anderson-Darling Normality Test" />
+ <component type="standard" id="cvm_test" file="cvm_test.xml" label="Cramer-von Mises Normality Test" />
+ <component type="standard" id="pearson_test" file="pearson_test.xml" label="Pearson chi-square Normality Test" />
+ <component type="standard" id="sf_test" file="sf_test.xml" label="Shapiro-Francia Normality Test" />
+ <component type="standard" id="lillie_test" file="lillie_test.xml" label="Lilliefors (Kolmogorov-Smirnov) Normality Test" />
+
<component type="standard" id="beta_quantiles" file="beta_quantiles.xml" label="Beta quantiles" />
<component type="standard" id="beta_probabilities" file="beta_probabilities.xml" label="Beta probabilities" />
@@ -72,8 +79,15 @@
<hierarchy>
<menu id="distributions" label="Distributions" index="7">
-
- <menu id="univariate_continuous_distributions" label="Univariate continuous distributions" index="0">
+ <menu id="distribution_analysis" label="Distribution Analysis" index="0">
+ <entry component="ad_test" label="Anderson-Darling Normality Test" index="0"/>
+ <entry component="cvm_test" label="Cramer-von Mises Normality Test" index="1"/>
+ <entry component="lillie_test" label="Lilliefors (Kolmogorov-Smirnov) Normality Test" index="2"/>
+ <entry component="pearson_test" label="Pearson chi-square Normality Test" index="3"/>
+ <entry component="sf_test" label="Shapiro-Francia Normality Test" index="4"/>
+ <entry component="shapiro_test" label="Shapiro-Wilk Normality Test" index="5"/>
+ </menu>
+ <menu id="univariate_continuous_distributions" label="Univariate continuous distributions" index="1">
<menu id="beta_distribution" label="Beta Distribution" index="0">
<entry component="beta_quantiles" label="Beta quantiles" index="1"/>
<entry component="beta_probabilities" label="Beta probabilities" index="0"/>
@@ -140,7 +154,7 @@
</menu>
</menu>
- <menu id="univariate_discrete_distributions" label="Univariate discrete distributions" index="1">
+ <menu id="univariate_discrete_distributions" label="Univariate discrete distributions" index="2">
<menu id="binomial_distribution" label="Binomial Distribution" index="0">
<entry component="binomial_quantiles" label="Binomial quantiles" index="1"/>
<entry component="binomial_tail_probabilities" label="Binomial tail probabilities" index="0"/>
Added: trunk/rkward/rkward/plugins/plots/density_plot.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/density_plot.php (rev 0)
+++ trunk/rkward/rkward/plugins/plots/density_plot.php 2006-12-30 23:33:11 UTC (rev 1017)
@@ -0,0 +1,53 @@
+<?
+ function preprocess () {
+ }
+
+ function calculate () {
+?>
+ length.temp <- length (<? getRK ("x"); ?>);
+ kern <- c("<? getRK ("kern"); ?>");
+ bw <- c("<? getRK ("bw"); ?>");
+ dohdrcde_plot <- <? getRK ("dohdrcde_plot"); ?>;
+ dodensity_plot <- <? getRK ("dodensity_plot"); ?>;
+ dorug_density <- <? getRK ("rug_density"); ?>;
+ dorug_hdrcde <- <? getRK ("rug_hdrcde"); ?>;
+<?
+ }
+
+ function printout () {
+ $giveRkern = getRK_val ("giveRkern");
+ $adjust = getRK_val ("adjust");
+ $bw = getRK_val ("bw");
+ $x = getRK_val ("x");
+ $narm = getRK_val ("narm");
+ $kern = getRK_val ("kern");
+?>
+
+if (dodensity_plot) rk.header ("Density Plot", list ("Variable", rk.get.description (<? echo ($x); ?>), "Band Width", bw, "Estimate Density", <? echo ($giveRkern) ?>, "Adjust", <? echo ($adjust) ?>, "Remove Missing Values", <? echo ($narm) ?>, "Length", length.temp, "n", <? getRK ("n"); ?>, "Smoothing Kernel", kern))
+
+if (dohdrcde_plot) rk.header ("Highest density regions", list ("Variable", rk.get.description (<? echo ($x); ?>)))
+
+rk.graph.on ()
+
+if ((dohdrcde_plot) && (dodensity_plot)) par(mfrow=c(1,2))
+
+if (dodensity_plot) plot (density(<? echo ($x); ?>, bw = "<? echo ($bw); ?>", adjust = <? echo ($adjust); ?>, <? echo ($giveRkern); ?>, kern = c("<? echo ($kern) ?>"), n = <? getRK ("n"); ?>, <? echo ($narm); ?> <? getRK ("plotoptions.code.printout"); ?>))
+if (dorug_density) rug(<? echo ($x); ?>, <? getRK ("ticksize"); ?>, <? getRK ("lwd"); ?>, <? getRK ("side"); ?>, col ="<? getRK ("col_rug"); ?>")
+if (dohdrcde_plot) require(hdrcde)
+if (dohdrcde_plot) hdr.den(<? echo ($x); ?> <? getRK ("plotoptions.code.printout"); ?>)
+if (dorug_hdrcde) rug(<? echo ($x); ?>, <? getRK ("ticksize"); ?>, <? getRK ("lwd"); ?>, <? getRK ("side"); ?>, col ="<? getRK ("col_rug"); ?>")
+rk.graph.off ()
+<?
+ }
+
+ function cleanup () {
+?> rm (length.temp)
+ rm (kern)
+ rm (bw)
+ rm (dohdrcde_plot)
+ rm (dodensity_plot)
+ rm (dorug_hdrcde)
+ rm (dorug_density)
+<?
+ }
+?>
Added: trunk/rkward/rkward/plugins/plots/density_plot.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/density_plot.xml (rev 0)
+++ trunk/rkward/rkward/plugins/plots/density_plot.xml 2006-12-30 23:33:11 UTC (rev 1017)
@@ -0,0 +1,81 @@
+<!DOCTYPE rkplugin>
+<document>
+ <code file="density_plot.php" />
+ <logic>
+ <connect client="plotoptions.xvar" governor="x.available"/>
+ <set id="plotoptions.allow_log" to="false"/>
+ <set id="plotoptions.allow_type" to="false"/>
+ </logic>
+ <dialog label="Density Plot" >
+ <tabbook>
+ <tab label="Variable(s)" >
+ <row>
+ <varselector id="vars" />
+ <varslot multi="false" type="numeric" id="x" source="vars" label="variable(s):" required="true" />
+ </row>
+ </tab>
+ <tab label="Options" >
+ <row>
+ <column>
+ <checkbox value_unchecked="0" value="1" checked="true" id="dodensity_plot" label="Highest density regions" />
+ <checkbox value_unchecked="0" value="1" checked="false" id="dohdrcde_plot" label="Highest density regions" />
+ <radio id="bw" label="Bandwidth">
+ <option value="nrd0" label="nrd0"/>
+ <option value="nrd" label="nrd"/>
+ <option value="ucv" label="ucv"/>
+ <option value="bcv" label="bcv"/>
+ <option value="SJ-ste" label="SJ-ste"/>
+ <option value="SJ-dpi" label="SJ-dpi"/>
+ </radio>
+ <spinbox type="real" id="adjust" label="Adjust Bandwidth" initial="1"/>
+ </column>
+ <column>
+ <radio id="narm" label="Remove Missing Values">
+ <option value="na.rm = TRUE" label="TRUE"/>
+ <option value="na.rm = FALSE" label="FALSE"/>
+ </radio>
+ <column>
+ <row>
+ <radio id="giveRkern" label="Estimate Density">
+ <option value="give.Rkern = FALSE" label="Density estimated"/>
+ <option value="give.Rkern = TRUE" label="Density not estimated"/>
+ </radio>
+ <spinbox id="n" initial="512" label="n" />
+ </row>
+ <stretch/>
+ </column>
+ <radio id="kern" label="Smoothing Kernel">
+ <option value="gaussian" label="gaussian (default)"/>
+ <option value="rectangular" label="rectangular"/>
+ <option value="triangular" label="triangular"/>
+ <option value="epanechnikov" label="epanechnikov"/>
+ <option value="biweight" label="biweight"/>
+ <option value="cosine" label="cosine"/>
+ <option value="optcosine" label="optcosine"/>
+ </radio>
+ <stretch/>
+ </column>
+ <column>
+ <frame label="Rug">
+ <checkbox value_unchecked="0" value="1" checked="false" id="rug_density" label="Rug Density" />
+ <checkbox value_unchecked="0" value="1" checked="false" id="rug_hdrcde" label="Rug Highest density regions" />
+ <spinbox initial="0.03" id="ticksize" label="Ticksize" />
+ <spinbox initial="0.5" id="lwd" label="Line width of ticks" />
+ <radio label="Side of Rug" id="side">
+ <option value="side = 1" label="Rug on Bottom" />
+ <option value="side = 3" label="Rug on Top" />
+ </radio>
+ <input id="col_rug" initial="black" label="Color of ticks"/>
+ </frame>
+ </column>
+ </row>
+ </tab>
+ <tab label="Axis/Title">
+ <row>
+ <embed id="plotoptions" component="rkward::plot_options" as_button="false" label="Plot Options" />
+ <stretch/>
+ </row>
+ </tab>
+ </tabbook>
+ </dialog>
+</document>
Modified: trunk/rkward/rkward/plugins/plots/histogram.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/histogram.php 2006-12-30 21:56:34 UTC (rev 1016)
+++ trunk/rkward/rkward/plugins/plots/histogram.php 2006-12-30 23:33:11 UTC (rev 1017)
@@ -6,11 +6,18 @@
}
function printout () {
- $breaks = getRK_val ("breaks");
+?>
+ dodensity <- <? getRK ("density"); ?>;
+
+<? $breaks = getRK_val ("breaks");
$scale = getRK_val ("scale");
+ $bw = getRK_val ("bw");
+ $adjust = getRK_val ("adjust");
+ $narm = getRK_val ("narm");
+ $giveRkern = getRK_val ("giveRkern");
$x = getRK_val ("x");
if ($breaks == "int") {
- $breaksopt = "breaks=seq (as.integer (min (" . $x . "))-0.5, as.integer (max (" . $x ."))+0.5)";
+ $breaksopt = "breaks =seq (as.integer (min (" . $x . "))-0.5, as.integer (max (" . $x ."))+ 0.5)";
$breaks = "Integers";
} else if (!empty ($breaks)) {
$breaksopt = "breaks=\"" . $breaks . "\"";
@@ -19,10 +26,13 @@
rk.header ("Histogram", list ("Frequency", "<? echo $scale; ?>", "Breaks algorithm", <? echo ("\"" . $breaks . "\""); ?>, "Variable", rk.get.description (<? echo ($x); ?>)))
rk.graph.on ()
hist (<? echo ($x); ?>, <? echo ($breaksopt); ?>, freq = <? echo $scale; ?><? getRK ("plotoptions.code.printout"); ?>)
+if ((dodensity) && (<? echo $scale ?> == FALSE)) lines(density(<? echo ($x); ?>, bw="<? echo ($bw); ?>", adjust = <? echo ($adjust); ?>, <? echo ($giveRkern); ?>, <? echo ($narm); ?>, n = <? getRK ("n"); ?>), col= "<? getRK ("col_density"); ?>")
rk.graph.off ()
<?
}
function cleanup () {
+?> rm (dodensity)
+<?
}
?>
Modified: trunk/rkward/rkward/plugins/plots/histogram.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/histogram.xml 2006-12-30 21:56:34 UTC (rev 1016)
+++ trunk/rkward/rkward/plugins/plots/histogram.xml 2006-12-30 23:33:11 UTC (rev 1017)
@@ -1,33 +1,62 @@
<!DOCTYPE rkplugin>
<document>
-<code file="histogram.php" />
-<logic>
- <connect client="plotoptions.xvar" governor="x.available"/>
- <set id="plotoptions.allow_log" to="false"/>
- <set id="plotoptions.allow_type" to="false"/>
-</logic>
-<dialog label="Histogram" >
- <tabbook>
- <tab label="Variable(s)" >
- <row>
- <varselector id="vars" />
- <varslot multi="false" type="numeric" id="x" source="vars" label="variable(s):" required="true" />
- </row>
- </tab>
- <tab label="Options" >
- <radio id="breaks" label="Method of setting breakpoints" >
- <option value="Sturges" label="Sturges" />
- <option value="Scott" label="Scott" />
- <option value="FD" label="Friedman-Diaconis" />
- <option checked="true" value="int" label="Integer numbers" />
- </radio>
- <radio id="scale" label="Y Scale" >
- <option value="TRUE" label="Frequency" />
- <option value="FALSE" label="Density" />
- </radio>
- <embed id="plotoptions" component="rkward::plot_options" as_button="true" label="Plot Options" />
- <stretch/>
- </tab>
- </tabbook>
-</dialog>
-</document>
+ <code file="histogram.php" />
+ <logic>
+ <connect client="plotoptions.xvar" governor="x.available"/>
+ <set id="plotoptions.allow_log" to="false"/>
+ <set id="plotoptions.allow_type" to="false"/>
+ </logic>
+ <dialog label="Histogram" >
+ <tabbook>
+ <tab label="Variable(s)" >
+ <row>
+ <varselector id="vars" />
+ <varslot multi="false" type="numeric" id="x" source="vars" label="variable(s):" required="true" />
+ </row>
+ </tab>
+ <tab label="Options" >
+ <radio id="breaks" label="Method of setting breakpoints" >
+ <option value="Sturges" label="Sturges" />
+ <option value="Scott" label="Scott" />
+ <option value="FD" label="Friedman-Diaconis" />
+ <option checked="true" value="int" label="Integer numbers" />
+ </radio>
+ <radio id="scale" label="Y Scale" >
+ <option value="TRUE" label="Frequency" />
+ <option value="FALSE" label="Density" />
+ </radio>
+ <embed id="plotoptions" component="rkward::plot_options" as_button="true" label="Plot Options" />
+ <stretch/>
+ </tab>
+ <tab label="Density">
+ <row>
+ <column>
+ <checkbox value_unchecked="0" value="1" checked="false" id="density" label="Density" />
+ <input id="col_density" initial="black" label="Color of Density"/>
+ <radio id="bw" label="Bandwidth">
+ <option value="nrd0" label="nrd0"/>
+ <option value="nrd" label="nrd"/>
+ <option value="ucv" label="ucv"/>
+ <option value="bcv" label="bcv"/>
+ <option value="SJ-ste" label="SJ-ste"/>
+ <option value="SJ-dpi" label="SJ-dpi"/>
+ </radio>
+ <spinbox type="real" id="adjust" label="Adjust Bandwidth" initial="1"/>
+ </column>
+ <column>
+ <radio id="narm" label="Remove Missing Values">
+ <option value="na.rm = TRUE" label="TRUE"/>
+ <option value="na.rm = FALSE" label="FALSE"/>
+ </radio>
+ <radio id="giveRkern" label="Estimate Density">
+ <option value="give.Rkern = FALSE" label="Estimate Density"/>
+ <option value="give.Rkern = TRUE" label="No density is estimated"/>
+ </radio>
+ <spinbox id="n" initial="512" label="number of equally spaced points at which the density is to be estimated" />
+ <stretch/>
+ </column>
+ </row>
+ </tab>
+ </tabbook>
+ </dialog>
+</document>
\ No newline at end of file
Added: trunk/rkward/rkward/plugins/plots/stripchart_plot.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/stripchart_plot.php (rev 0)
+++ trunk/rkward/rkward/plugins/plots/stripchart_plot.php 2006-12-30 23:33:11 UTC (rev 1017)
@@ -0,0 +1,30 @@
+<?
+ function preprocess () {
+ }
+
+ function calculate () {
+?> length.temp <- length (<? getRK ("x"); ?>);
+ method.temp <- c("<? getRK ("method"); ?>");
+<?
+ }
+
+ function printout () {
+ $x = getRK_val ("x");
+ $g = getRK_val ("g");
+ $method = getRK_val ("method");
+ $jitter = getRK_val ("jitter");
+ $offset = getRK_val ("offset");
+?>
+rk.header ("Stripchart", list ("Variable", rk.get.description (<? echo ($x); ?>), "Length", length.temp, "Method", method.temp, "Jitter", <? echo ($jitter); ?>, "Plot drawn vertically", <? getRK ("vertical"); ?>, "Offset", <? getRK ("offset"); ?>))
+rk.graph.on ()
+stripchart (<? echo ($x); ?> ~ (<? echo ($g); ?>), vertical= <? getRK ("vertical"); ?>, method = "<? getRK ("method"); ?>", jitter = <? echo ($jitter); ?>, offset = <? echo ($offset); ?> <? getRK ("plotoptions.code.printout"); ?>)
+rk.graph.off ()
+<?
+ }
+
+ function cleanup () {
+?> rm (length.temp)
+ rm (method.temp)
+<?
+ }
+?>
Added: trunk/rkward/rkward/plugins/plots/stripchart_plot.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/stripchart_plot.xml (rev 0)
+++ trunk/rkward/rkward/plugins/plots/stripchart_plot.xml 2006-12-30 23:33:11 UTC (rev 1017)
@@ -0,0 +1,49 @@
+<!DOCTYPE rkplugin>
+<document>
+ <code file="stripchart_plot.php" />
+ <logic>
+ <connect client="plotoptions.xvar" governor="x.available"/>
+ <set id="plotoptions.allow_log" to="true"/>
+ <set id="plotoptions.allow_type" to="false"/>
+ <set id="plotoptions.allow_asp" to="true"/>
+ </logic>
+ <dialog label="Stripchart" >
+ <tabbook>
+ <tab label="Variable(s)" >
+ <row>
+ <column>
+ <varselector id="vars" />
+ </column>
+ <column>
+ <varslot multi="false" type="numeric" id="x" source="vars" label="variable" required="true" />
+ <varslot multi="false" type="numeric" id="g" source="vars" label="Group" required="true" />
+ </column>
+ <stretch/>
+ </row>
+ </tab>
+ <tab label="Options">
+ <row>
+ <radio id="method" label="Method">
+ <text>Method to be used to separate coincident points</text>
+ <option value="overplot" label="Overplot (Default)"/>
+ <option value="jitter" label="jitter"/>
+ <option value="stack" label="stack"/>
+ </radio>
+ <spinbox label="Jitter" id="jitter" initial="0.1" />
+ <spinbox label="offset" id="offset" initial="0.33333333333" />
+ <radio id="vertical" label="Orientation">
+ <option value="FALSE" label="Horizontal"/>
+ <option value="TRUE" label="Vertical"/>
+ </radio>
+ <stretch/>
+ </row>
+ </tab>
+ <tab label="Plot Options" >
+ <row>
+ <embed id="plotoptions" component="rkward::plot_options" as_button="false" label="Plot Options" />
+ <stretch/>
+ </row>
+ </tab>
+ </tabbook>
+ </dialog>
+</document>
Modified: trunk/rkward/rkward/plugins/plots.pluginmap
===================================================================
--- trunk/rkward/rkward/plugins/plots.pluginmap 2006-12-30 21:56:34 UTC (rev 1016)
+++ trunk/rkward/rkward/plugins/plots.pluginmap 2006-12-30 23:33:11 UTC (rev 1017)
@@ -3,17 +3,20 @@
<document base_prefix="plots/" namespace="rkward">
<components>
<component type="standard" id="box_plot" file="box_plot.xml" label="Box Plot" />
+ <component type="standard" id="density_plot" file="density_plot.xml" label="Density Plot" />
<component type="standard" id="ecdf_plot" file="ecdf_plot.xml" label="ECDF Plot" />
<component type="standard" id="histogram" file="histogram.xml" label="Histogram" />
-
+ <component type="standard" id="stripchart" file="stripchart_plot.xml" label="Stripchart" />
</components>
<hierarchy>
<menu id="plots" label="Plots" index="5">
<entry component="box_plot" />
+ <entry component="density_plot" />
<entry component="ecdf_plot" />
<entry component="histogram" />
+ <entry component="stripchart" />
</menu>
</hierarchy>
</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