[rkward-cvs] SF.net SVN: rkward: [1725] trunk/rkward/rkward/plugins/analysis/outliers

tfry at users.sourceforge.net tfry at users.sourceforge.net
Sun Mar 25 22:16:59 UTC 2007


Revision: 1725
          http://svn.sourceforge.net/rkward/?rev=1725&view=rev
Author:   tfry
Date:     2007-03-25 15:16:58 -0700 (Sun, 25 Mar 2007)

Log Message:
-----------
NA handling

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/analysis/outliers/chisq_out_test.php
    trunk/rkward/rkward/plugins/analysis/outliers/chisq_out_test.rkh
    trunk/rkward/rkward/plugins/analysis/outliers/chisq_out_test.xml
    trunk/rkward/rkward/plugins/analysis/outliers/dixon_test.php
    trunk/rkward/rkward/plugins/analysis/outliers/dixon_test.rkh
    trunk/rkward/rkward/plugins/analysis/outliers/dixon_test.xml
    trunk/rkward/rkward/plugins/analysis/outliers/grubbs_test.php
    trunk/rkward/rkward/plugins/analysis/outliers/grubbs_test.rkh
    trunk/rkward/rkward/plugins/analysis/outliers/grubbs_test.xml
    trunk/rkward/rkward/plugins/analysis/outliers/outlier.php
    trunk/rkward/rkward/plugins/analysis/outliers/outlier.rkh
    trunk/rkward/rkward/plugins/analysis/outliers/outlier.xml

Modified: trunk/rkward/rkward/plugins/analysis/outliers/chisq_out_test.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/outliers/chisq_out_test.php	2007-03-25 21:55:37 UTC (rev 1724)
+++ trunk/rkward/rkward/plugins/analysis/outliers/chisq_out_test.php	2007-03-25 22:16:58 UTC (rev 1725)
@@ -12,9 +12,17 @@
 results <- data.frame ('Variable Name'=rep (NA, length (vars)), check.names=FALSE)
 for (i in 1:length(vars)) {
 	results[i, 'Variable Name'] <- rk.get.description (vars[[i]], is.substitute=TRUE)
-	var <- na.omit(eval (vars[[i]], envir=globalenv ()))
-	# var_w_na is similiar to var but NAs are not removed
-	var_w_na <- eval (vars[[i]], envir=globalenv ())
+<?	if (getRK_val ("length")) { ?>
+	var <- eval (vars[[i]], envir=globalenv ())
+
+	results[i, 'Length'] <- length (var)
+	results[i, 'NAs'] <- sum (is.na(var))
+
+	var <- na.omit (var) 	# omit NAs for all further calculations
+<? 	} else { ?>
+	var <- eval (vars[[i]], envir=globalenv ())
+<?	} ?>
+
 	results[i, 'Error'] <- tryCatch ({
 		# This is the core of the calculation
 		t <- chisq.out.test (var, opposite = <? getRK ("opposite"); ?>, variance = var (var))
@@ -24,25 +32,19 @@
 		results[i, 'Variance'] <- var (var)
 <?	if (getRK_val ("mean")) { ?>
 		results[i, 'Mean'] <- mean (var)
-<?	} ?>
-<?	if (getRK_val ("sd")) { ?>
+<?	}
+	if (getRK_val ("sd")) { ?>
 		results[i, 'Standard Deviation'] <-  sd (var)
-<?	} ?>
-<?	if (getRK_val ("median")) { ?>
+<?	}
+	if (getRK_val ("median")) { ?>
 		results[i, 'Median'] <- median (var)
-<?	} ?>
-<?	if (getRK_val ("min")) { ?>
+<?	}
+	if (getRK_val ("min")) { ?>
 		results[i, 'Minimum'] <- min (var)
-<?	} ?>
-<?	if (getRK_val ("max")) { ?>
+<?	}
+	if (getRK_val ("max")) { ?>
 		results[i, 'Maximum'] <- max (var)
 <?	} ?>
-<?	if (getRK_val ("length")) { ?>
-		results[i, 'Length'] <- length (var)
-<?	}
-	if (getRK_val ("nacount")) { ?>
-		results[i, 'NAs'] <- length (which(is.na(var_w_na)))
-<? 	} ?>
 		NA				# no error
 	}, error=function (e) e$message)	# catch any errors
 }

