[rkward-cvs] [rkward] /: - Refactor distribution tests plugins, internally

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Sun Nov 23 20:11:44 UTC 2014


Git commit 87e98d3b42ae77e65261317c6f5e5bc59612bf06 by Thomas Friedrichsmeier.
Committed on 23/11/2014 at 20:09.
Pushed by tfry into branch 'master'.

- Refactor distribution tests plugins, internally
- Fix printing of excessive amount of digits (now honors options("digits"))
- Add i18n

M  +4    -21   rkward/plugins/distributions/tests/ad_test.js
M  +4    -21   rkward/plugins/distributions/tests/cvm_test.js
A  +28   -0    rkward/plugins/distributions/tests/dist_test_common.js
M  +13   -26   rkward/plugins/distributions/tests/jb_test.js
M  +4    -21   rkward/plugins/distributions/tests/lillie_test.js
M  +8    -24   rkward/plugins/distributions/tests/pearson_test.js
M  +1    -1    rkward/plugins/distributions/tests/pearson_test.xml
M  +4    -22   rkward/plugins/distributions/tests/sf_test.js
M  +6    -17   rkward/plugins/distributions/tests/shapiro_test.js
M  +5    -5    tests/distributions/ad_test.rkcommands.R
M  +2    -2    tests/distributions/ad_test.rkout
M  +5    -5    tests/distributions/cvm_test.rkcommands.R
M  +2    -2    tests/distributions/cvm_test.rkout
M  +7    -8    tests/distributions/jb_test.rkcommands.R
M  +3    -3    tests/distributions/jb_test.rkout
M  +4    -4    tests/distributions/lillie_test.rkcommands.R
M  +2    -2    tests/distributions/lillie_test.rkout
M  +16   -18   tests/distributions/pearson_test.rkcommands.R
M  +8    -8    tests/distributions/pearson_test.rkout
M  +5    -6    tests/distributions/sf_test.rkcommands.R
M  +2    -2    tests/distributions/sf_test.rkout
M  +4    -4    tests/distributions/shapiro_wilk_test.rkcommands.R
M  +2    -2    tests/distributions/shapiro_wilk_test.rkout

http://commits.kde.org/rkward/87e98d3b42ae77e65261317c6f5e5bc59612bf06

