Fixed misleading results in the Kruskal-Wallis test
[pspp] / tests / language / stats / npar.at
index 24a8cce65956b07353806a964b1af51944fc257d..93624925aee4764addf974ab76023156721b00e3 100644 (file)
@@ -1,16 +1,16 @@
 dnl PSPP - a program for statistical analysis.
-dnl Copyright (C) 2017 Free Software Foundation, Inc.
-dnl 
+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
 dnl the Free Software Foundation, either version 3 of the License, or
 dnl (at your option) any later version.
-dnl 
+dnl
 dnl This program is distributed in the hope that it will be useful,
 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 dnl GNU General Public License for more details.
-dnl 
+dnl
 dnl You should have received a copy of the GNU General Public License
 dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
 dnl
@@ -35,8 +35,8 @@ NPAR TESTS
 AT_CHECK([pspp -O format=csv npar.sps], [0], [dnl
 Table: Binomial Test
 ,,Category,N,Observed Prop.,Test Prop.,Exact Sig. (1-tailed)
-x,Group1,1.000,6.000,.286,.300,.551
-,Group2,2.000,15.000,.714,,
+x,Group 1,1.000,6.000,.286,.300,.551
+,Group 2,2.000,15.000,.714,,
 ,Total,,21.000,1.000,,
 ])
 AT_CLEANUP
@@ -60,8 +60,8 @@ NPAR TESTS
 AT_CHECK([pspp -O format=csv npar.sps], [0], [dnl
 Table: Binomial Test
 ,,Category,N,Observed Prop.,Test Prop.,Exact Sig. (1-tailed)
-x,Group1,1,7,.538,.400,.229
-,Group2,2,6,.462,,
+x,Group 1,1,7,.538,.400,.229
+,Group 2,2,6,.462,,
 ,Total,,13,1.000,,
 ])
 AT_CLEANUP
@@ -85,8 +85,8 @@ NPAR TESTS
 AT_CHECK([pspp -O format=csv npar.sps], [0], [dnl
 Table: Binomial Test
 ,,Category,N,Observed Prop.,Test Prop.,Exact Sig. (1-tailed)
-x,Group1,1,8,.500,.400,.284
-,Group2,2,8,.500,,
+x,Group 1,1,8,.500,.400,.284
+,Group 2,2,8,.500,,
 ,Total,,16,1.000,,
 ])
 AT_CLEANUP
@@ -110,8 +110,8 @@ NPAR TESTS
 AT_CHECK([pspp -O format=csv npar.sps], [0], [dnl
 Table: Binomial Test
 ,,Category,N,Observed Prop.,Test Prop.,Exact Sig. (1-tailed)
-x,Group1,1,11,.478,.600,.164
-,Group2,2,12,.522,,
+x,Group 1,1,11,.478,.600,.164
+,Group 2,2,12,.522,,
 ,Total,,23,1.000,,
 ])
 AT_CLEANUP
@@ -134,8 +134,8 @@ NPAR TESTS
 AT_CHECK([pspp -O format=csv npar.sps], [0], [dnl
 Table: Binomial Test
 ,,Category,N,Observed Prop.,Test Prop.,Exact Sig. (1-tailed)
-x,Group1,1,11,.550,.600,.404
-,Group2,2,9,.450,,
+x,Group 1,1,11,.550,.600,.404
+,Group 2,2,9,.450,,
 ,Total,,20,1.000,,
 ])
 AT_CLEANUP
@@ -158,8 +158,8 @@ NPAR TESTS
 AT_CHECK([pspp -O format=csv npar.sps], [0], [dnl
 Table: Binomial Test
 ,,Category,N,Observed Prop.,Test Prop.,Exact Sig. (1-tailed)
-x,Group1,1,11,.500,.600,.228
-,Group2,2,11,.500,,
+x,Group 1,1,11,.500,.600,.228
+,Group 2,2,11,.500,,
 ,Total,,22,1.000,,
 ])
 AT_CLEANUP