Modified: trunk/rkward/rkward/plugins/analysis/outliers/chisq_out_test.rkh
===================================================================
--- trunk/rkward/rkward/plugins/analysis/outliers/chisq_out_test.rkh	2007-03-25 21:55:37 UTC (rev 1724)
+++ trunk/rkward/rkward/plugins/analysis/outliers/chisq_out_test.rkh	2007-03-25 22:16:58 UTC (rev 1725)
@@ -18,8 +18,7 @@
 		<setting id="median">If checked this will calculate you the median (regardless of missing values) is an additional out put. However, this will not effect your results but is just an optional information.</setting>
 		<setting id="min">If checked this will calculate you the minimum (regardless of missing values) is an additional out put. However, this will not effect your results but is just an optional information.</setting>
 		<setting id="max">If checked this will calculate you the maximum (regardless of missing values) is an additional out put. However, this will not effect your results but is just an optional information.</setting>
-		<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="length">Show the total length of the data, and the number of missing values (purely informational, does not affect the test)?</setting>
 	</settings>
 	<related>
 		<ul>

Modified: trunk/rkward/rkward/plugins/analysis/outliers/chisq_out_test.xml
===================================================================
--- trunk/rkward/rkward/plugins/analysis/outliers/chisq_out_test.xml	2007-03-25 21:55:37 UTC (rev 1724)
+++ trunk/rkward/rkward/plugins/analysis/outliers/chisq_out_test.xml	2007-03-25 22:16:58 UTC (rev 1725)
@@ -29,8 +29,7 @@
 						<column>
 							<checkbox id="min" label="Show Minimum" value_unchecked="0" value="1" checked="false" />
 							<checkbox id="max" label="Show Maximum" value_unchecked="0" value="1" checked="false" />
-							<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="true" />
+							<checkbox id="length" label="Show Length and NAs" value_unchecked="0" value="1" checked="true" />
 						</column>
 						<stretch/>
 					</row>

Modified: trunk/rkward/rkward/plugins/analysis/outliers/dixon_test.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/outliers/dixon_test.php	2007-03-25 21:55:37 UTC (rev 1724)
+++ trunk/rkward/rkward/plugins/analysis/outliers/dixon_test.php	2007-03-25 22:16:58 UTC (rev 1725)
@@ -12,9 +12,17 @@
 results <- data.frame ('Variable Name'=rep (NA, length (vars)), check.names=FALSE)
 for (i in 1:length(vars)) {
 	results[i, 'Variable Name'] <- rk.get.description (vars[[i]], is.substitute=TRUE)
-	var <- na.omit(eval (vars[[i]], envir=globalenv ()))
-	# var_w_na is similiar to var but NAs are not removed
-	var_w_na <- eval (vars[[i]], envir=globalenv ())
+<?	if (getRK_val ("length")) { ?>
+	var <- eval (vars[[i]], envir=globalenv ())
+
+	results[i, 'Length'] <- length (var)
+	results[i, 'NAs'] <- sum (is.na(var))
+
+	var <- na.omit (var) 	# omit NAs for all further calculations
+<? 	} else { ?>
+	var <- eval (vars[[i]], envir=globalenv ())
+<?	} ?>
+
 	results[i, 'Error'] <- tryCatch ({
 		# This is the core of the calculation
 		t <- dixon.test (var, type = <? getRK ("type"); ?>, opposite = <? getRK ("opposite"); ?>, two.sided = <? getRK ("two_sided"); ?>)
@@ -23,25 +31,19 @@
 		results[i, 'Alternative Hypothesis']<- rk.describe.alternative (t)
 <?	if (getRK_val ("mean")) { ?>
 		results[i, 'Mean'] <- mean (var)
-<?	} ?>
-<?	if (getRK_val ("sd")) { ?>
+<?	}
+	if (getRK_val ("sd")) { ?>
 		results[i, 'Standard Deviation'] <-  sd (var)
-<?	} ?>
-<?	if (getRK_val ("median")) { ?>
+<?	}
+	if (getRK_val ("median")) { ?>
 		results[i, 'Median'] <- median (var)
-<?	} ?>
-<?	if (getRK_val ("min")) { ?>
+<?	}
+	if (getRK_val ("min")) { ?>
 		results[i, 'Minimum'] <- min (var)
-<?	} ?>
-<?	if (getRK_val ("max")) { ?>
+<?	}
+	if (getRK_val ("max")) { ?>
 		results[i, 'Maximum'] <- max (var)
 <?	} ?>
-<?	if (getRK_val ("length")) { ?>
-		results[i, 'Length'] <- length (var)
-<?	}
-	if (getRK_val ("nacount")) { ?>
-		results[i, 'NAs'] <- length (which(is.na(var_w_na)))
-<? 	} ?>
 		NA				# no error
 	}, error=function (e) e$message)	# catch any errors
 }

