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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Wed Mar 21 23:35:30 UTC 2007


Revision: 1695
          http://svn.sourceforge.net/rkward/?rev=1695&view=rev
Author:   tfry
Date:     2007-03-21 16:35:29 -0700 (Wed, 21 Mar 2007)

Log Message:
-----------
Some touchups to bonett, agostino, and ansombe:
* Move length and NA out of the try block. This allows them to be shown, even if the test fails
* Make showing NAs the default. I think showing length but not NAs may be misleading, and so should not be the default setting
* Change option labels for 'alternative' to just 'two-sided', 'greater', 'less'. The old labels were not technically correct
* Add an option to turn off the display of verbose alternative hypothesis for each var
* Add a stretch on the second tab to make layout look better

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/analysis/moments/agostino_test.php
    trunk/rkward/rkward/plugins/analysis/moments/agostino_test.rkh
    trunk/rkward/rkward/plugins/analysis/moments/agostino_test.xml
    trunk/rkward/rkward/plugins/analysis/moments/anscombe_test.php
    trunk/rkward/rkward/plugins/analysis/moments/anscombe_test.rkh
    trunk/rkward/rkward/plugins/analysis/moments/anscombe_test.xml
    trunk/rkward/rkward/plugins/analysis/moments/bonett_test.php
    trunk/rkward/rkward/plugins/analysis/moments/bonett_test.rkh
    trunk/rkward/rkward/plugins/analysis/moments/bonett_test.xml

Modified: trunk/rkward/rkward/plugins/analysis/moments/agostino_test.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/moments/agostino_test.php	2007-03-21 21:12:08 UTC (rev 1694)
+++ trunk/rkward/rkward/plugins/analysis/moments/agostino_test.php	2007-03-21 23:35:29 UTC (rev 1695)
@@ -5,7 +5,9 @@
 }
 
 function calculate () {
-	$vars = "substitute (" . str_replace ("\n", "), substitute (", trim (getRK_val ("x"))) . ")";
+	global $alternative;
+
+	$vars = "substitute (" . str_replace ("\n", "), substitute (", trim (getRK_val ("x"))) . ")";	$alternative = getRK_val ("alternative");
 ?>
 
 vars <- list (<? echo ($vars); ?>)
@@ -16,28 +18,31 @@
 	var <- eval (vars[[i]], envir=globalenv ())
 	results[i, 'Error'] <- tryCatch ({
 		# This is the core of the calculation
-		t <- agostino.test (var, alternative = "<? getRK ("alternative"); ?>")
+		t <- agostino.test (var, alternative = "<? echo ($alternative); ?>")
 		results[i, 'skewness estimator (skew)'] <- t$statistic["skew"]
 		results[i, 'transformation (z)'] <- t$statistic["z"]
 		results[i, 'p-value'] <- t$p.value
-		results[i, 'Alternative Hypothesis']<- rk.describe.alternative (t)
+<? 	if (getRK_val ("show_alternative")) { ?>
+		results[i, 'Alternative Hypothesis'] <- rk.describe.alternative (t)
+<?	} ?>
+		NA				# no error
+	}, error=function (e) e$message)	# catch any errors
 <?	if (getRK_val ("length")) { ?>
-		results[i, 'Length'] <- length (var)
+	results[i, 'Length'] <- length (var)
 <?	}
 	if (getRK_val ("nacount")) { ?>
-		results[i, 'NAs'] <- length (which(is.na(var)))
+	results[i, 'NAs'] <- length (which(is.na(var)))
 <? 	} ?>
-		NA				# no error
-	}, error=function (e) e$message)	# catch any errors
 }
 if (all (is.na (results$'Error'))) results$'Error' <- NULL
 <?
 }
 
 function printout () {
+	global $alternative;
 ?>
 rk.header ("D'Agostino test of skewness",
-	parameters=list ("Alternative Hypothesis", "<? getRK ("alternative"); ?>"))
+	parameters=list ("Alternative Hypothesis", "<? echo ($alternative); ?>"))
 rk.results (results)
 <?
 }