@@ -183,8 +183,8 @@ NPAR TESTS
 AT_CHECK([pspp -O format=csv npar.sps], [0], [dnl
 Table: Binomial Test
 ,,Category,N,Observed Prop.,Test Prop.,Exact Sig. (2-tailed)
-x,Group1,1,8,.348,.500,.210
-,Group2,2,15,.652,,
+x,Group 1,1,8,.348,.500,.210
+,Group 2,2,15,.652,,
 ,Total,,23,1.000,,
 ])
 AT_CLEANUP
@@ -207,8 +207,8 @@ NPAR TESTS
 AT_CHECK([pspp -O format=csv npar.sps], [0], [dnl
 Table: Binomial Test
 ,,Category,N,Observed Prop.,Test Prop.,Exact Sig. (2-tailed)
-x,Group1,1,12,.667,.500,.238
-,Group2,2,6,.333,,
+x,Group 1,1,12,.667,.500,.238
+,Group 2,2,6,.333,,
 ,Total,,18,1.000,,
 ])
 AT_CLEANUP
@@ -232,8 +232,8 @@ NPAR TESTS
 AT_CHECK([pspp -O format=csv npar.sps], [0], [dnl
 Table: Binomial Test
 ,,Category,N,Observed Prop.,Test Prop.,Exact Sig. (2-tailed)
-x,Group1,1,10,.500,.500,1.000
-,Group2,2,10,.500,,
+x,Group 1,1,10,.500,.500,1.000
+,Group 2,2,10,.500,,
 ,Total,,20,1.000,,
 ])
 AT_CLEANUP
@@ -258,8 +258,8 @@ NPAR TESTS
 AT_CHECK([pspp -O format=csv npar.sps], [0], [dnl
 Table: Binomial Test
 ,,Category,N,Observed Prop.,Test Prop.,Exact Sig. (2-tailed)
-x,Group1,<= 10,10.000,.385,.500,.327
-,Group2,,16.000,.615,,
+x,Group 1,<= 10,10.000,.385,.500,.327
+,Group 2,,16.000,.615,,
 ,Total,,26.000,1.000,,
 ])
 AT_CLEANUP
@@ -284,8 +284,8 @@ NPAR TESTS
 AT_CHECK([pspp -O format=csv npar.sps], [0], [dnl
 Table: Binomial Test
 ,,Category,N,Observed Prop.,Test Prop.,Exact Sig. (2-tailed)
-x,Group1,10.000,10.000,.435,.500,.678
-,Group2,20.000,13.000,.565,,
+x,Group 1,10.000,10.000,.435,.500,.678
+,Group 2,20.000,13.000,.565,,
 ,Total,,23.000,1.000,,
 ])
 AT_CLEANUP
@@ -344,7 +344,7 @@ NPAR TESTS
 
 AT_CHECK([pspp -O format=csv npar.sps], [0], [dnl
 Table: x
-,Observed N,Expected N,Residual
+Value,Observed N,Expected N,Residual
 1.00,3.00,2.33,.67
 2.00,3.00,2.33,.67
 3.10,4.00,2.33,1.67
@@ -354,7 +354,7 @@ Table: x
 Total,14.00,,
 
 Table: y
-,Observed N,Expected N,Residual
+Value,Observed N,Expected N,Residual
 1.00,7.00,3.50,3.50
 2.00,4.00,3.50,.50
 3.00,1.00,3.50,-2.50
@@ -362,13 +362,12 @@ Table: y
 Total,14.00,,
 
 Table: Test Statistics
-,x,y
-Chi-Square,3.14,6.00
-df,5,3
-Asymp. Sig.,.678,.112
+,Chi-square,df,Asymp. Sig.
+x,3.14,5,.678
+y,6.00,3,.112
 
 Table: y
-,Observed N,Expected N,Residual
+Value,Observed N,Expected N,Residual
 1.00,7.00,2.63,4.38
 2.00,4.00,3.50,.50
 3.00,1.00,4.38,-3.38
@@ -376,10 +375,8 @@ Table: y
 Total,14.00,,
 
 Table: Test Statistics
-,y
-Chi-Square,10.61
-df,3
-Asymp. Sig.,.014
+,Chi-square,df,Asymp. Sig.
+y,10.61,3,.014
 
 Table: Frequencies
 ,x,,,,y,,,
@@ -390,10 +387,9 @@ Table: Frequencies
 Total,,10.00,,,,7.00,,
 
 Table: Test Statistics
-,x,y
-Chi-Square,.13,4.13
-df,2,2
-Asymp. Sig.,.936,.127
+,Chi-square,df,Asymp. Sig.
+x,.13,2,.936
+y,4.13,2,.127
 ])
 
 AT_CLEANUP
