[gnumeric] sstest: fix some tests; widen acceptance range for bin tests
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] sstest: fix some tests; widen acceptance range for bin tests
- Date: Wed, 22 Mar 2017 00:53:53 +0000 (UTC)
commit c7ccb916d69110acd57bb9629f3381b2749a90b1
Author: Morten Welinder <terra gnome org>
Date: Tue Mar 21 20:52:26 2017 -0400
sstest: fix some tests; widen acceptance range for bin tests
Avoid invalid parameters for df.
Widen acceptance for bin tests to 4*sqrt(expected)
This lowers the number of failures to something acceptable.
ChangeLog | 9 +++++++++
NEWS | 3 +++
src/sstest.c | 13 +++++++------
3 files changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 90ff0c2..26a6160 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2017-03-21 Morten Welinder <terra gnome org>
+
+ * src/sstest.c (rand_fractile_test): Allow 4*sqrt(expected)
+ deviation for each bin.
+ (test_random_randchisq, test_random_randtdist)
+ (test_random_randfdist): Don't allow df=0.
+ (test_random_randbeta): Don't floor the parameters thus avoiding
+ zero.
+
2017-03-20 Morten Welinder <terra gnome org>
* configure.ac: Post-release bump.
diff --git a/NEWS b/NEWS
index 6c393e9..e9ef541 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,8 @@
Gnumeric 1.12.35
+Morten:
+ * Test suite improvements.
+
--------------------------------------------------------------------------
Gnumeric 1.12.34
diff --git a/src/sstest.c b/src/sstest.c
index 38f9162..2abb64d 100644
--- a/src/sstest.c
+++ b/src/sstest.c
@@ -633,7 +633,7 @@ rand_fractile_test (gnm_float const *vals, int N, int nf,
for (i = 1; i <= nf; i++) {
gnm_float T = expected[i];
- if (!(gnm_abs (fractilecount[i] - T) <= 3 * gnm_sqrt (T))) {
+ if (!(gnm_abs (fractilecount[i] - T) <= 4 * gnm_sqrt (T))) {
g_printerr ("Fractile test failure for bin %d.\n", i);
ok = FALSE;
}
@@ -1343,7 +1343,8 @@ test_random_randbeta (int N)
gnm_float mean, var, skew, kurt;
gnm_float *vals;
gboolean ok;
- gnm_float param_a = gnm_floor (1 / (0.0001 + gnm_pow (random_01 (), 6))); gnm_float param_b =
gnm_floor (1 / (0.0001 + gnm_pow (random_01 (), 6)));
+ gnm_float param_a = 1 / (0.0001 + gnm_pow (random_01 (), 6));
+ gnm_float param_b = 1 / (0.0001 + gnm_pow (random_01 (), 6));
gnm_float s = param_a + param_b;
gnm_float mean_target = param_a / s;
gnm_float var_target = mean_target * param_b / (s * (s + 1));
@@ -1423,7 +1424,7 @@ test_random_randtdist (int N)
gnm_float mean, var, skew, kurt;
gnm_float *vals;
gboolean ok;
- gnm_float param_df = gnm_floor (1 / (0.01 + gnm_pow (random_01 (), 6)));
+ gnm_float param_df = 1 + gnm_floor (1 / (0.01 + gnm_pow (random_01 (), 6)));
gnm_float mean_target = 0;
gnm_float var_target = param_df > 2 ? param_df / (param_df - 2) : gnm_nan;
gnm_float skew_target = param_df > 3 ? 0 : gnm_nan;
@@ -1500,8 +1501,8 @@ test_random_randfdist (int N)
gnm_float mean, var, skew, kurt;
gnm_float *vals;
gboolean ok;
- gnm_float param_df1 = gnm_floor (1 / (0.01 + gnm_pow (random_01 (), 6)));
- gnm_float param_df2 = gnm_floor (1 / (0.01 + gnm_pow (random_01 (), 6)));
+ gnm_float param_df1 = 1 + gnm_floor (1 / (0.01 + gnm_pow (random_01 (), 6)));
+ gnm_float param_df2 = 1 + gnm_floor (1 / (0.01 + gnm_pow (random_01 (), 6)));
gnm_float mean_target = param_df2 > 2 ? param_df2 / (param_df2 - 2) : gnm_nan;
gnm_float var_target = param_df2 > 4
? (2 * param_df2 * param_df2 * (param_df1 + param_df2 - 2) /
@@ -1581,7 +1582,7 @@ test_random_randchisq (int N)
gnm_float mean, var, skew, kurt;
gnm_float *vals;
gboolean ok;
- gnm_float param_df = gnm_floor (1 / (0.01 + gnm_pow (random_01 (), 6)));
+ gnm_float param_df = 1 + gnm_floor (1 / (0.01 + gnm_pow (random_01 (), 6)));
gnm_float mean_target = param_df;
gnm_float var_target = param_df * 2;
gnm_float skew_target = gnm_sqrt (8 / param_df);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]