X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Flanguage%2Fstats%2Fnpar.at;h=10889a412356ca28f5484600a3b2ad3bcba55b29;hb=b9a1a1c32d5589e208ea751911d35177b7751720;hp=3f620147626acf17d2bfb1f4ba06c99dcf9fdef8;hpb=dd415397beff015f3e9dabde00c95db263c99768;p=pspp diff --git a/tests/language/stats/npar.at b/tests/language/stats/npar.at index 3f62014762..10889a4123 100644 --- a/tests/language/stats/npar.at +++ b/tests/language/stats/npar.at @@ -1,6 +1,22 @@ +dnl PSPP - a program for statistical analysis. +dnl Copyright (C) 2017 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 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 You should have received a copy of the GNU General Public License +dnl along with this program. If not, see . +dnl AT_BANNER([NPAR TESTS]) -AT_SETUP([NPAR TESTS BINOMIAL, P < 0.5; N1/N2 < 1]) +AT_SETUP([NPAR TESTS BINOMIAL P < 0.5; N1/N2 < 1]) AT_DATA([npar.sps], [dnl SET FORMAT F8.3. @@ -19,13 +35,13 @@ 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 -AT_SETUP([NPAR TESTS BINOMIAL, P < 0.5; N1/N2 > 1]) +AT_SETUP([NPAR TESTS BINOMIAL P < 0.5; N1/N2 > 1]) AT_DATA([npar.sps], [dnl SET FORMAT F8.3. @@ -44,13 +60,13 @@ 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 -AT_SETUP([NPAR TESTS BINOMIAL, P < 0.5; N1/N2 = 1]) +AT_SETUP([NPAR TESTS BINOMIAL P < 0.5; N1/N2 = 1]) AT_DATA([npar.sps], [dnl SET FORMAT F8.3. @@ -69,13 +85,13 @@ 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 -AT_SETUP([NPAR TESTS BINOMIAL, P > 0.5; N1/N2 < 1]) +AT_SETUP([NPAR TESTS BINOMIAL P > 0.5; N1/N2 < 1]) AT_DATA([npar.sps], [dnl SET FORMAT F8.3. @@ -94,13 +110,13 @@ 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 -AT_SETUP([NPAR TESTS BINOMIAL, P > 0.5; N1/N2 > 1]) +AT_SETUP([NPAR TESTS BINOMIAL P > 0.5; N1/N2 > 1]) AT_DATA([npar.sps], [dnl SET FORMAT F8.3. @@ -118,13 +134,13 @@ 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 -AT_SETUP([NPAR TESTS BINOMIAL, P > 0.5; N1/N2 = 1]) +AT_SETUP([NPAR TESTS BINOMIAL P > 0.5; N1/N2 = 1]) AT_DATA([npar.sps], [dnl SET FORMAT F8.3. @@ -142,13 +158,13 @@ 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 -AT_SETUP([NPAR TESTS BINOMIAL, P = 0.5; N1/N2 < 1]) +AT_SETUP([NPAR TESTS BINOMIAL P = 0.5; N1/N2 < 1]) AT_DATA([npar.sps], [dnl SET FORMAT F8.3. @@ -167,13 +183,13 @@ 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 -AT_SETUP([NPAR TESTS BINOMIAL, P = 0.5; N1/N2 > 1]) +AT_SETUP([NPAR TESTS BINOMIAL P = 0.5; N1/N2 > 1]) AT_DATA([npar.sps], [dnl SET FORMAT F8.3. @@ -191,13 +207,13 @@ 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 -AT_SETUP([NPAR TESTS BINOMIAL, P = 0.5; N1/N2 = 1]) +AT_SETUP([NPAR TESTS BINOMIAL P = 0.5; N1/N2 = 1]) AT_DATA([npar.sps], [dnl SET FORMAT F8.3. @@ -216,13 +232,13 @@ 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 -AT_SETUP([NPAR TESTS BINOMIAL, P = 0.5; N1/N2 = 1 Cutpoint]) +AT_SETUP([NPAR TESTS BINOMIAL P = 0.5; N1/N2 = 1 Cutpoint]) AT_DATA([npar.sps], [dnl SET FORMAT F8.3. @@ -242,13 +258,13 @@ 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 -AT_SETUP([NPAR TESTS BINOMIAL, P = 0.5; N1/N2 = 1 Named values]) +AT_SETUP([NPAR TESTS BINOMIAL P = 0.5; N1/N2 = 1 Named values]) AT_DATA([npar.sps], [dnl SET FORMAT F8.3. @@ -268,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 @@ -328,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 @@ -338,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 @@ -346,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 @@ -360,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,,, @@ -374,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 @@ -404,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 @@ -455,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 ]) @@ -508,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 ]) @@ -695,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 ]) @@ -802,7 +808,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 @@ -813,10 +819,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 @@ -1008,7 +1014,11 @@ begin data. 85 0 76 1 145 1 -24 1 +24 1 +1 4 +-4 5 +34 5 +21 4 end data. NPAR TESTS @@ -1017,9 +1027,10 @@ NPAR TESTS 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) @@ -1030,6 +1041,59 @@ height,98.0000,218.0000,-.6020,.547 AT_CLEANUP +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 . + +AT_DATA([npar-mann-whitney.sps], [dnl +SET FORMAT = F11.3 + +DATA LIST NOTABLE FILE='mann-whitney.txt' + LIST /I002_01 I002_02 I002_03 I002_04 sum_HL *. + +VARIABLE LABELS + I002_01 'IOS: Familie' + 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 + /MISSING=ANALYSIS + /M-W=I002_01 I002_02 I002_03 I002_04 BY sum_HL (0 1). +]) + +AT_CHECK([pspp -O format=csv npar-mann-whitney.sps], [0], [dnl +Table: Ranks +,,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) +IOS: Familie,5987.000,12542.000,-1.167,.243 +IOS: Freunde,5789.000,12459.000,-1.674,.094 +IOS: Partner*in,4331.000,8517.000,-.245,.807 +IOS: Bekannte,6102.500,12772.500,-1.046,.296 +]) + +AT_CLEANUP + + + AT_SETUP([NPAR TESTS Cochran]) AT_DATA([npar-cochran.sps], [dnl set format f11.3. @@ -1067,6 +1131,7 @@ v6,2,7 v7,5,4 Table: Test Statistics +,Value N,9 Cochran's Q,12.735 df,6 @@ -1176,14 +1241,14 @@ npar tests AT_CHECK([pspp -O format=csv mcnemar.sps], [0], [dnl Table: v1 & v2 -v1,v2, -,.000,1.000 +,v2, +v1,.000,1.000 .000,4,9 1.000,2,5 Table: v1 & junk -v1,junk, -,.000,1.000 +,junk, +v1,.000,1.000 .000,8,5 1.000,2,5 @@ -1738,3 +1803,50 @@ NPAR TEST AT_CHECK([pspp -O format=csv npar.sps], [1], [ignore]) AT_CLEANUP + + +AT_SETUP([NPAR TESTS - crash on invalid syntax]) + +AT_DATA([npar.sps], [dnl +data list notable list /ev * xscore *. +begin data. +2 109 +3 115 +1 61 +1 101 +3 147 +end data. + + +npar tests + /kruskal-wallis xscore by(gv (1, 3). +]) + +AT_CHECK([pspp -O format=csv npar.sps], [1], [ignore]) + +AT_CLEANUP + + + + +AT_SETUP([NPAR TESTS - crash on unterminated string]) + +AT_DATA([npar.sps], [dnl +DATA LIST NOTABLE LIST /x * y * w * . +BEGIN DATA. +3.1 1 4 +3.2 2 1 +4 2 6 +END DATA. + + +NPAR TESTS +" CHISQUARE=x y(-2,5) + /STATISTICS=DESCRIPTIVES + . +]) + +AT_CHECK([pspp -O format=csv npar.sps], [1], [ignore]) + +AT_CLEANUP +