Modified: trunk/rkward/rkward/plugins/analysis/outliers/dixon_test.rkh
===================================================================
--- trunk/rkward/rkward/plugins/analysis/outliers/dixon_test.rkh	2007-03-25 21:55:37 UTC (rev 1724)
+++ trunk/rkward/rkward/plugins/analysis/outliers/dixon_test.rkh	2007-03-25 22:16:58 UTC (rev 1725)
@@ -20,8 +20,7 @@
 		<setting id="median">If checked this will calculate you the median (regardless of missing values) is an additional out put. However, this will not effect your results but is just an optional information.</setting>
 		<setting id="min">If checked this will calculate you the minimum (regardless of missing values) is an additional out put. However, this will not effect your results but is just an optional information.</setting>
 		<setting id="max">If checked this will calculate you the maximum (regardless of missing values) is an additional out put. However, this will not effect your results but is just an optional information.</setting>
-		<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="length"Show the total length of the data, and the number of missing values (purely informational, does not affect the test)?</setting>
 	</settings>
 	<related>
 		<ul>

Modified: trunk/rkward/rkward/plugins/analysis/outliers/dixon_test.xml
===================================================================
--- trunk/rkward/rkward/plugins/analysis/outliers/dixon_test.xml	2007-03-25 21:55:37 UTC (rev 1724)
+++ trunk/rkward/rkward/plugins/analysis/outliers/dixon_test.xml	2007-03-25 22:16:58 UTC (rev 1725)
@@ -40,8 +40,7 @@
 							<column>
 								<checkbox id="min" label="Show Minimum" value_unchecked="0" value="1" checked="false" />
 								<checkbox id="max" label="Show Maximum" value_unchecked="0" value="1" checked="false" />
-								<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="true" />
+								<checkbox id="length" label="Show Length and NAs" value_unchecked="0" value="1" checked="true" />
 							</column>
 							<stretch/>
 						</row>