@@ -420,13 +416,11 @@ NPAR TESTS
 ])
 
 AT_CHECK([pspp -O format=csv npar.sps], [1], [dnl
-"error: CHISQUARE test specified 6 expected values, but 4 distinct values were encountered in variable y."
+"error: CHISQUARE test specified 6 expected values, but variable y has 4 distinct values."
 
 Table: Test Statistics
-,y
-Chi-Square,.00
-df,0
-Asymp. Sig.,1.000
+,Chi-square,df,Asymp. Sig.
+y,.00,0,1.000
 ])
 
 AT_CLEANUP
@@ -435,7 +429,7 @@ AT_SETUP([NPAR TESTS CHISQUARE with DESCRIPTIVES])
 AT_DATA([npar.sps], [dnl
 DATA LIST NOTABLE LIST /x * y * w * .
 BEGIN DATA.
-1   2  1 
+1   2  1
 2   1  3
 3.1 1  4
 3.2 2  1
@@ -471,14 +465,12 @@ Table: Frequencies
 Total,,12.00,,,,15.00,,
 
 Table: Test Statistics
-,x,y
-Chi-Square,17.33,22.87
-df,7,7
-Asymp. Sig.,.015,.002
+,Chi-square,df,Asymp. Sig.
+x,17.33,7,.015
+y,22.87,7,.002
 
 Table: Descriptive Statistics
 ,N,Mean,Std. Deviation,Minimum,Maximum
-,,,,,
 x,12.00,2.47,1.19,1.00,5.00
 y,15.00,2.07,1.33,1.00,5.00
 ])
@@ -488,7 +480,7 @@ AT_SETUP([NPAR TESTS CHISQUARE, listwise missing])
 AT_DATA([npar.sps], [dnl
 DATA LIST NOTABLE LIST /x * y * w * .
 BEGIN DATA.
-1   2  1 
+1   2  1
 2   1  3
 3.1 1  4
 3.2 2  1
@@ -524,14 +516,12 @@ Table: Frequencies
 Total,,14.00,,,,14.00,,
 
 Table: Test Statistics
-,x,y
-Chi-Square,13.43,26.00
-df,7,7
-Asymp. Sig.,.062,.001
+,Chi-square,df,Asymp. Sig.
+x,13.43,7,.062
+y,26.00,7,.001
 
 Table: Descriptive Statistics
 ,N,Mean,Std. Deviation,Minimum,Maximum
-,,,,,
 x,14.00,2.69,1.23,1.00,5.00
 y,14.00,1.86,1.10,1.00,4.00
 ])
@@ -603,7 +593,7 @@ begin data.
 12.00      .00   1
 12.00      .00   1
 34.2       .     1
-12.00     1.00   1  
+12.00     1.00   1
 13.00     1.00   1
 end data
 
@@ -640,7 +630,7 @@ set format = F9.3.
 data list notable list /age * height rank *.
 begin data.
 10 12 11
-12 13 13 
+12 13 13
 13 14 12
 12 12 10
 9   9 10
@@ -654,7 +644,7 @@ npar tests
        .
 ])
 AT_CHECK([pspp -o pspp.csv npar.sps])
