[rkward-cvs] SF.net SVN: rkward: [1495] trunk/rkward/rkward/plugins/analysis/moments

tfry at users.sourceforge.net tfry at users.sourceforge.net
Tue Feb 27 14:35:25 UTC 2007


Revision: 1495
          http://svn.sourceforge.net/rkward/?rev=1495&view=rev
Author:   tfry
Date:     2007-02-27 06:35:24 -0800 (Tue, 27 Feb 2007)

Log Message:
-----------
Additionally print excess kurtosis to avoid confusion.
Simplified to specify NA removal only once, globally

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/analysis/moments/skewness_kurtosis_test.php
    trunk/rkward/rkward/plugins/analysis/moments/skewness_kurtosis_test.xml

Modified: trunk/rkward/rkward/plugins/analysis/moments/skewness_kurtosis_test.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/moments/skewness_kurtosis_test.php	2007-02-27 00:34:46 UTC (rev 1494)
+++ trunk/rkward/rkward/plugins/analysis/moments/skewness_kurtosis_test.php	2007-02-27 14:35:24 UTC (rev 1495)
@@ -1,13 +1,15 @@
 <?
-        function preprocess () {
-        }
+function preprocess () { ?>
+require(moments)
+<?
+}
 
-	function calculate () {
+function calculate () {
 	$vars = "substitute (" . str_replace ("\n", "), substitute (", trim (getRK_val ("x"))) . ")";
+	if (getRK_val ("narm")) $narm = ", na.rm=TRUE";
+	else $narm = ", na.rm=FALSE"
 
 ?>
-require(moments)
-
 rk.temp.objects <- list (<? echo ($vars); ?>)
 rk.temp.results <- data.frame ('Variable Name'=rep (NA, length (rk.temp.objects)), check.names=FALSE)
 i=0;
@@ -16,13 +18,16 @@
 	rk.temp.results$'Variable Name'[i] <- rk.get.description (var, is.substitute=TRUE)
 	<? 
 	if (getRK_val ("skewness")) { ?>
-	try (rk.temp.results$'Skewness'[i] <- skewness (eval (var), <? getRK ("narm_skewness"); ?>))
+	try (rk.temp.results$'Skewness'[i] <- skewness (eval (var)<? echo ($narm); ?>))
 	<? }
 	if (getRK_val ("kurtosis")) { ?>
-	try (rk.temp.results$'Kurtosis'[i] <- kurtosis (eval (var), <? getRK ("narm_kurtosis"); ?>))
+	try ({
+		rk.temp.results$'Kurtosis'[i] <- kurtosis (eval (var)<? echo ($narm); ?>)
+		rk.temp.results$'Excess Kurtosis'[i] <- rk.temp.results$'Kurtosis'[i] - 3
+	})
 	<? }
 	if (getRK_val ("geary")) { ?>
-	try (rk.temp.results$'Geary kurtosis'[i] <- geary (eval (var), <? getRK ("narm_geary_kurtosis"); ?>))
+	try (rk.temp.results$'Geary kurtosis'[i] <- geary (eval (var)<? echo ($narm); ?>))
 	<? }
 	if (getRK_val ("length")) { ?>
 	try (rk.temp.results$'Length'[i] <- length (eval (var)))
@@ -32,19 +37,19 @@
 	<? } ?>
 }
 <?
-        }
-	function printout () {
+}
+function printout () {
 ?>
 rk.header ("Skewness and Kurtosis")
 rk.results (rk.temp.results)
 <?
-        }
-	function cleanup () {
+}
 
+function cleanup () {
 ?>
-	rm (rk.temp.results)
-	rm (rk.temp.objects)
-	rm (var)
+rm (rk.temp.results)
+rm (rk.temp.objects)
+rm (var)
 <?
-        }
+       }
 ?>
\ No newline at end of file

Modified: trunk/rkward/rkward/plugins/analysis/moments/skewness_kurtosis_test.xml
===================================================================
--- trunk/rkward/rkward/plugins/analysis/moments/skewness_kurtosis_test.xml	2007-02-27 00:34:46 UTC (rev 1494)
+++ trunk/rkward/rkward/plugins/analysis/moments/skewness_kurtosis_test.xml	2007-02-27 14:35:24 UTC (rev 1495)
@@ -21,26 +21,15 @@
 				</row>
 			</tab>
 			<tab label="Options" id="tab_options">
+				<checkbox id="narm" label="Exclude missing values" checked="true" value="1" value_unchecked="0" />
 				<frame label="Skewness">
 					<checkbox id="skewness" label="Skewness" value_unchecked="0" value="1" checked="true" />
-					<radio id="narm_skewness" label="Remove missing values for Skewness calculation">
-						<option value="na.rm = FALSE" label="No (FALSE)"/>
-						<option value="na.rm = TRUE" label="Yes (TRUE)"/>
-					</radio>
 				</frame>
 				<frame label="Kurtosis">
 					<checkbox id="kurtosis" label="Kurtosis" value_unchecked="0" value="1" checked="true" />
-					<radio id="narm_kurtosis" label="Remove missing values for Kurtosis calculation">
-						<option value="na.rm = FALSE" label="No (FALSE)"/>
-						<option value="na.rm = TRUE" label="Yes (TRUE)"/>
-					</radio>
 				</frame>
 				<frame label="Geary's kurtosis">
 					<checkbox id="geary" label="Geary's kurtosis" value_unchecked="0" value="1" checked="false" />
-					<radio id="narm_geary_kurtosis" label="Remove missing values for Geary's kurtosis calculation">
-						<option value="na.rm = FALSE" label="No (FALSE)"/>
-						<option value="na.rm = TRUE" label="Yes (TRUE)"/>
-					</radio>
 				</frame>
 				<checkbox id="length" label="Show Length" value_unchecked="0" value="1" checked="false" />
 				<checkbox id="nacount" label="Show Missing Values" value_unchecked="0" value="1" checked="false" />


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