From: John Darrington Date: Tue, 12 Oct 2010 08:09:51 +0000 (+0200) Subject: Added tests for the Kruskal Wallis test X-Git-Tag: v0.7.6~32 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3c602fb3492edf1e623d07187eb34f2e5720370;p=pspp-builds.git Added tests for the Kruskal Wallis test --- diff --git a/tests/language/stats/npar.at b/tests/language/stats/npar.at index b2797a51..83701276 100644 --- a/tests/language/stats/npar.at +++ b/tests/language/stats/npar.at @@ -629,3 +629,164 @@ Exact Sig. (1-tailed),.312,.500 Point Probability,.250,.312 ]) AT_CLEANUP + + +AT_SETUP([NPAR Kruskal-Wallis test]) + +dnl Simple case +AT_DATA([kw-simple.sps], [dnl +set format = F9.3. + +data list notable list /gv * xscore *. +begin data +1 96 +1 128 +1 83 +2 132 +2 135 +2 109 +3 115 +1 61 +1 101 +2 82 +2 124 +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 (1, 3) + . +]) + +AT_CHECK([pspp -o pspp.csv kw-simple.sps]) +AT_CHECK([cat pspp.csv], [0], [dnl +Table: Ranks +,gv,N,Mean Rank +xscore,timed out,5,4.400 +,handled the ball,4,11.500 +,hit wicket,5,7.400 +,Total,14, + +Table: Test Statistics +,,xscore +Chi-Square,,6.406 +df,,2 +Asymp. Sig.,,.041 +]) + + +dnl Now try a missing value in the group variable +AT_DATA([kw-missing-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 +2.5 344 +end data. + +missing values gv (2.5). + +value label /gv + 1 "timed out" + 2 "hit wicket" + 3 "handled the ball". + +npar tests + /kruskal-wallis xscore by gv (1, 3) + /missing=exclude + . +]) + +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]) + +AT_CLEANUP + + +AT_SETUP([NPAR Kruskal-Wallis multiple-variables]) + +AT_DATA([kw-multi.sps], [dnl +set format = F9.3. + +data list notable list /gv * xscore * yscore. +begin data +1 96 . +1 128 . +1 83 . +2 132 132 +2 135 135 +2 109 109 +3 115 115 +1 61 . +1 101 . +2 82 82 +2 124 124 +3 149 149 +3 166 166 +3 147 147 +4 . 96 +4 . 128 +4 . 83 +4 . 61 +4 . 101 +end data. + +value label /gv + 1 "timed out" + 2 "hit wicket" + 3 "handled the ball" + 4 "bowled" + 5 "lbw" + . + +npar tests + /k-w xscore yscore by gv (1, 5) + . + +]) + + +AT_CHECK([pspp -o pspp.csv kw-multi.sps]) +AT_CHECK([cat pspp.csv], [0], [dnl +Table: Ranks +,gv,N,Mean Rank +xscore,timed out,5,4.400 +,handled the ball,4,11.500 +,hit wicket,5,7.400 +,Total,14, +yscore,handled the ball,4,11.500 +,bowled,5,4.400 +,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, +]) + +AT_CLEANUP \ No newline at end of file