-dnl Some machines return .313 instead of .312 
+dnl Some machines return .313 instead of .312
 dnl (see bug #31611).
 AT_CHECK([sed -e 's/\.313$/.312/' -e 's/^Exact Sig\. (1-tailed),\.313/Exact Sig. (1-tailed),.312/' pspp.csv], [0], [dnl
 Table: Frequencies
@@ -696,7 +686,7 @@ begin data
 1 101
 2 82
 2 124
-3 149 
+3 149
 3 166
 3 147
 end data.
@@ -711,20 +701,20 @@ npar tests
        .
 ])
 
-AT_CHECK([pspp -o pspp.csv kw-simple.sps])
+AT_CHECK([pspp -o pspp.csv -o pspp.txt kw-simple.sps])
 AT_CHECK([cat pspp.csv], [0], [dnl
 Table: Ranks
-,gv,N,Mean Rank
+,,N,Mean Rank
 xscore,timed out,5,4.400
 ,hit wicket,5,7.400
 ,handled the ball,4,11.500
 ,Total,14,
 
 Table: Test Statistics
-,,xscore
-Chi-Square,,6.406
-df,,2
-Asymp. Sig.,,.041
+,xscore
+Chi-Square,6.406
+df,2
+Asymp. Sig.,.041
 ])
 
 
@@ -745,7 +735,7 @@ begin data
 2 135
 2 109
 3 115
-3 149 
+3 149
 3 166
 3 147
 2.5 344
@@ -769,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
 
 
@@ -781,14 +809,14 @@ data list notable list /gv * xscore * yscore.
 begin data
 1 96   .
 1 128  .
-1 83   . 
+1 83   .
 2 132  132
 2 135  135
 2 109  109
 3 115  115
-1 61   . 
+1 61   .
 1 101  .
-2 82   82 
+2 82   82
 2 124  124
 3 149  149
 3 166  166
@@ -807,7 +835,7 @@ value label /gv
        4 "bowled"
        5 "lbw"
        .
-       
+
 npar tests
        /k-w xscore yscore by gv (1, 5)
        .
@@ -818,7 +846,7 @@ npar tests
 AT_CHECK([pspp -o pspp.csv kw-multi.sps])
 AT_CHECK([cat pspp.csv], [0], [dnl
 Table: Ranks
-,gv,N,Mean Rank
+,,N,Mean Rank
 xscore,timed out,5,4.400
 ,hit wicket,5,7.400
 ,handled the ball,4,11.500
@@ -829,10 +857,10 @@ yscore,hit wicket,5,7.400
 ,Total,14,
 
 Table: Test Statistics
-,,xscore,yscore,
-Chi-Square,,6.406,6.406,
-df,,2,2,
-Asymp. Sig.,,.041,.041,
+,xscore,yscore
+Chi-Square,6.406,6.406
+df,2,2
+Asymp. Sig.,.041,.041
 ])
 
 AT_CLEANUP
@@ -846,40 +874,40 @@ data list notable list /score * w *.
 begin data
 4     6
 .     4
-4     3 
-3    20 
-2    29 
-1    42 
-6    18 
-5     7 
-6    78 
-5    10 
-6    46 
-5     5 
-6    17 
-5     1 
-6    11 
-4     2 
-3     7 
-2     6 
-1    10 
-4    13 
-3    22 
-3    11 
-2    24 
-1    18 
-4     4 
-3    12 
-2    10 
-1    25 
-4     4 
-3     7 
-2     3 
-1     4 
-4     2 
-3     3 
-2     2 
-1     4 
+4     3
+3    20
+2    29
+1    42
+6    18
+5     7
+6    78
+5    10
+6    46
+5     5
+6    17
+5     1
+6    11
+4     2
+3     7
+2     6
+1    10
+4    13
+3    22
+3    11
+2    24
+1    18
+4     4
+3    12
+2    10
+1    25
+4     4
+3     7
+2     3
+1     4
+4     2
+3     3
+2     2
+1     4
 end data.
 
 weight by w.
@@ -887,7 +915,7 @@ weight by w.
 npar tests
        /runs (MEDIAN) = score
        /runs (MEAN) = score
-       /runs (MODE) = score 
+       /runs (MODE) = score
        .
 ])
 
