From: Ben Pfaff Date: Sat, 2 Oct 2010 22:01:54 +0000 (-0700) Subject: NPAR TESTS: Convert BINOMAL tests to Autotest framework. X-Git-Tag: v0.7.6~118 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a67571068a8d01da4a810c65bc230cea2b1d7a3f;p=pspp-builds.git NPAR TESTS: Convert BINOMAL tests to Autotest framework. --- diff --git a/tests/automake.mk b/tests/automake.mk index 90db8c5b..43d2c07b 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -10,7 +10,6 @@ TESTS_ENVIRONMENT += LC_ALL=C TESTS_ENVIRONMENT += EXEEXT=$(EXEEXT) dist_TESTS = \ - tests/command/npar-binomial.sh \ tests/command/npar-chisquare.sh \ tests/command/npar-wilcoxon.sh \ tests/command/npar-sign.sh \ @@ -384,6 +383,7 @@ TESTSUITE_AT = \ tests/language/stats/factor.at \ tests/language/stats/flip.at \ tests/language/stats/frequencies.at \ + tests/language/stats/npar.at \ tests/language/stats/oneway.at \ tests/language/utilities/insert.at \ tests/language/utilities/set.at \ diff --git a/tests/command/npar-binomial.sh b/tests/command/npar-binomial.sh deleted file mode 100755 index 050c66b9..00000000 --- a/tests/command/npar-binomial.sh +++ /dev/null @@ -1,346 +0,0 @@ -#!/bin/sh - -# This program tests the BINOMIAL subcommand of the NPAR TESTS command. - -TEMPDIR=/tmp/pspp-tst-$$ -TESTFILE=$TEMPDIR/`basename $0`.sps - -# ensure that top_srcdir and top_builddir are absolute -if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi -if [ -z "$top_builddir" ] ; then top_builddir=. ; fi -top_srcdir=`cd $top_srcdir; pwd` -top_builddir=`cd $top_builddir; pwd` - -PSPP=$top_builddir/src/ui/terminal/pspp$EXEEXT - -STAT_CONFIG_PATH=$top_srcdir/config -export STAT_CONFIG_PATH - -LANG=C -export LANG - - -cleanup() -{ - if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then - echo "NOT cleaning $TEMPDIR" - return ; - fi - cd / - rm -rf $TEMPDIR -} - - -fail() -{ - echo $activity - echo FAILED - cleanup; - exit 1; -} - - -no_result() -{ - echo $activity - echo NO RESULT; - cleanup; - exit 2; -} - -pass() -{ - cleanup; - exit 0; -} - -mkdir -p $TEMPDIR - -cd $TEMPDIR - - -# Tests for exact calculations -activity="create file 1" -cat < $TESTFILE -ECHO 'P < 0.5; N1/N2 < 1' . - -NEW FILE. - -DATA LIST LIST NOTABLE /x * w *. -BEGIN DATA. -1 6 -2 15 -END DATA. - -WEIGHT BY w. - -SET FORMAT F8.3. - -NPAR TESTS - /BINOMIAL(0.3) = x - . - - -ECHO 'P < 0.5; N1/N2 > 1' . - -NEW FILE. - - - -DATA LIST LIST NOTABLE /x (F8.0) w (F8.0). -BEGIN DATA. -1 7 -2 6 -END DATA. - -WEIGHT BY w. - -NPAR TESTS - /BINOMIAL(0.4) = x - . - - - -ECHO 'P < 0.5; N1/N2 = 1' . - -NEW FILE. - -DATA LIST LIST NOTABLE /x (F8.0) w (F8.0). -BEGIN DATA. -1 8 -2 8 -END DATA. - -WEIGHT BY w. - -NPAR TESTS - /BINOMIAL(0.4) = x - . - -ECHO 'P > 0.5; N1/N2 < 1' . - -NEW FILE. - -DATA LIST LIST NOTABLE /x (F8.0) w (F8.0). -BEGIN DATA. -1 11 -2 12 -END DATA. - -WEIGHT BY w. - -NPAR TESTS - /BINOMIAL(0.6) = x - . - - -ECHO 'P > 0.5; N1/N2 > 1' . - -NEW FILE. - -DATA LIST LIST NOTABLE /x (F8.0) w (F8.0). -BEGIN DATA. -1 11 -2 9 -END DATA. - -WEIGHT BY w. - -NPAR TESTS - /BINOMIAL(0.6) = x - -ECHO 'P > 0.5; N1/N2 == 1' . - -NEW FILE. - -DATA LIST LIST NOTABLE /x (F8.0) w (F8.0). -BEGIN DATA. -1 11 -2 11 -END DATA. - -WEIGHT BY w. - -NPAR TESTS - /BINOMIAL(0.6) = x - . - -ECHO 'P == 0.5; N1/N2 < 1' . - -NEW FILE. - -DATA LIST LIST NOTABLE /x (F8.0) w (F8.0). -BEGIN DATA. -1 8 -2 15 -END DATA. - -WEIGHT BY w. - -NPAR TESTS - /BINOMIAL = x - . - - -ECHO 'P == 0.5; N1/N2 > 1' . - -NEW FILE. - -DATA LIST LIST NOTABLE /x (F8.0) w (F8.0). -BEGIN DATA. -1 12 -2 6 -END DATA. - -WEIGHT BY w. - -NPAR TESTS - /BINOMIAL(0.5) = x - -ECHO 'P == 0.5; N1/N2 == 1' . - -NEW FILE. - -DATA LIST LIST NOTABLE /x (F8.0) w (F8.0). -BEGIN DATA. -1 10 -2 10 -END DATA. - -WEIGHT BY w. - -NPAR TESTS - /BINOMIAL(0.5) = x - . - -ECHO 'P == 0.5; N1/N2 == 1 Cutpoint' . - -DATA LIST LIST NOTABLE /x * w *. -BEGIN DATA. -9 3 -10 7 -11 16 -END DATA. - -WEIGHT BY w. - -NPAR TESTS - /BINOMIAL(0.5) = x (10) - . - -ECHO 'P == 0.5; N1/N2 == 1 Named values' . - -DATA LIST LIST NOTABLE /x * w *. -BEGIN DATA. -10 10 -15 45 -20 13 -END DATA. - -WEIGHT BY w. - -NPAR TESTS - /BINOMIAL(0.5) = x (10, 20) - . -EOF -if [ $? -ne 0 ] ; then no_result ; fi - - -activity="run program 1" -$SUPERVISOR $PSPP -o pspp.csv $TESTFILE -if [ $? -ne 0 ] ; then no_result ; fi - -activity="compare output 1" -diff -c $TEMPDIR/pspp.csv - << EOF -P < 0.5; N1/N2 < 1 - -Table: Binomial Test -,,Category,N,Observed Prop.,Test Prop.,Exact Sig. (1-tailed) -x,Group1,1.00,6.00,.286,.300,.551 -,Group2,2.00,15.00,.714,, -,Total,,21.00,1.000,, - -P < 0.5; N1/N2 > 1 - -Table: Binomial Test -,,Category,N,Observed Prop.,Test Prop.,Exact Sig. (1-tailed) -x,Group1,1,7,.538,.400,.229 -,Group2,2,6,.462,, -,Total,,13,1.000,, - -P < 0.5; N1/N2 = 1 - -Table: Binomial Test -,,Category,N,Observed Prop.,Test Prop.,Exact Sig. (1-tailed) -x,Group1,1,8,.500,.400,.284 -,Group2,2,8,.500,, -,Total,,16,1.000,, - -P > 0.5; N1/N2 < 1 - -Table: Binomial Test -,,Category,N,Observed Prop.,Test Prop.,Exact Sig. (1-tailed) -x,Group1,1,11,.478,.600,.164 -,Group2,2,12,.522,, -,Total,,23,1.000,, - -P > 0.5; N1/N2 > 1 - -Table: Binomial Test -,,Category,N,Observed Prop.,Test Prop.,Exact Sig. (1-tailed) -x,Group1,1,11,.550,.600,.404 -,Group2,2,9,.450,, -,Total,,20,1.000,, - -P > 0.5; N1/N2 == 1 - -Table: Binomial Test -,,Category,N,Observed Prop.,Test Prop.,Exact Sig. (1-tailed) -x,Group1,1,11,.500,.600,.228 -,Group2,2,11,.500,, -,Total,,22,1.000,, - -P == 0.5; N1/N2 < 1 - -Table: Binomial Test -,,Category,N,Observed Prop.,Test Prop.,Exact Sig. (2-tailed) -x,Group1,1,8,.348,.500,.210 -,Group2,2,15,.652,, -,Total,,23,1.000,, - -P == 0.5; N1/N2 > 1 - -Table: Binomial Test -,,Category,N,Observed Prop.,Test Prop.,Exact Sig. (2-tailed) -x,Group1,1,12,.667,.500,.238 -,Group2,2,6,.333,, -,Total,,18,1.000,, - -P == 0.5; N1/N2 == 1 - -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,, -,Total,,20,1.000,, - -P == 0.5; N1/N2 == 1 Cutpoint - -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,, -,Total,,26.000,1.000,, - -P == 0.5; N1/N2 == 1 Named values - -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,, -,Total,,23.000,1.000,, -EOF -if [ $? -ne 0 ] ; then fail ; fi - - -pass; diff --git a/tests/language/stats/npar.at b/tests/language/stats/npar.at new file mode 100644 index 00000000..01636269 --- /dev/null +++ b/tests/language/stats/npar.at @@ -0,0 +1,276 @@ +AT_BANNER([NPAR TESTS]) + +AT_SETUP([NPAR TESTS BINOMIAL, P < 0.5; N1/N2 < 1]) +AT_DATA([npar.sps], [dnl +SET FORMAT F8.3. + +DATA LIST LIST NOTABLE /x * w *. +BEGIN DATA. +1 6 +2 15 +END DATA. + +WEIGHT BY w. + +NPAR TESTS + /BINOMIAL(0.3) = x + . +]) +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,, +,Total,,21.000,1.000,, +]) +AT_CLEANUP + +AT_SETUP([NPAR TESTS BINOMIAL, P < 0.5; N1/N2 > 1]) +AT_DATA([npar.sps], [dnl +SET FORMAT F8.3. + +DATA LIST LIST NOTABLE /x (F8.0) w (F8.0). +BEGIN DATA. +1 7 +2 6 +END DATA. + +WEIGHT BY w. + +NPAR TESTS + /BINOMIAL(0.4) = x + . +]) +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,, +,Total,,13,1.000,, +]) +AT_CLEANUP + +AT_SETUP([NPAR TESTS BINOMIAL, P < 0.5; N1/N2 = 1]) +AT_DATA([npar.sps], [dnl +SET FORMAT F8.3. + +DATA LIST LIST NOTABLE /x (F8.0) w (F8.0). +BEGIN DATA. +1 8 +2 8 +END DATA. + +WEIGHT BY w. + +NPAR TESTS + /BINOMIAL(0.4) = x + . +]) +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,, +,Total,,16,1.000,, +]) +AT_CLEANUP + +AT_SETUP([NPAR TESTS BINOMIAL, P > 0.5; N1/N2 < 1]) +AT_DATA([npar.sps], [dnl +SET FORMAT F8.3. + +DATA LIST LIST NOTABLE /x (F8.0) w (F8.0). +BEGIN DATA. +1 11 +2 12 +END DATA. + +WEIGHT BY w. + +NPAR TESTS + /BINOMIAL(0.6) = x + . +]) +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,, +,Total,,23,1.000,, +]) +AT_CLEANUP + +AT_SETUP([NPAR TESTS BINOMIAL, P > 0.5; N1/N2 > 1]) +AT_DATA([npar.sps], [dnl +SET FORMAT F8.3. + +DATA LIST LIST NOTABLE /x (F8.0) w (F8.0). +BEGIN DATA. +1 11 +2 9 +END DATA. + +WEIGHT BY w. + +NPAR TESTS + /BINOMIAL(0.6) = x. +]) +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,, +,Total,,20,1.000,, +]) +AT_CLEANUP + +AT_SETUP([NPAR TESTS BINOMIAL, P > 0.5; N1/N2 = 1]) +AT_DATA([npar.sps], [dnl +SET FORMAT F8.3. + +DATA LIST LIST NOTABLE /x (F8.0) w (F8.0). +BEGIN DATA. +1 11 +2 11 +END DATA. + +WEIGHT BY w. + +NPAR TESTS + /BINOMIAL(0.6) = x. +]) +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,, +,Total,,22,1.000,, +]) +AT_CLEANUP + +AT_SETUP([NPAR TESTS BINOMIAL, P = 0.5; N1/N2 < 1]) +AT_DATA([npar.sps], [dnl +SET FORMAT F8.3. + +DATA LIST LIST NOTABLE /x (F8.0) w (F8.0). +BEGIN DATA. +1 8 +2 15 +END DATA. + +WEIGHT BY w. + +NPAR TESTS + /BINOMIAL = x + . +]) +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,, +,Total,,23,1.000,, +]) +AT_CLEANUP + +AT_SETUP([NPAR TESTS BINOMIAL, P = 0.5; N1/N2 > 1]) +AT_DATA([npar.sps], [dnl +SET FORMAT F8.3. + +DATA LIST LIST NOTABLE /x (F8.0) w (F8.0). +BEGIN DATA. +1 12 +2 6 +END DATA. + +WEIGHT BY w. + +NPAR TESTS + /BINOMIAL(0.5) = x. +]) +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,, +,Total,,18,1.000,, +]) +AT_CLEANUP + +AT_SETUP([NPAR TESTS BINOMIAL, P = 0.5; N1/N2 = 1]) +AT_DATA([npar.sps], [dnl +SET FORMAT F8.3. + +DATA LIST LIST NOTABLE /x (F8.0) w (F8.0). +BEGIN DATA. +1 10 +2 10 +END DATA. + +WEIGHT BY w. + +NPAR TESTS + /BINOMIAL(0.5) = x + . +]) +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,, +,Total,,20,1.000,, +]) +AT_CLEANUP + +AT_SETUP([NPAR TESTS BINOMIAL, P = 0.5; N1/N2 = 1 Cutpoint]) +AT_DATA([npar.sps], [dnl +SET FORMAT F8.3. + +DATA LIST LIST NOTABLE /x * w *. +BEGIN DATA. +9 3 +10 7 +11 16 +END DATA. + +WEIGHT BY w. + +NPAR TESTS + /BINOMIAL(0.5) = x (10) + . +]) +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,, +,Total,,26.000,1.000,, +]) +AT_CLEANUP + +AT_SETUP([NPAR TESTS BINOMIAL, P = 0.5; N1/N2 = 1 Named values]) +AT_DATA([npar.sps], [dnl +SET FORMAT F8.3. + +DATA LIST LIST NOTABLE /x * w *. +BEGIN DATA. +10 10 +15 45 +20 13 +END DATA. + +WEIGHT BY w. + +NPAR TESTS + /BINOMIAL(0.5) = x (10, 20) + . +]) +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,, +,Total,,23.000,1.000,, +]) +AT_CLEANUP +