diff --git a/rkward/plugins/distributions/tests/ad_test.js b/rkward/plugins/distributions/tests/ad_test.js
index 78aa4d6..ad58b01 100755
--- a/rkward/plugins/distributions/tests/ad_test.js
+++ b/rkward/plugins/distributions/tests/ad_test.js
@@ -1,28 +1,11 @@
-function preprocess () {
-	echo ('require(nortest)\n');
-}
-
-function calculate () {
-	var vars = trim (getValue ("x"));
+include ("dist_test_common.js");
 
-	echo ('vars <- rk.list (' + vars.split ("\n").join (", ") + ')\n');
-	echo ('results <- data.frame (\'Variable Name\'=I(names (vars)), check.names=FALSE)\n');
-	echo ('for (i in 1:length (vars)) {\n');
-	echo ('	var <- vars[[i]]\n');
-	if (getValue ("length")) {
-		echo ('	results[i, \'Length\'] <- length (var)\n');
-		echo ('	results[i, \'NAs\'] <- sum (is.na(var))\n');
-	}
-	echo ('	try ({\n');
-	echo ('		test <- ad.test (var)\n');
-	echo ('		results[i, \'Statistic\'] <- paste (names (test$statistic), test$statistic, sep=" = ")\n');
-	echo ('		results[i, \'p-value\'] <- test$p.value\n');
-	echo ('	})\n');
-	echo ('}\n');
+function testCall () {
+	return ("ad.test (var)");
 }
 
 function printout () {
-	echo ('rk.header ("Anderson-Darling Normality Test")\n');
+	echo ('rk.header (' + i18n ("Anderson-Darling Normality Test") + ')\n');
 	echo ('\n');
 	echo ('rk.results (results)\n');
 }
diff --git a/rkward/plugins/distributions/tests/cvm_test.js b/rkward/plugins/distributions/tests/cvm_test.js
index f65676d..120665d 100755
--- a/rkward/plugins/distributions/tests/cvm_test.js
+++ b/rkward/plugins/distributions/tests/cvm_test.js
@@ -1,27 +1,10 @@
-function preprocess () {
-	echo ('require(nortest)\n');
-}
-
-function calculate () {
-	var vars = trim (getValue ("x"));
+include ("dist_test_common.js");
 
-	echo ('vars <- rk.list (' + vars.split ("\n").join (", ") + ')\n');
-	echo ('results <- data.frame (\'Variable Name\'=I(names (vars)), check.names=FALSE)\n');
-	echo ('for (i in 1:length (vars)) {\n');
-	echo ('	var <- vars[[i]]\n');
-	if (getValue ("length")) {
-		echo ('	results[i, \'Length\'] <- length (var)\n');
-		echo ('	results[i, \'NAs\'] <- sum (is.na(var))\n');
-	}
-	echo ('	try ({\n');
-	echo ('		test <- cvm.test (var)\n');
-	echo ('		results[i, \'Statistic\'] <- paste (names (test$statistic), test$statistic, sep=" = ")\n');
-	echo ('		results[i, \'p-value\'] <- test$p.value\n');
-	echo ('	})\n');
-	echo ('}\n');
+function testCall () {
+	return ("cvm.test (var)");
 }
 
 function printout () {
-	echo ('rk.header ("Cramer-von Mises Normality Test")\n');
+	echo ('rk.header (' + i18n ("Cramer-von Mises Normality Test") + ')\n');
 	echo ('rk.results (results)\n');
 }
diff --git a/rkward/plugins/distributions/tests/dist_test_common.js b/rkward/plugins/distributions/tests/dist_test_common.js
new file mode 100644
index 0000000..8749260
--- /dev/null
+++ b/rkward/plugins/distributions/tests/dist_test_common.js
@@ -0,0 +1,28 @@
+function preprocess () {
+	echo ('require (nortest)\n');
+}
+
+function dfCall () {
+	return ('');
+}
+
+function calculate () {
+	var vars = trim (getValue ("x"));
+
+	echo ('vars <- rk.list (' + vars.split ("\n").join (", ") + ')\n');
+	echo ('results <- data.frame (' + i18n ("Variable Name") + '=I(names (vars)), check.names=FALSE)\n');
+	echo ('for (i in 1:length (vars)) {\n');
+	echo ('	var <- vars[[i]]\n');
+	if (getValue ("length")) {
+		echo ('	results[i, ' + i18n ("Length") + '] <- length (var)\n');
+		echo ('	results[i, \'NAs\'] <- sum (is.na(var))\n');
+	}
+	echo ('	try ({\n');
+	echo ('		test <- ' + testCall () + '\n');
+	echo ('		results[i, ' + i18nc ("Statistic indicator", "Statistic") + '] <- paste (names (test$statistic), format (test$statistic), sep=" = ")\n');
+	printIndentedUnlessEmpty ('		', dfCall ());
+	echo ('		results[i, ' + i18n ("p-value") + '] <- test$p.value\n');
+	echo ('	})\n');
+	echo ('}\n');
+}
+ 
\ No newline at end of file
diff --git a/rkward/plugins/distributions/tests/jb_test.js b/rkward/plugins/distributions/tests/jb_test.js
index f2494b1..a309c75 100755
--- a/rkward/plugins/distributions/tests/jb_test.js
+++ b/rkward/plugins/distributions/tests/jb_test.js
@@ -1,34 +1,21 @@
-function preprocess () {
-	echo ('require(tseries)\n');
+include ("dist_test_common.js");
+
+function testCall () {
+	if (getBoolean ("excludenas.state")) {
+		return ("jarque.bera.test (na.omit (var))");
+	}
+	return ("jarque.bera.test (var)");
 }
 
-function calculate () {
-	var vars = trim (getValue ("x"));
+dfCall = function () {
+	return ('results[i, \'df\'] <- test$parameter\n');
+}
 
-	echo ('vars <- rk.list (' + vars.split ("\n").join (", ") + ')\n');
-	echo ('results <- data.frame (\'Variable Name\'=I(names (vars)), check.names=FALSE)\n');
-	echo ('for (i in 1:length (vars)) {\n');
-	echo ('	var <- vars[[i]]\n');
-	if (getValue ("length")) {
-		echo ('	results[i, \'Length\'] <- length (var)\n');
-		echo ('	results[i, \'NAs\'] <- sum (is.na(var))\n');
-	}
-	if (getValue ("excludenas")) {
-		echo ('	var <- na.omit (var)\n');
-	}
-	echo ('	try ({\n');
-	echo ('		test <- jarque.bera.test (var)\n');
-	echo ('		results[i, \'Statistic\'] <- paste (names (test$statistic), test$statistic, sep=" = ")\n');
-	echo ('		results[i, \'df\'] <- test$parameter\n');
-	echo ('		results[i, \'p-value\'] <- test$p.value\n');
-	echo ('	})\n');
-	echo ('}\n');
+preprocess = function () {
+	echo ('require (tseries)\n');	// instead of nortest
 }
 
 function printout () {
-	echo ('rk.header ("Jarque-Bera Normality Test", parameters=list ("Exclude NAs", ');
-	if (getValue ("excludenas")) echo ('"YES"');
-	else echo ('"NO"');
-	echo ('))\n');
+	new Header (i18n ("Jarque-Bera Normality Test")).addFromUI ("excludenas").print ();
 	echo ('rk.results (results)\n');
 }
diff --git a/rkward/plugins/distributions/tests/lillie_test.js b/rkward/plugins/distributions/tests/lillie_test.js
index cb93551..52f551f 100755
--- a/rkward/plugins/distributions/tests/lillie_test.js
+++ b/rkward/plugins/distributions/tests/lillie_test.js
@@ -1,27 +1,10 @@
-function preprocess () {
-	echo ('require (nortest)\n');
-}
-
-function calculate () {
-	var vars = trim (getValue ("x"));
+include ("dist_test_common.js");
 
-	echo ('vars <- rk.list (' + vars.split ("\n").join (", ") + ')\n');
-	echo ('results <- data.frame (\'Variable Name\'=I(names (vars)), check.names=FALSE)\n');
-	echo ('for (i in 1:length (vars)) {\n');
-	echo ('	var <- vars[[i]]\n');
-	if (getValue ("length")) {
-		echo ('	results[i, \'Length\'] <- length (var)\n');
-		echo ('	results[i, \'NAs\'] <- sum (is.na(var))\n');
-	}
-	echo ('	try ({\n');
-	echo ('		test <- lillie.test (var)\n');
-	echo ('		results[i, \'Statistic\'] <- paste (names (test$statistic), test$statistic, sep=" = ")\n');
-	echo ('		results[i, \'p-value\'] <- test$p.value\n');
-	echo ('	})\n');
-	echo ('}\n');
+function testCall () {
+	return ("lillie.test (var)");
 }
 
 function printout () {
-	echo ('rk.header ("Lilliefors (Kolmogorov-Smirnov) Normality test")\n');
+	echo ('rk.header (' + i18n ("Lilliefors (Kolmogorov-Smirnov) Normality test") + ')\n');
 	echo ('rk.results (results)\n');
 }
diff --git a/rkward/plugins/distributions/tests/pearson_test.js b/rkward/plugins/distributions/tests/pearson_test.js
index 1973e43..51b74f1 100755
--- a/rkward/plugins/distributions/tests/pearson_test.js
+++ b/rkward/plugins/distributions/tests/pearson_test.js
@@ -1,31 +1,15 @@
-function preprocess () {
-	echo ('require(nortest)\n');
-}
+include ("dist_test_common.js");
 
-function calculate () {
-	var adjust = getValue ("adjust");
-	var vars = trim (getValue ("x"));
+function testCall () {
+	return ("pearson.test (var, " + getString ("adjust") + ")");
+}
 
-	echo ('vars <- rk.list (' + vars.split ("\n").join (", ") + ')\n');
-	echo ('results <- data.frame (\'Variable Name\'=I(names (vars)), check.names=FALSE)\n');
-	echo ('for (i in 1:length (vars)) {\n');
-	echo ('	var <- vars[[i]]\n');
-	if (getValue ("length")) {
-		echo ('	results[i, \'Length\'] <- length (var)\n');
-		echo ('	results[i, \'NAs\'] <- sum (is.na(var))\n');
-	}
-	echo ('	try ({\n');
-	echo ('		test <- pearson.test (var, ' +  adjust + ')\n');
-	echo ('		results[i, \'Statistic\'] <- paste (names (test$statistic), test$statistic, sep=" = ")\n');
-	echo ('		results[i, \'p-value\'] <- test$p.value\n');
-	echo ('		results[i, \'number of classes\'] <- test$n.classes\n');
-	echo ('		results[i, \'degrees of freedom\'] <- test$df\n');
-	echo ('	})\n');
-	echo ('}\n');
+dfCall = function () {
+	return ('results[i, ' + i18n ("number of classes") + '] <- test$n.classes\n' +
+	        'results[i, ' + i18n ("degrees of freedom") + '] <- test$df\n');
 }
 
 function printout () {
-	echo ('rk.header ("Pearson chi-square Normality Test",\n');
-	echo ('	parameters=list ("chi-square distribution with n.classes-3 df (TRUE) or chi-square distribution with n.classes-1 df (FALSE)", "' + getValue ("adjust") + '"))\n');
+	new Header (i18n ("Pearson chi-square Normality Test")).addFromUI ("adjust").print ();
 	echo ('rk.results (results)\n');
 }
diff --git a/rkward/plugins/distributions/tests/pearson_test.xml b/rkward/plugins/distributions/tests/pearson_test.xml
index 9ecf748..a1f4e16 100755
--- a/rkward/plugins/distributions/tests/pearson_test.xml
+++ b/rkward/plugins/distributions/tests/pearson_test.xml
@@ -18,7 +18,7 @@
 				</row>
 			</tab>
 			<tab label="Options">
-				<radio id="adjust" label="p-value from chi^2-distribution from:">
+				<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>
diff --git a/rkward/plugins/distributions/tests/sf_test.js b/rkward/plugins/distributions/tests/sf_test.js
index 0871705..02afa99 100755
--- a/rkward/plugins/distributions/tests/sf_test.js
+++ b/rkward/plugins/distributions/tests/sf_test.js
@@ -1,28 +1,10 @@
-function preprocess () {
-	echo ('require(nortest)\n');
-}
-
-function calculate () {
-	var vars = trim (getValue ("x"));
+include ("dist_test_common.js");
 
-	echo ('vars <- rk.list (' + vars.split ("\n").join (", ") + ')\n');
-	echo ('results <- data.frame (\'Variable Name\'=I(names (vars)), check.names=FALSE)\n');
-	echo ('for (i in 1:length (vars)) {\n');
-	echo ('	var <- vars[[i]]\n');
-	if (getValue ("length")) {
-		echo ('	results[i, \'Length\'] <- length (var)\n');
-		echo ('	results[i, \'NAs\'] <- sum (is.na(var))\n');
-	}
-	echo ('	try ({\n');
-	echo ('		test <- sf.test (var)\n');
-	echo ('		results[i, \'Statistic\'] <- paste (names (test$statistic), test$statistic, sep=" = ")\n');
-	echo ('		results[i, \'p-value\'] <- test$p.value\n');
-	echo ('	})\n');
-	echo ('}\n');
+function testCall () {
+	return ("sf.test (var)");
 }
 
 function printout () {
-	echo ('	\n');
-	echo ('rk.header ("Shapiro-Francia Normality Test")\n');
+	echo ('rk.header (' + i18n ("Shapiro-Francia Normality Test") + ')\n');
 	echo ('rk.results (results)\n');
 }
diff --git a/rkward/plugins/distributions/tests/shapiro_test.js b/rkward/plugins/distributions/tests/shapiro_test.js
index 5889e6a..a0e4abd 100755
--- a/rkward/plugins/distributions/tests/shapiro_test.js
+++ b/rkward/plugins/distributions/tests/shapiro_test.js
@@ -1,23 +1,12 @@
-function calculate () {
-	var vars = trim (getValue ("x"));
+include ("dist_test_common.js");
 
-	echo ('vars <- rk.list (' + vars.split ("\n").join (", ") + ')\n');
-	echo ('results <- data.frame (\'Variable Name\'=I(names (vars)), check.names=FALSE)\n');
-	echo ('for (i in 1:length (vars)) {\n');
-	echo ('	var <- vars[[i]]\n');
-	if (getValue ("length")) {
-		echo ('	results[i, \'Length\'] <- length (var)\n');
-		echo ('	results[i, \'NAs\'] <- sum (is.na(var))\n');
-	}
-	echo ('	try ({\n');
-	echo ('		test <- shapiro.test (var)\n');
-	echo ('		results[i, \'Statistic\'] <- paste (names (test$statistic), test$statistic, sep=" = ")\n');
-	echo ('		results[i, \'p-value\'] <- test$p.value\n');
-	echo ('	})\n');
-	echo ('}\n');
+preprocess = function () {}
+
+function testCall () {
+	return ("shapiro.test (var)");
 }
 
 function printout () {
-	echo ('rk.header ("Shapiro-Wilk Normality Test")\n');
+	echo ('rk.header (' + i18n ("Shapiro-Wilk Normality Test") + ')\n');
 	echo ('rk.results (results)\n');
 }
diff --git a/tests/distributions/ad_test.rkcommands.R b/tests/distributions/ad_test.rkcommands.R
index 9a924bb..a9ac7e3 100644
--- a/tests/distributions/ad_test.rkcommands.R
+++ b/tests/distributions/ad_test.rkcommands.R
@@ -1,17 +1,17 @@
 local({
 ## Prepare
-require(nortest)
+require (nortest)
 ## Compute
 vars <- rk.list (rock[["shape"]], rock[["perm"]])
-results <- data.frame ('Variable Name'=I(names (vars)), check.names=FALSE)
+results <- data.frame ("Variable Name"=I(names (vars)), check.names=FALSE)
 for (i in 1:length (vars)) {
 	var <- vars[[i]]
-	results[i, 'Length'] <- length (var)
+	results[i, "Length"] <- length (var)
 	results[i, 'NAs'] <- sum (is.na(var))
 	try ({
 		test <- ad.test (var)
-		results[i, 'Statistic'] <- paste (names (test$statistic), test$statistic, sep=" = ")
-		results[i, 'p-value'] <- test$p.value
+		results[i, "Statistic"] <- paste (names (test$statistic), format (test$statistic), sep=" = ")
+		results[i, "p-value"] <- test$p.value
 	})
 }
 ## Print result
diff --git a/tests/distributions/ad_test.rkout b/tests/distributions/ad_test.rkout
index df7825f..942d730 100644
--- a/tests/distributions/ad_test.rkout
+++ b/tests/distributions/ad_test.rkout
@@ -2,6 +2,6 @@
 DATE<br />
 <table border="1">
 <tr><td>Variable Name</td><td>Length</td><td>NAs</td><td>Statistic</td><td>p-value</td></tr>
-<tr><td>shape</td><td>48</td><td>0</td><td>A = 1.41372513181145</td><td>0.0010355</td></tr>
-<tr><td>perm</td><td>48</td><td>0</td><td>A = 3.99184371555789</td><td>4.2977e-10</td></tr>
+<tr><td>shape</td><td>48</td><td>0</td><td>A = 1.4137</td><td>0.0010355</td></tr>
+<tr><td>perm</td><td>48</td><td>0</td><td>A = 3.9918</td><td>4.2977e-10</td></tr>
 </table>
diff --git a/tests/distributions/cvm_test.rkcommands.R b/tests/distributions/cvm_test.rkcommands.R
index fc0e6bd..a1b0703 100644
--- a/tests/distributions/cvm_test.rkcommands.R
+++ b/tests/distributions/cvm_test.rkcommands.R
@@ -1,17 +1,17 @@
 local({
 ## Prepare
-require(nortest)
+require (nortest)
 ## Compute
 vars <- rk.list (rock[["shape"]], rock[["perm"]])
-results <- data.frame ('Variable Name'=I(names (vars)), check.names=FALSE)
+results <- data.frame ("Variable Name"=I(names (vars)), check.names=FALSE)
 for (i in 1:length (vars)) {
 	var <- vars[[i]]
-	results[i, 'Length'] <- length (var)
+	results[i, "Length"] <- length (var)
 	results[i, 'NAs'] <- sum (is.na(var))
 	try ({
 		test <- cvm.test (var)
-		results[i, 'Statistic'] <- paste (names (test$statistic), test$statistic, sep=" = ")
-		results[i, 'p-value'] <- test$p.value
+		results[i, "Statistic"] <- paste (names (test$statistic), format (test$statistic), sep=" = ")
+		results[i, "p-value"] <- test$p.value
 	})
 }
 ## Print result
diff --git a/tests/distributions/cvm_test.rkout b/tests/distributions/cvm_test.rkout
index 0410e77..f795cb3 100644
--- a/tests/distributions/cvm_test.rkout
+++ b/tests/distributions/cvm_test.rkout
@@ -2,6 +2,6 @@
 DATE<br />
 <table border="1">
 <tr><td>Variable Name</td><td>Length</td><td>NAs</td><td>Statistic</td><td>p-value</td></tr>
-<tr><td>shape</td><td>48</td><td>0</td><td>W = 0.232643041678355</td><td>0.0019712</td></tr>
-<tr><td>perm</td><td>48</td><td>0</td><td>W = 0.72561839750325</td><td>3.7586e-08</td></tr>
+<tr><td>shape</td><td>48</td><td>0</td><td>W = 0.23264</td><td>0.0019712</td></tr>
+<tr><td>perm</td><td>48</td><td>0</td><td>W = 0.72562</td><td>3.7586e-08</td></tr>
 </table>
diff --git a/tests/distributions/jb_test.rkcommands.R b/tests/distributions/jb_test.rkcommands.R
index ceb1316..81117e9 100644
--- a/tests/distributions/jb_test.rkcommands.R
+++ b/tests/distributions/jb_test.rkcommands.R
@@ -1,22 +1,21 @@
 local({
 ## Prepare
-require(tseries)
+require (tseries)
 ## Compute
 vars <- rk.list (rock[["shape"]], rock[["perm"]])
-results <- data.frame ('Variable Name'=I(names (vars)), check.names=FALSE)
+results <- data.frame ("Variable Name"=I(names (vars)), check.names=FALSE)
 for (i in 1:length (vars)) {
 	var <- vars[[i]]
-	results[i, 'Length'] <- length (var)
+	results[i, "Length"] <- length (var)
 	results[i, 'NAs'] <- sum (is.na(var))
-	var <- na.omit (var)
 	try ({
-		test <- jarque.bera.test (var)
-		results[i, 'Statistic'] <- paste (names (test$statistic), test$statistic, sep=" = ")
+		test <- jarque.bera.test (na.omit (var))
+		results[i, "Statistic"] <- paste (names (test$statistic), format (test$statistic), sep=" = ")
 		results[i, 'df'] <- test$parameter
-		results[i, 'p-value'] <- test$p.value
+		results[i, "p-value"] <- test$p.value
 	})
 }
 ## Print result
-rk.header ("Jarque-Bera Normality Test", parameters=list ("Exclude NAs", "YES"))
+rk.header ("Jarque-Bera Normality Test", parameters=list("Exclude NAs"="yes"))
 rk.results (results)
 })
diff --git a/tests/distributions/jb_test.rkout b/tests/distributions/jb_test.rkout
index 8c2bf42..af07b33 100644
--- a/tests/distributions/jb_test.rkout
+++ b/tests/distributions/jb_test.rkout
@@ -1,10 +1,10 @@
 <h1>Jarque-Bera Normality Test</h1>
 <h2>Parameters</h2>
-<ul><li>Exclude NAs: YES</li>
+<ul><li>Exclude NAs: yes</li>
 </ul>
 DATE<br />
 <table border="1">
 <tr><td>Variable Name</td><td>Length</td><td>NAs</td><td>Statistic</td><td>df</td><td>p-value</td></tr>
-<tr><td>shape</td><td>48</td><td>0</td><td>X-squared = 13.4020992267589</td><td>2</td><td>0.0012296</td></tr>
-<tr><td>perm</td><td>48</td><td>0</td><td>X-squared = 5.95075906694729</td><td>2</td><td>0.051028</td></tr>
+<tr><td>shape</td><td>48</td><td>0</td><td>X-squared = 13.402</td><td>2</td><td>0.0012296</td></tr>
+<tr><td>perm</td><td>48</td><td>0</td><td>X-squared = 5.9508</td><td>2</td><td>0.051028</td></tr>
 </table>
diff --git a/tests/distributions/lillie_test.rkcommands.R b/tests/distributions/lillie_test.rkcommands.R
index 2381d63..3cd7a7c 100644
--- a/tests/distributions/lillie_test.rkcommands.R
+++ b/tests/distributions/lillie_test.rkcommands.R
@@ -3,15 +3,15 @@ local({
 require (nortest)
 ## Compute
 vars <- rk.list (rock[["shape"]], rock[["perm"]])
-results <- data.frame ('Variable Name'=I(names (vars)), check.names=FALSE)
+results <- data.frame ("Variable Name"=I(names (vars)), check.names=FALSE)
 for (i in 1:length (vars)) {
 	var <- vars[[i]]
-	results[i, 'Length'] <- length (var)
+	results[i, "Length"] <- length (var)
 	results[i, 'NAs'] <- sum (is.na(var))
 	try ({
 		test <- lillie.test (var)
-		results[i, 'Statistic'] <- paste (names (test$statistic), test$statistic, sep=" = ")
-		results[i, 'p-value'] <- test$p.value
+		results[i, "Statistic"] <- paste (names (test$statistic), format (test$statistic), sep=" = ")
+		results[i, "p-value"] <- test$p.value
 	})
 }
 ## Print result
diff --git a/tests/distributions/lillie_test.rkout b/tests/distributions/lillie_test.rkout
index 6818f40..88fff54 100644
--- a/tests/distributions/lillie_test.rkout
+++ b/tests/distributions/lillie_test.rkout
@@ -2,6 +2,6 @@
 DATE<br />
 <table border="1">
 <tr><td>Variable Name</td><td>Length</td><td>NAs</td><td>Statistic</td><td>p-value</td></tr>
-<tr><td>shape</td><td>48</td><td>0</td><td>D = 0.16978665617225</td><td>0.0013779</td></tr>
-<tr><td>perm</td><td>48</td><td>0</td><td>D = 0.317208078488319</td><td>2.5296e-13</td></tr>
+<tr><td>shape</td><td>48</td><td>0</td><td>D = 0.16979</td><td>0.0013779</td></tr>
+<tr><td>perm</td><td>48</td><td>0</td><td>D = 0.31721</td><td>2.5296e-13</td></tr>
 </table>
diff --git a/tests/distributions/pearson_test.rkcommands.R b/tests/distributions/pearson_test.rkcommands.R
index 4ce3bed..082dbfb 100644
--- a/tests/distributions/pearson_test.rkcommands.R
+++ b/tests/distributions/pearson_test.rkcommands.R
@@ -1,46 +1,44 @@
 local({
 ## Prepare
-require(nortest)
+require (nortest)
 ## Compute
 vars <- rk.list (rock[["shape"]], rock[["perm"]])
-results <- data.frame ('Variable Name'=I(names (vars)), check.names=FALSE)
+results <- data.frame ("Variable Name"=I(names (vars)), check.names=FALSE)
 for (i in 1:length (vars)) {
 	var <- vars[[i]]
-	results[i, 'Length'] <- length (var)
+	results[i, "Length"] <- length (var)
 	results[i, 'NAs'] <- sum (is.na(var))
 	try ({
 		test <- pearson.test (var, adjust = TRUE)
-		results[i, 'Statistic'] <- paste (names (test$statistic), test$statistic, sep=" = ")
-		results[i, 'p-value'] <- test$p.value
-		results[i, 'number of classes'] <- test$n.classes
-		results[i, 'degrees of freedom'] <- test$df
+		results[i, "Statistic"] <- paste (names (test$statistic), format (test$statistic), sep=" = ")
+		results[i, "number of classes"] <- test$n.classes
+		results[i, "degrees of freedom"] <- test$df
+		results[i, "p-value"] <- test$p.value
 	})
 }
 ## Print result
-rk.header ("Pearson chi-square Normality Test",
-	parameters=list ("chi-square distribution with n.classes-3 df (TRUE) or chi-square distribution with n.classes-1 df (FALSE)", "adjust = TRUE"))
+rk.header ("Pearson chi-square Normality Test", parameters=list("p-value from chi^2-distribution from"="n.classes-3 degrees of freedom"))
 rk.results (results)
 })
 local({
 ## Prepare
-require(nortest)
+require (nortest)
 ## Compute
 vars <- rk.list (rock[["shape"]], rock[["perm"]])
-results <- data.frame ('Variable Name'=I(names (vars)), check.names=FALSE)
+results <- data.frame ("Variable Name"=I(names (vars)), check.names=FALSE)
 for (i in 1:length (vars)) {
 	var <- vars[[i]]
-	results[i, 'Length'] <- length (var)
+	results[i, "Length"] <- length (var)
 	results[i, 'NAs'] <- sum (is.na(var))
 	try ({
 		test <- pearson.test (var, adjust = FALSE)
-		results[i, 'Statistic'] <- paste (names (test$statistic), test$statistic, sep=" = ")
-		results[i, 'p-value'] <- test$p.value
-		results[i, 'number of classes'] <- test$n.classes
-		results[i, 'degrees of freedom'] <- test$df
+		results[i, "Statistic"] <- paste (names (test$statistic), format (test$statistic), sep=" = ")
+		results[i, "number of classes"] <- test$n.classes
+		results[i, "degrees of freedom"] <- test$df
+		results[i, "p-value"] <- test$p.value
 	})
 }
 ## Print result
-rk.header ("Pearson chi-square Normality Test",
-	parameters=list ("chi-square distribution with n.classes-3 df (TRUE) or chi-square distribution with n.classes-1 df (FALSE)", "adjust = FALSE"))
+rk.header ("Pearson chi-square Normality Test", parameters=list("p-value from chi^2-distribution from"="n.classes-1 degrees of freedom"))
 rk.results (results)
 })
diff --git a/tests/distributions/pearson_test.rkout b/tests/distributions/pearson_test.rkout
index 39848b4..7e2bef2 100644
--- a/tests/distributions/pearson_test.rkout
+++ b/tests/distributions/pearson_test.rkout
@@ -1,20 +1,20 @@
 <h1>Pearson chi-square Normality Test</h1>
 <h2>Parameters</h2>
-<ul><li>chi-square distribution with n.classes-3 df (TRUE) or chi-square distribution with n.classes-1 df (FALSE): adjust = TRUE</li>
+<ul><li>p-value from chi^2-distribution from: n.classes-3 degrees of freedom</li>
 </ul>
 DATE<br />
 <table border="1">
-<tr><td>Variable Name</td><td>Length</td><td>NAs</td><td>Statistic</td><td>p-value</td><td>number of classes</td><td>degrees of freedom</td></tr>
-<tr><td>shape</td><td>48</td><td>0</td><td>P = 15.3333333333333</td><td>0.031956</td><td>10</td><td>7</td></tr>
-<tr><td>perm</td><td>48</td><td>0</td><td>P = 72</td><td>5.82e-13</td><td>10</td><td>7</td></tr>
+<tr><td>Variable Name</td><td>Length</td><td>NAs</td><td>Statistic</td><td>number of classes</td><td>degrees of freedom</td><td>p-value</td></tr>
+<tr><td>shape</td><td>48</td><td>0</td><td>P = 15.333</td><td>10</td><td>7</td><td>0.031956</td></tr>
+<tr><td>perm</td><td>48</td><td>0</td><td>P = 72</td><td>10</td><td>7</td><td>5.82e-13</td></tr>
 </table>
 <h1>Pearson chi-square Normality Test</h1>
 <h2>Parameters</h2>
-<ul><li>chi-square distribution with n.classes-3 df (TRUE) or chi-square distribution with n.classes-1 df (FALSE): adjust = FALSE</li>
+<ul><li>p-value from chi^2-distribution from: n.classes-1 degrees of freedom</li>
 </ul>
 DATE<br />
 <table border="1">
-<tr><td>Variable Name</td><td>Length</td><td>NAs</td><td>Statistic</td><td>p-value</td><td>number of classes</td><td>degrees of freedom</td></tr>
-<tr><td>shape</td><td>48</td><td>0</td><td>P = 15.3333333333333</td><td>0.082177</td><td>10</td><td>9</td></tr>
-<tr><td>perm</td><td>48</td><td>0</td><td>P = 72</td><td>6.1643e-12</td><td>10</td><td>9</td></tr>
+<tr><td>Variable Name</td><td>Length</td><td>NAs</td><td>Statistic</td><td>number of classes</td><td>degrees of freedom</td><td>p-value</td></tr>
+<tr><td>shape</td><td>48</td><td>0</td><td>P = 15.333</td><td>10</td><td>9</td><td>0.082177</td></tr>
+<tr><td>perm</td><td>48</td><td>0</td><td>P = 72</td><td>10</td><td>9</td><td>6.1643e-12</td></tr>
 </table>
diff --git a/tests/distributions/sf_test.rkcommands.R b/tests/distributions/sf_test.rkcommands.R
index 1b41f01..74d257a 100644
--- a/tests/distributions/sf_test.rkcommands.R
+++ b/tests/distributions/sf_test.rkcommands.R
@@ -1,21 +1,20 @@
 local({
 ## Prepare
-require(nortest)
+require (nortest)
 ## Compute
 vars <- rk.list (rock[["shape"]], rock[["perm"]])
-results <- data.frame ('Variable Name'=I(names (vars)), check.names=FALSE)
+results <- data.frame ("Variable Name"=I(names (vars)), check.names=FALSE)
 for (i in 1:length (vars)) {
 	var <- vars[[i]]
-	results[i, 'Length'] <- length (var)
+	results[i, "Length"] <- length (var)
 	results[i, 'NAs'] <- sum (is.na(var))
 	try ({
 		test <- sf.test (var)
-		results[i, 'Statistic'] <- paste (names (test$statistic), test$statistic, sep=" = ")
-		results[i, 'p-value'] <- test$p.value
+		results[i, "Statistic"] <- paste (names (test$statistic), format (test$statistic), sep=" = ")
+		results[i, "p-value"] <- test$p.value
 	})
 }
 ## Print result
-	
 rk.header ("Shapiro-Francia Normality Test")
 rk.results (results)
 })
diff --git a/tests/distributions/sf_test.rkout b/tests/distributions/sf_test.rkout
index 496632e..b997e3d 100644
--- a/tests/distributions/sf_test.rkout
+++ b/tests/distributions/sf_test.rkout
@@ -2,6 +2,6 @@
 DATE<br />
 <table border="1">
 <tr><td>Variable Name</td><td>Length</td><td>NAs</td><td>Statistic</td><td>p-value</td></tr>
-<tr><td>shape</td><td>48</td><td>0</td><td>W = 0.903716033135835</td><td>0.0014382</td></tr>
-<tr><td>perm</td><td>48</td><td>0</td><td>W = 0.814665259804222</td><td>1.2468e-05</td></tr>
+<tr><td>shape</td><td>48</td><td>0</td><td>W = 0.90372</td><td>0.0014382</td></tr>
+<tr><td>perm</td><td>48</td><td>0</td><td>W = 0.81467</td><td>1.2468e-05</td></tr>
 </table>
diff --git a/tests/distributions/shapiro_wilk_test.rkcommands.R b/tests/distributions/shapiro_wilk_test.rkcommands.R
index ad26521..66ded96 100644
--- a/tests/distributions/shapiro_wilk_test.rkcommands.R
+++ b/tests/distributions/shapiro_wilk_test.rkcommands.R
@@ -1,15 +1,15 @@
 local({
 ## Compute
 vars <- rk.list (rock[["shape"]], rock[["perm"]])
-results <- data.frame ('Variable Name'=I(names (vars)), check.names=FALSE)
+results <- data.frame ("Variable Name"=I(names (vars)), check.names=FALSE)
 for (i in 1:length (vars)) {
 	var <- vars[[i]]
-	results[i, 'Length'] <- length (var)
+	results[i, "Length"] <- length (var)
 	results[i, 'NAs'] <- sum (is.na(var))
 	try ({
 		test <- shapiro.test (var)
-		results[i, 'Statistic'] <- paste (names (test$statistic), test$statistic, sep=" = ")
-		results[i, 'p-value'] <- test$p.value
+		results[i, "Statistic"] <- paste (names (test$statistic), format (test$statistic), sep=" = ")
+		results[i, "p-value"] <- test$p.value
 	})
 }
 ## Print result
diff --git a/tests/distributions/shapiro_wilk_test.rkout b/tests/distributions/shapiro_wilk_test.rkout
index d8bc545..497bc64 100644
--- a/tests/distributions/shapiro_wilk_test.rkout
+++ b/tests/distributions/shapiro_wilk_test.rkout
@@ -2,6 +2,6 @@
 DATE<br />
 <table border="1">
 <tr><td>Variable Name</td><td>Length</td><td>NAs</td><td>Statistic</td><td>p-value</td></tr>
-<tr><td>shape</td><td>48</td><td>0</td><td>W = 0.904069181319154</td><td>0.00085307</td></tr>
-<tr><td>perm</td><td>48</td><td>0</td><td>W = 0.803262753495175</td><td>1.5417e-06</td></tr>
+<tr><td>shape</td><td>48</td><td>0</td><td>W = 0.90407</td><td>0.00085307</td></tr>
+<tr><td>perm</td><td>48</td><td>0</td><td>W = 0.80326</td><td>1.5418e-06</td></tr>
 </table>




More information about the rkward-tracker mailing list