Modified: trunk/rkward/rkward/plugins/analysis/moments/agostino_test.rkh
===================================================================
--- trunk/rkward/rkward/plugins/analysis/moments/agostino_test.rkh	2007-03-21 21:12:08 UTC (rev 1694)
+++ trunk/rkward/rkward/plugins/analysis/moments/agostino_test.rkh	2007-03-21 23:35:29 UTC (rev 1695)
@@ -15,6 +15,7 @@
 		<caption id="tab_options"/>
 		<setting id="length">If checked, the length of the data vectors will be shown. However, this will not effect your results but is just an optional information.</setting>
 		<setting id="nacount">If checked, and in case of missing values this will show you the number of those. However, this will not effect your results but is just an optional information.</setting>
+		<setting id="show_alternative">If checked, a verbose description of the alternative hypothesis will be shown along with the results</setting>
 	</settings>
 	<related>
 		<ul>

Modified: trunk/rkward/rkward/plugins/analysis/moments/agostino_test.xml
===================================================================
--- trunk/rkward/rkward/plugins/analysis/moments/agostino_test.xml	2007-03-21 21:12:08 UTC (rev 1694)
+++ trunk/rkward/rkward/plugins/analysis/moments/agostino_test.xml	2007-03-21 23:35:29 UTC (rev 1695)
@@ -14,15 +14,17 @@
 						<varslot type="numeric" id="x" multi="true" source="vars" required="true" label="variable(s):"/>
 						<radio id="alternative" label="using test hypothesis">
 							<option value="two.sided" label="Two-sided"/>
-							<option value="greater" label="First is greater"/>
-							<option value="less" label="Second is greater"/>
+							<option value="greater" label="greater"/>
+							<option value="less" label="less"/>
 						</radio>
 					</column>
 				</row>
 			</tab>
 			<tab id="tab_options" 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" />
+				<checkbox id="nacount" label="Show Missing Values" value_unchecked="0" value="1" checked="true" />
+				<checkbox id="show_alternative" label="Verbose alternative hypothesis" value_unchecked="0" value="1" checked="true"/>
+				<stretch/>
 			</tab>
 		</tabbook>
 	</dialog>

Modified: trunk/rkward/rkward/plugins/analysis/moments/anscombe_test.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/moments/anscombe_test.php	2007-03-21 21:12:08 UTC (rev 1694)
+++ trunk/rkward/rkward/plugins/analysis/moments/anscombe_test.php	2007-03-21 23:35:29 UTC (rev 1695)
@@ -5,8 +5,10 @@
 }
 
 function calculate () {
+	global $alternative;
+
 	$vars = "substitute (" . str_replace ("\n", "), substitute (", trim (getRK_val ("x"))) . ")";
-
+	$alternative = getRK_val ("alternative");
 ?>
 vars <- list (<? echo ($vars); ?>)
 results <- data.frame ('Variable Name'=rep (NA, length (vars)), check.names=FALSE)
@@ -15,28 +17,31 @@
 	results[i, 'Variable Name'] <- rk.get.description (vars[[i]], is.substitute=TRUE)
 	var <- eval (vars[[i]], envir=globalenv ())
 	results[i, 'Error'] <- tryCatch ({
-		t <- anscombe.test (var, alternative = "<? getRK ("alternative"); ?>")
+		t <- anscombe.test (var, alternative = "<? echo ($alternative); ?>")
 		results[i, 'Kurtosis estimator (tau)'] <- t$statistic["kurt"]
 		results[i, 'Transformation (z)'] <- t$statistic["z"]
 		results[i, 'p-value'] <- t$p.value
-		results[i, 'Alternative Hypothesis']<- rk.describe.alternative (t)
+<? 	if (getRK_val ("show_alternative")) { ?>
+		results[i, 'Alternative Hypothesis'] <- rk.describe.alternative (t)
+<?	} ?>
+		NA				# no error
+	}, error=function (e) e$message)	# catch any errors
 <?	if (getRK_val ("length")) { ?>
-		results[i, 'Length'] <- length (var)
+	results[i, 'Length'] <- length (var)
 <?	}
 	if (getRK_val ("nacount")) { ?>
-		results[i, 'NAs'] <- length (which(is.na(var)))
+	results[i, 'NAs'] <- length (which(is.na(var)))
 <? 	} ?>
-		NA				# no error
-	}, error=function (e) e$message)	# catch any errors
 }
 if (all (is.na (results$'Error'))) results$'Error' <- NULL
 <?
 }
 
 function printout () {
+	global $alternative;
 ?>
 rk.header ("Anscombe-Glynn test of kurtosis",
-	parameters=list ("Alternative Hypothesis", "<? getRK ("alternative"); ?>"))
+	parameters=list ("Alternative Hypothesis", "<? echo ($alternative); ?>"))
 rk.results (results)
 <?
 }