@@ -900,7 +928,7 @@ Cases ≥ Test Value,309.0000
 Total Cases,486.0000
 Number of Runs,12
 Z,-20.9931
-Asymp. Sig. (2-tailed),2.000
+Asymp. Sig. (2-tailed),.000
 
 Table: Runs Test
 ,score
@@ -910,7 +938,7 @@ Cases ≥ Test Value,227.0000
 Total Cases,486.0000
 Number of Runs,12
 Z,-21.0650
-Asymp. Sig. (2-tailed),2.000
+Asymp. Sig. (2-tailed),.000
 
 Table: Runs Test
 ,score
@@ -920,7 +948,7 @@ Cases ≥ Test Value,170.0000
 Total Cases,486.0000
 Number of Runs,11
 Z,-21.0742
-Asymp. Sig. (2-tailed),2.000
+Asymp. Sig. (2-tailed),.000
 ])
 
 AT_CLEANUP
@@ -995,35 +1023,35 @@ SET FORMAT     = F11.4
 
 data list notable list /height * sex (f1.0).
 begin data.
-201 1            
-84 1            
-83 1            
-94 1            
-88 0            
-99 0            
-55 0            
-69 0            
-86 1            
-79 1            
-91 0            
-201 0            
-88 1            
-85 1            
-82 1            
-88 0            
-75 0            
-99 0            
-81 0            
-72 1            
-89 1            
-92 1            
-80 0            
-82 0            
-76 0            
-65 0            
-85 0            
-76 1            
-145 1            
+201 1
+84 1
+83 1
+94 1
+88 0
+99 0
+55 0
+69 0
+86 1
+79 1
+91 0
+201 0
+88 1
+85 1
+82 1
+88 0
+75 0
+99 0
+81 0
+72 1
+89 1
+92 1
+80 0
+82 0
+76 0
+65 0
+85 0
+76 1
+145 1
 24 1
 1 4
 -4 5
@@ -1031,15 +1059,16 @@ begin data.
 21 4
 end data.
 
