Fixed misleading results in the Kruskal-Wallis test
[pspp] / tests / language / stats / npar.at
index e71514c63b8adb6491d5dab8fad8ccb94c84a615..93624925aee4764addf974ab76023156721b00e3 100644 (file)
@@ -1,5 +1,5 @@
 dnl PSPP - a program for statistical analysis.
-dnl Copyright (C) 2017 Free Software Foundation, Inc.
+dnl Copyright (C) 2017, 2022 Free Software Foundation, Inc.
 dnl
 dnl This program is free software: you can redistribute it and/or modify
 dnl it under the terms of the GNU General Public License as published by
@@ -759,6 +759,44 @@ AT_CHECK([pspp -o pspp2.csv kw-missing-group.sps])
 dnl The result should be the same as before
 AT_CHECK([diff pspp.csv pspp2.csv], [0])
 
+dnl Reverse the order of the group values
+AT_DATA([kw-reverse-group.sps], [dnl
+set format = F9.3.
+
+data list notable list /gv * xscore *.
+begin data
+1 96
+1 128
+1 83
+1 61
+1 101
+2 82
+2 124
+2 132
+2 135
+2 109
+3 115
+3 149
+3 166
+3 147
+end data.
+
+value label /gv
+       1 "timed out"
+       2 "hit wicket"
+       3 "handled the ball".
+
+npar tests
+       /kruskal-wallis xscore by gv (3, 1)
+       /missing=exclude
+       .
+])
+
+AT_CHECK([pspp -o pspp2.csv kw-reverse-group.sps])
+
+dnl The result should be the same as before
+AT_CHECK([diff pspp.csv pspp2.csv], [0])
+
 AT_CLEANUP
 
 
@@ -1045,7 +1083,7 @@ AT_SETUP([NPAR TESTS Mann-Whitney Multiple])
 dnl Check for a bug where the ranks were inappropriately allocated, when
 dnl multiple variables were tested and MISSING=ANALYSIS chosen.
 
-cp $abs_srcdir/language/mann-whitney.txt .
+cp "$abs_srcdir/language/mann-whitney.txt" .
 
 AT_DATA([npar-mann-whitney.sps], [dnl
 SET FORMAT     = F11.3
@@ -1241,14 +1279,14 @@ npar tests
 
 AT_CHECK([pspp -O format=csv mcnemar.sps], [0], [dnl
 Table: v1 & v2
-,v2,
-v1,.000,1.000
+v1,v2,
+,.000,1.000
 .000,4,9
 1.000,2,5
 
 Table: v1 & junk
-,junk,
-v1,.000,1.000
+v1,junk,
+,.000,1.000
 .000,8,5
 1.000,2,5
 
@@ -1283,8 +1321,8 @@ NPAR TEST
 
 AT_CHECK([pspp -O format=csv mcnemar.sps], [0], [dnl
 Table: var1 & var2
-,var2,
-var1,0,1
+var1,var2,
+,0,1
 0,9,8
 1,1,5
 
@@ -1293,8 +1331,8 @@ Table: Test Statistics
 var1 & var2,23,.039,.020,.02
 
 Table: var2 & var1
-,var1,
-var2,0,1
+var2,var1,
+,0,1
 0,9,1
 1,8,5