Modified: trunk/rkward/rkward/plugins/analysis/moments/anscombe_test.rkh
===================================================================
--- trunk/rkward/rkward/plugins/analysis/moments/anscombe_test.rkh	2007-03-21 21:12:08 UTC (rev 1694)
+++ trunk/rkward/rkward/plugins/analysis/moments/anscombe_test.rkh	2007-03-21 23:35:29 UTC (rev 1695)
@@ -15,6 +15,7 @@
 		<caption id="tab_options"/>
 		<setting id="length">If checked, the length of the data vectors will be shown. However, this will not effect your results but is just an optional information.</setting>
 		<setting id="nacount">If checked, and in case of missing values this will show you the number of those. However, this will not effect your results but is just an optional information.</setting>
+		<setting id="show_alternative">If checked, a verbose description of the alternative hypothesis will be shown along with the results</setting>
 	</settings>
 	<related>
 		<ul>

Modified: trunk/rkward/rkward/plugins/analysis/moments/anscombe_test.xml
===================================================================
--- trunk/rkward/rkward/plugins/analysis/moments/anscombe_test.xml	2007-03-21 21:12:08 UTC (rev 1694)
+++ trunk/rkward/rkward/plugins/analysis/moments/anscombe_test.xml	2007-03-21 23:35:29 UTC (rev 1695)
@@ -14,15 +14,17 @@
 						<varslot type="numeric" id="x" multi="true" source="vars" required="true" label="variable(s):"/>
 						<radio id="alternative" label="using test hypothesis">
 							<option value="two.sided" label="Two-sided"/>
-							<option value="greater" label="First is greater"/>
-							<option value="less" label="Second is greater"/>
+							<option value="greater" label="greater"/>
+							<option value="less" label="less"/>
 						</radio>
 					</column>
 				</row>
 			</tab>
 			<tab id="tab_options" 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" />
+				<checkbox id="nacount" label="Show Missing Values" value_unchecked="0" value="1" checked="true" />
+				<checkbox id="show_alternative" label="Verbose alternative hypothesis" value_unchecked="0" value="1" checked="true"/>
+				<stretch/>
 			</tab>
 		</tabbook>
 	</dialog>