-NPAR TESTS 
+NPAR TESTS
      /M-W = height BY sex (0,1).
 ])
 
 AT_CHECK([pspp -O format=csv npar-mann-whitney.sps], [0], [dnl
 Table: Ranks
-,N,,,Mean Rank,,Sum of Ranks,
-,0,1,Total,0,1,0,1
-height,15.0000,15.0000,30.0000,14.5333,16.4667,218.0000,247.0000
+,,N,Mean Rank,Sum of Ranks
+height,0,15,14.5333,218.0000
+,1,15,16.4667,247.0000
+,Total,30,,
 
 Table: Test Statistics
 ,Mann-Whitney U,Wilcoxon W,Z,Asymp. Sig. (2-tailed)
@@ -1054,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
@@ -1067,7 +1096,7 @@ VARIABLE LABELS
   I002_02 'IOS: Freunde'
   I002_03 'IOS: Partner*in'
   I002_04 'IOS: Bekannte'.
-  
+
 MISSING VALUES I002_01 I002_02 I002_03 I002_04 (-9 -1).
 
 NPAR TESTS
@@ -1077,12 +1106,19 @@ NPAR TESTS
 
 AT_CHECK([pspp -O format=csv npar-mann-whitney.sps], [0], [dnl
 Table: Ranks
-,N,,,Mean Rank,,Sum of Ranks,
-,.000,1.000,Total,.000,1.000,.000,1.000
-IOS: Familie,114.000,115.000,229.000,110.018,119.939,12542.000,13793.000
-IOS: Freunde,115.000,115.000,230.000,108.339,122.661,12459.000,14106.000
-IOS: Partner*in,97.000,91.000,188.000,95.351,93.593,9249.000,8517.000
-IOS: Bekannte,115.000,115.000,230.000,111.065,119.935,12772.500,13792.500
+,,N,Mean Rank,Sum of Ranks
+IOS: Familie,.000,114,110.018,12542.000
+,1.000,115,119.939,13793.000
+,Total,229,,
+IOS: Freunde,.000,115,108.339,12459.000
+,1.000,115,122.661,14106.000
+,Total,230,,
+IOS: Partner*in,.000,97,95.351,9249.000
+,1.000,91,93.593,8517.000
+,Total,188,,
+IOS: Bekannte,.000,115,111.065,12772.500
+,1.000,115,119.935,13792.500
+,Total,230,,
 
 Table: Test Statistics
 ,Mann-Whitney U,Wilcoxon W,Z,Asymp. Sig. (2-tailed)
@@ -1102,18 +1138,18 @@ set format f11.3.
 
 data list notable list /v1 * v2 * v3 * v4 * v5 * v6 * v7 *.
 begin data.
-2 1 1 2 1 1 2 
-2 2 2 2 1 1 1  
-1 1 2 2 1 1 2  
-2 2 2 2 1 1 2 
-2 1 2 1 1 2 1 
-1 2 2 1 1 1 1 
-1 2 2 2 2 2 2 
-2 2 1 2 1 1 1 
-1 2 1 2 1 1 2 
-end data.     
-
-npar tests 
+2 1 1 2 1 1 2
+2 2 2 2 1 1 1
+1 1 2 2 1 1 2
+2 2 2 2 1 1 2
+2 1 2 1 1 2 1
+1 2 2 1 1 1 1
+1 2 2 2 2 2 2
+2 2 1 2 1 1 1
+1 2 1 2 1 1 2
+end data.
+
+npar tests
        /cochran = v1 to v7 .
 
 ])
@@ -1133,6 +1169,7 @@ v6,2,7
 v7,5,4
 
 Table: Test Statistics
+,Value
 N,9
 Cochran's Q,12.735
 df,6
@@ -1149,37 +1186,37 @@ SET FORMAT F14.3.
 
 data list notable list /v1 * v2 * v3
 begin data.
- 7  7  2 
- 5  6  5 
- 8  6  4 
- 5  7  4 
- 5  4  4 
- 8  6  5 
- 6  3  5 
- 7  6  5 
+ 7  7  2
+ 5  6  5
+ 8  6  4
+ 5  7  4
+ 5  4  4
+ 8  6  5
+ 6  3  5
+ 7  6  5
  8  5  5
- .  2  2 
- 5  4  5 
- 3  4  4 
- 5  1  2 
- 5  2  1 
- 7  6  5 
- 6  3  4 
- 6  6  6 
- 5  4  5 
- 4  3  4 
- 9  1  1 
- 6  2  1 
- 3  7  8 
- 6  3  4 
- 4  4  4 
- 5  4  3 
- 6  5  2 
- 4  4  8 
- 4  6  4 
- 6  5  5 
- 7  8  6 
- 5  3  5 
+ .  2  2
+ 5  4  5
+ 3  4  4
+ 5  1  2
+ 5  2  1
+ 7  6  5
+ 6  3  4
+ 6  6  6
+ 5  4  5
+ 4  3  4
+ 9  1  1
+ 6  2  1
+ 3  7  8
+ 6  3  4
+ 4  4  4
+ 5  4  3
+ 6  5  2
+ 4  4  8
+ 4  6  4
+ 6  5  5
+ 7  8  6
+ 5  3  5
 end data.
 
 npar tests
@@ -1236,7 +1273,7 @@ begin data.
 1 1 1
 end data.
 
-npar tests 
+npar tests
      /mcnemar = v1 WITH v2 junk.
 ])
 
@@ -1262,6 +1299,50 @@ v1 & junk,20,.453,.227,.164
 AT_CLEANUP
 
 