Modified: trunk/rkward/rkward/plugins/analysis/outliers/grubbs_test.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/outliers/grubbs_test.php	2007-03-25 21:55:37 UTC (rev 1724)
+++ trunk/rkward/rkward/plugins/analysis/outliers/grubbs_test.php	2007-03-25 22:16:58 UTC (rev 1725)
@@ -12,9 +12,17 @@
 results <- data.frame ('Variable Name'=rep (NA, length (vars)), check.names=FALSE)
 for (i in 1:length(vars)) {
 	results[i, 'Variable Name'] <- rk.get.description (vars[[i]], is.substitute=TRUE)
-	var <- na.omit(eval (vars[[i]], envir=globalenv ()))
-	# var_w_na is similiar to var but NAs are not removed
-	var_w_na <- eval (vars[[i]], envir=globalenv ())
+<?	if (getRK_val ("length")) { ?>
+	var <- eval (vars[[i]], envir=globalenv ())
+
+	results[i, 'Length'] <- length (var)
+	results[i, 'NAs'] <- sum (is.na(var))
+
+	var <- na.omit (var) 	# omit NAs for all further calculations
+<? 	} else { ?>
+	var <- eval (vars[[i]], envir=globalenv ())
+<?	} ?>
+
 	results[i, 'Error'] <- tryCatch ({
 		# This is the core of the calculation
 		t <- grubbs.test (var, type = <? getRK ("type"); ?>, opposite = <? getRK ("opposite"); ?>, two.sided = <? getRK ("two_sided"); ?>)
@@ -24,25 +32,19 @@
 		results[i, 'Alternative Hypothesis']<- rk.describe.alternative (t)
 <?	if (getRK_val ("mean")) { ?>
 		results[i, 'Mean'] <- mean (var)
-<?	} ?>
-<?	if (getRK_val ("sd")) { ?>
+<?	}
+	if (getRK_val ("sd")) { ?>
 		results[i, 'Standard Deviation'] <-  sd (var)
-<?	} ?>
-<?	if (getRK_val ("median")) { ?>
+<?	}
+	if (getRK_val ("median")) { ?>
 		results[i, 'Median'] <- median (var)
-<?	} ?>
-<?	if (getRK_val ("min")) { ?>
+<?	}
+	if (getRK_val ("min")) { ?>
 		results[i, 'Minimum'] <- min (var)
-<?	} ?>
-<?	if (getRK_val ("max")) { ?>
+<?	}
+	if (getRK_val ("max")) { ?>
 		results[i, 'Maximum'] <- max (var)
 <?	} ?>
-<?	if (getRK_val ("length")) { ?>
-		results[i, 'Length'] <- length (var)
-<?	}
-	if (getRK_val ("nacount")) { ?>
-		results[i, 'NAs'] <- length (which(is.na(var_w_na)))
-<? 	} ?>
 		NA				# no error
 	}, error=function (e) e$message)	# catch any errors
 }

Modified: trunk/rkward/rkward/plugins/analysis/outliers/grubbs_test.rkh
===================================================================
--- trunk/rkward/rkward/plugins/analysis/outliers/grubbs_test.rkh	2007-03-25 21:55:37 UTC (rev 1724)
+++ trunk/rkward/rkward/plugins/analysis/outliers/grubbs_test.rkh	2007-03-25 22:16:58 UTC (rev 1725)
@@ -20,8 +20,7 @@
 		<setting id="median">If checked this will calculate you the median (regardless of missing values) is an additional out put. However, this will not effect your results but is just an optional information.</setting>
 		<setting id="min">If checked this will calculate you the minimum (regardless of missing values) is an additional out put. However, this will not effect your results but is just an optional information.</setting>
 		<setting id="max">If checked this will calculate you the maximum (regardless of missing values) is an additional out put. However, this will not effect your results but is just an optional information.</setting>
-		<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="length">Show the total length of the data, and the number of missing values (purely informational, does not affect the test)?</setting>
 	</settings>
 	<related>
 		<ul>

Modified: trunk/rkward/rkward/plugins/analysis/outliers/grubbs_test.xml
===================================================================
--- trunk/rkward/rkward/plugins/analysis/outliers/grubbs_test.xml	2007-03-25 21:55:37 UTC (rev 1724)
+++ trunk/rkward/rkward/plugins/analysis/outliers/grubbs_test.xml	2007-03-25 22:16:58 UTC (rev 1725)
@@ -36,8 +36,7 @@
 							<column>
 								<checkbox id="min" label="Show Minimum" value_unchecked="0" value="1" checked="false" />
 								<checkbox id="max" label="Show Maximum" value_unchecked="0" value="1" checked="false" />
-								<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="true" />
+								<checkbox id="length" label="Show Length and NAs" value_unchecked="0" value="1" checked="true" />
 							</column>
 							<stretch/>
 						</row>