Modified: trunk/rkward/rkward/plugins/analysis/moments/bonett_test.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/moments/bonett_test.php	2007-03-21 21:12:08 UTC (rev 1694)
+++ trunk/rkward/rkward/plugins/analysis/moments/bonett_test.php	2007-03-21 23:35:29 UTC (rev 1695)
@@ -5,8 +5,10 @@
 <?}
 
 function calculate () {
+	global $alternative;
+
 	$vars = "substitute (" . str_replace ("\n", "), substitute (", trim (getRK_val ("x"))) . ")";
-
+	$alternative = getRK_val ("alternative");
 ?>
 
 vars <- list (<? echo ($vars); ?>)
@@ -16,28 +18,31 @@
 	results[i, 'Variable Name'] <- rk.get.description (vars[[i]], is.substitute=TRUE)
 	var <- eval (vars[[i]], envir=globalenv ())
 	results[i, 'Error'] <- tryCatch ({
-		t <- bonett.test (var, alternative = "<? getRK ("alternative"); ?>")
+		t <- bonett.test (var, alternative = "<? echo ($alternative); ?>")
 		results[i, 'Kurtosis estimator (tau)'] <- t$statistic["tau"]
 		results[i, 'Transformation (z)'] <- t$statistic["z"]
 		results[i, 'p-value'] <- t$p.value
-		results[i, 'Alternative Hypothesis']<- rk.describe.alternative (t)
+<? 	if (getRK_val ("show_alternative")) { ?>
+		results[i, 'Alternative Hypothesis'] <- rk.describe.alternative (t)
+<?	} ?>
+		NA				# no error
+	}, error=function (e) e$message)	# catch any errors
 <?	if (getRK_val ("length")) { ?>
 		results[i, 'Length'] <- length (var)
 <?	}
 	if (getRK_val ("nacount")) { ?>
 		results[i, 'NAs'] <- length (which(is.na(var)))
 <? 	} ?>
-		NA				# no error
-	}, error=function (e) e$message)	# catch any errors
 }
 if (all (is.na (results$'Error'))) results$'Error' <- NULL
 <?
 }
 
 function printout () {
+	global $alternative;
 ?>
 rk.header ("Bonett-Seier test of Geary's kurtosis",
-	parameters=list ("Alternative Hypothesis", "<? getRK ("alternative"); ?>"))
+	parameters=list ("Alternative Hypothesis", "<? echo ($alternative); ?>"))
 rk.results (results)
 <?
 }

Modified: trunk/rkward/rkward/plugins/analysis/moments/bonett_test.rkh
===================================================================
--- trunk/rkward/rkward/plugins/analysis/moments/bonett_test.rkh	2007-03-21 21:12:08 UTC (rev 1694)
+++ trunk/rkward/rkward/plugins/analysis/moments/bonett_test.rkh	2007-03-21 23:35:29 UTC (rev 1695)
@@ -15,6 +15,7 @@
 		<caption id="tab_options"/>
 		<setting id="length">If checked, the length of the data vectors will be shown. However, this will not effect your results but is just an optional information.</setting>
 		<setting id="nacount">If checked, and in case of missing values this will show you the number of those. However, this will not effect your results but is just an optional information.</setting>
+		<setting id="show_alternative">If checked, a verbose description of the alternative hypothesis will be shown along with the results</setting>
 	</settings>
 	<related>
 		<ul>

Modified: trunk/rkward/rkward/plugins/analysis/moments/bonett_test.xml
===================================================================
--- trunk/rkward/rkward/plugins/analysis/moments/bonett_test.xml	2007-03-21 21:12:08 UTC (rev 1694)
+++ trunk/rkward/rkward/plugins/analysis/moments/bonett_test.xml	2007-03-21 23:35:29 UTC (rev 1695)
@@ -14,15 +14,17 @@
 						<varslot type="numeric" id="x" multi="true" source="vars" required="true" label="variable(s):"/>
 						<radio id="alternative" label="using test hypothesis">
 							<option value="two.sided" label="Two-sided"/>
-							<option value="greater" label="First is greater"/>
-							<option value="less" label="Second is greater"/>
+							<option value="greater" label="greater"/>
+							<option value="less" label="less"/>
 						</radio>
 					</column>
 				</row>
 			</tab>
 			<tab label="Options" id="tab_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" />
+				<checkbox id="nacount" label="Show Missing Values" value_unchecked="0" value="1" checked="true" />
+				<checkbox id="show_alternative" label="Verbose alternative hypothesis" value_unchecked="0" value="1" checked="true"/>
+				<stretch/>
 			</tab>
 		</tabbook>
 	</dialog>


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