+AT_SETUP([NPAR TESTS McNemar Symetricity])
+
+AT_DATA([mcnemar.sps], [dnl
+data list notable list /var1 var2 w (F2.0).
+begin data
+0 0 9
+0 1 8
+1 0 1
+1 1 5
+end data.
+
+weight by w.
+
+NPAR TEST
+       /MCNEMAR var1 WITH  var2 (PAIRED).
+
+NPAR TEST
+       /MCNEMAR var2 WITH  var1 (PAIRED).
+])
+
+AT_CHECK([pspp -O format=csv mcnemar.sps], [0], [dnl
+Table: var1 & var2
+var1,var2,
+,0,1
+0,9,8
+1,1,5
+
+Table: Test Statistics
+,N,Exact Sig. (2-tailed),Exact Sig. (1-tailed),Point Probability
+var1 & var2,23,.039,.020,.02
+
+Table: var2 & var1
+var2,var1,
+,0,1
+0,9,1
+1,8,5
+
+Table: Test Statistics
+,N,Exact Sig. (2-tailed),Exact Sig. (1-tailed),Point Probability
+var2 & var1,23,.039,.020,.02
+])
+
+AT_CLEANUP
+
 AT_SETUP([NPAR TESTS Kolmogorov-Smirnov Uniform parameters given])
 
 AT_DATA([ks-uniform.sps], [dnl
@@ -1309,22 +1390,22 @@ begin data.
 65 12.5
 59 14.2
 43 12.6
-57 
-68 
-79 
-51 
-62 
-57  
-73 
-58 
-58 
-68 
-75 
-47 
-70 
-59 
-71 
-52 
+57
+68
+79
+51
+62
+57
+73
+58
+58
+68
+75
+47
+70
+59
+71
+52
 48 13.0
 58 14.1
 37 15.0
@@ -1335,19 +1416,19 @@ begin data.
 86 14.0
 63 12.5
 80 12.8
-70 
-63 
-53 
-53 
-48 
-49 
-51 
-47 
-81 
-66 
-78 
+70
+63
+53
+53
+48
+49
+51
+47
+81
+66
+78
 65
-69 
+69
 70 12.1
 63 12.5
 64 12.4
@@ -1369,14 +1450,14 @@ begin data.
 66 12.8
 82 12.9
 81 13.6
-46 
-52 
-71 
-73 
-58 
-57 
-46 
-58 
+46
+52
+71
+73
+58
+57
+46
+58
 52 13.5
 71 13.2
 57 12.8
@@ -1437,42 +1518,42 @@ begin data.
 65 13.0
 64 12.5
 66 12.0
-55 
-62 
-58 
-48 
-67 
-46 
-36 
-61 
-55 
-77 
-74 
-60 
-70  
-69 
-57 
-49 
-63 
-69 
-63 
-76 
-53 
-54 
-42 
-64 
-66 
-61 
-62 
-73 
-73 
-60 
-79 
-40 
-48 
-76 
-60 
-76 
+55
+62
+58
+48
+67
+46
+36
+61
+55
+77
+74
+60
+70
+69
+57
+49
+63
+69
+63
+76
+53
+54
+42
+64
+66
+61
+62
+73
+73
+60
+79
+40
+48
+76
+60
+76
 54
 69
 65
@@ -1482,7 +1563,7 @@ begin data.
 82
 end data.
 
-npar tests 
+npar tests
        /k-s (normal) = foo bar.
 ])
 
@@ -1738,7 +1819,7 @@ x,4,24.000,29.500,65.000,15.902,-2.232,.026
 
 AT_CLEANUP
 
-dnl Checks that (PAIRED) can have lists where the same 
+dnl Checks that (PAIRED) can have lists where the same
 dnl variable appears more than once.
 AT_SETUP([NPAR TESTS (PAIRED)])
 AT_DATA([npar.sps], [dnl
@@ -1850,4 +1931,4 @@ NPAR TESTS
 AT_CHECK([pspp -O format=csv npar.sps], [1], [ignore])
 
 AT_CLEANUP
\ No newline at end of file
+