Modified: trunk/rkward/rkward/plugins/analysis/outliers/outlier.php
===================================================================
--- trunk/rkward/rkward/plugins/analysis/outliers/outlier.php	2007-03-25 21:55:37 UTC (rev 1724)
+++ trunk/rkward/rkward/plugins/analysis/outliers/outlier.php	2007-03-25 22:16:58 UTC (rev 1725)
@@ -12,34 +12,36 @@
 results <- data.frame ('Variable Name'=rep (NA, length (vars)), check.names=FALSE)
 for (i in 1:length(vars)) {
 	results[i, 'Variable Name'] <- rk.get.description (vars[[i]], is.substitute=TRUE)
-	var <- na.omit(eval (vars[[i]], envir=globalenv ()))
-	# var_w_na is similiar to var but NAs are not removed
-	var_w_na <- eval (vars[[i]], envir=globalenv ())
+<?	if (getRK_val ("length")) { ?>
+	var <- eval (vars[[i]], envir=globalenv ())
+
+	results[i, 'Length'] <- length (var)
+	results[i, 'NAs'] <- sum (is.na(var))
+
+	var <- na.omit (var) 	# omit NAs for all further calculations
+<? 	} else { ?>
+	var <- eval (vars[[i]], envir=globalenv ())
+<?	} ?>
+
 	results[i, 'Error'] <- tryCatch ({
 		# This is the core of the calculation
 		t <- outlier (var, opposite = <? getRK ("opposite"); ?>)
 		results[i, 'Outlier'] <- t
 <?	if (getRK_val ("mean")) { ?>
 		results[i, 'Mean'] <- mean (var)
-<?	} ?>
-<?	if (getRK_val ("sd")) { ?>
+<?	}
+	if (getRK_val ("sd")) { ?>
 		results[i, 'Standard Deviation'] <-  sd (var)
-<?	} ?>
-<?	if (getRK_val ("median")) { ?>
+<?	}
+	if (getRK_val ("median")) { ?>
 		results[i, 'Median'] <- median (var)
-<?	} ?>
-<?	if (getRK_val ("min")) { ?>
+<?	}
+	if (getRK_val ("min")) { ?>
 		results[i, 'Minimum'] <- min (var)
-<?	} ?>
-<?	if (getRK_val ("max")) { ?>
+<?	}
+	if (getRK_val ("max")) { ?>
 		results[i, 'Maximum'] <- max (var)
 <?	} ?>
-<?	if (getRK_val ("length")) { ?>
-		results[i, 'Length'] <- length (var)
-<?	}
-	if (getRK_val ("nacount")) { ?>
-		results[i, 'NAs'] <- length (which(is.na(var_w_na)))
-<? 	} ?>
 		NA				# no error
 	}, error=function (e) e$message)	# catch any errors
 }

Modified: trunk/rkward/rkward/plugins/analysis/outliers/outlier.rkh
===================================================================
--- trunk/rkward/rkward/plugins/analysis/outliers/outlier.rkh	2007-03-25 21:55:37 UTC (rev 1724)
+++ trunk/rkward/rkward/plugins/analysis/outliers/outlier.rkh	2007-03-25 22:16:58 UTC (rev 1725)
@@ -18,8 +18,7 @@
 		<setting id="median">If checked this will calculate you the median (regardless of missing values) is an additional out put. However, this will not effect your results but is just an optional information.</setting>
 		<setting id="min">If checked this will calculate you the minimum (regardless of missing values) is an additional out put. However, this will not effect your results but is just an optional information.</setting>
 		<setting id="max">If checked this will calculate you the maximum (regardless of missing values) is an additional out put. However, this will not effect your results but is just an optional information.</setting>
-		<setting id="length">If checked, the length of the data vectors will be shown, including missing values (NAs). 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="length">Show the total length of the data, and the number of missing values (purely informational, does not affect the test)?</setting>
 	</settings>
 	<related>
 		<ul>

Modified: trunk/rkward/rkward/plugins/analysis/outliers/outlier.xml
===================================================================
--- trunk/rkward/rkward/plugins/analysis/outliers/outlier.xml	2007-03-25 21:55:37 UTC (rev 1724)
+++ trunk/rkward/rkward/plugins/analysis/outliers/outlier.xml	2007-03-25 22:16:58 UTC (rev 1725)
@@ -30,7 +30,6 @@
 							<checkbox id="min" label="Show Minimum" value_unchecked="0" value="1" checked="false" />
 							<checkbox id="max" label="Show Maximum" value_unchecked="0" value="1" checked="false" />
 							<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="true" />
 						</column>
 						<stretch/>
 					</row>


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