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

sjar at users.sourceforge.net sjar at users.sourceforge.net
Sun Dec 31 15:36:29 UTC 2006


Revision: 1020
          http://svn.sourceforge.net/rkward/?rev=1020&view=rev
Author:   sjar
Date:     2006-12-31 07:36:28 -0800 (Sun, 31 Dec 2006)

Log Message:
-----------
initial support for D'Agostino test for skewness in normally distributed data and adopted distributio.plug-in map

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/distributions.pluginmap

Added Paths:
-----------
    trunk/rkward/rkward/plugins/distributions/agostino_test.php
    trunk/rkward/rkward/plugins/distributions/agostino_test.xml

Added: trunk/rkward/rkward/plugins/distributions/agostino_test.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/agostino_test.php	                        (rev 0)
+++ trunk/rkward/rkward/plugins/distributions/agostino_test.php	2006-12-31 15:36:28 UTC (rev 1020)
@@ -0,0 +1,63 @@
+<?
+        function preprocess () {
+        }
+
+	function calculate () {
+	$vars = "substitute (" . str_replace ("\n", "), substitute (", trim (getRK_val ("x"))) . ")";
+
+?>	
+
+	require(moments)	
+
+	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]]$agostino <- agostino.test (eval (var), alternative = c("<? getRK ("alternative"); ?>"))
+	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>D'Agostino test for skewness in normally distributed data</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>Skewness and Transformation</td>")
+			cat ("<td>p-value</td>")
+			cat ("<td>alternative</td>")
+			cat ("<td>Method</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]]$agostino,"</td>"))
+		cat ("</tr>")
+}
+	cat ("</tbody>")
+cat ("</table>")
+
+
+<?
+        }
+	function cleanup () {
+
+?>
+	rm (rk.temp.results)
+	rm (rk.temp.options)
+	rm (var)
+<?
+        }
+?>
\ No newline at end of file


Property changes on: trunk/rkward/rkward/plugins/distributions/agostino_test.php
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/rkward/rkward/plugins/distributions/agostino_test.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/agostino_test.xml	                        (rev 0)
+++ trunk/rkward/rkward/plugins/distributions/agostino_test.xml	2006-12-31 15:36:28 UTC (rev 1020)
@@ -0,0 +1,33 @@
+<!DOCTYPE rkplugin>
+
+<!-- This is the D'Agostino test for skewness in normally distributed data -->
+
+<document>
+	<code file="agostino_test.php"/>
+	<dialog label="D'Agostino test for skewness in normally distributed data">
+		<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">
+				<radio id="alternative" label="alternative hypothesis">
+					<option value="two.sided" label="two sided (default)" />
+					<option value="less" label="less" />
+					<option value="greater" label="greater" />
+				</radio>
+				<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/agostino_test.xml
___________________________________________________________________
Name: svn:executable
   + *

Modified: trunk/rkward/rkward/plugins/distributions.pluginmap
===================================================================
--- trunk/rkward/rkward/plugins/distributions.pluginmap	2006-12-31 00:04:35 UTC (rev 1019)
+++ trunk/rkward/rkward/plugins/distributions.pluginmap	2006-12-31 15:36:28 UTC (rev 1020)
@@ -9,6 +9,7 @@
 		<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="agostino_test" file="agostino_test.xml" label="D'Agostino 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" />
@@ -79,13 +80,14 @@
 
 	<hierarchy>
 		<menu id="distributions" label="Distributions" index="7">
-			<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 id="distribution_analysis" label="Distribution Analysis" index="0">
+				<entry component="agostino_test" label="D'Agostino test" index="0"/>
+				<entry component="ad_test" label="Anderson-Darling Normality Test" index="1"/>
+				<entry component="cvm_test" label="Cramer-von Mises Normality Test" index="2"/>
+				<entry component="lillie_test" label="Lilliefors (Kolmogorov-Smirnov) Normality Test" index="3"/>
+				<entry component="pearson_test" label="Pearson chi-square Normality Test" index="4"/>
+				<entry component="sf_test" label="Shapiro-Francia Normality Test" index="5"/>
+				<entry component="shapiro_test" label="Shapiro-Wilk Normality Test" index="6"/>
 			</menu>
 			<menu id="univariate_continuous_distributions" label="Univariate continuous distributions" index="1">
 				<menu id="beta_distribution" label="Beta Distribution" index="0">


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