Rewrite PSPP output engine.
[pspp-builds.git] / tests / command / npar-binomial.sh
index db7b9763197da9e35cdd31553ec510195f3edb79..9a776f6ba6ab6584ab1206e377614149bc3eac72 100755 (executable)
@@ -26,6 +26,7 @@ cleanup()
        echo "NOT cleaning $TEMPDIR"
        return ; 
      fi
+     cd /
      rm -rf $TEMPDIR
 }
 
@@ -73,6 +74,8 @@ END DATA.
 
 WEIGHT BY w.
 
+SET FORMAT F8.3.
+
 NPAR TESTS
        /BINOMIAL(0.3) = x
        .
@@ -82,7 +85,9 @@ ECHO 'P < 0.5; N1/N2 > 1' .
 
 NEW FILE.
 
-DATA LIST LIST NOTABLE /x * w *.
+
+
+DATA LIST LIST NOTABLE /x (F8.0) w (F8.0).
 BEGIN DATA.
 1   7
 2   6
@@ -100,7 +105,7 @@ ECHO 'P < 0.5; N1/N2 = 1' .
 
 NEW FILE.
 
-DATA LIST LIST NOTABLE /x * w *.
+DATA LIST LIST NOTABLE /x (F8.0) w (F8.0).
 BEGIN DATA.
 1   8
 2   8
@@ -116,7 +121,7 @@ ECHO 'P > 0.5; N1/N2 < 1' .
 
 NEW FILE.
 
-DATA LIST LIST NOTABLE /x * w *.
+DATA LIST LIST NOTABLE /x (F8.0) w (F8.0).
 BEGIN DATA.
 1   11
 2   12
@@ -133,7 +138,7 @@ ECHO 'P > 0.5; N1/N2 > 1' .
 
 NEW FILE.
 
-DATA LIST LIST NOTABLE /x * w *.
+DATA LIST LIST NOTABLE /x (F8.0) w (F8.0).
 BEGIN DATA.
 1   11
 2   9
@@ -148,7 +153,7 @@ ECHO 'P > 0.5; N1/N2 == 1' .
 
 NEW FILE.
 
-DATA LIST LIST NOTABLE /x * w *.
+DATA LIST LIST NOTABLE /x (F8.0) w (F8.0).
 BEGIN DATA.
 1   11
 2   11
@@ -164,7 +169,7 @@ ECHO 'P == 0.5; N1/N2 < 1' .
 
 NEW FILE.
 
-DATA LIST LIST NOTABLE /x * w *.
+DATA LIST LIST NOTABLE /x (F8.0) w (F8.0).
 BEGIN DATA.
 1   8
 2   15
@@ -181,7 +186,7 @@ ECHO 'P == 0.5; N1/N2 > 1' .
 
 NEW FILE.
 
-DATA LIST LIST NOTABLE /x * w *.
+DATA LIST LIST NOTABLE /x (F8.0) w (F8.0).
 BEGIN DATA.
 1   12
 2   6
@@ -196,7 +201,7 @@ ECHO 'P == 0.5; N1/N2 == 1' .
 
 NEW FILE.
 
-DATA LIST LIST NOTABLE /x * w *.
+DATA LIST LIST NOTABLE /x (F8.0) w (F8.0).
 BEGIN DATA.
 1   10
 2   10
@@ -207,98 +212,133 @@ 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 --testing-mode -o raw-ascii $TESTFILE
+$SUPERVISOR $PSPP --testing-mode $TESTFILE
 if [ $? -ne 0 ] ; then no_result ; fi
 
 activity="compare output 1"
-perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
-diff $TEMPDIR/pspp.list - << EOF
+diff -c $TEMPDIR/pspp.csv - << EOF
 P < 0.5; N1/N2 < 1
-1.1 NPAR TESTS.  Binomial Test
-+-+------#--------+--+--------------+----------+---------------------+
-| |      #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
-+-+------#--------+--+--------------+----------+---------------------+
-|x|Group1#    1.00| 6|          .286|      .300|                 .551|
-| |Group2#    2.00|15|          .714|          |                     |
-| |Total #        |21|          1.00|          |                     |
-+-+------#--------+--+--------------+----------+---------------------+
+
+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
-2.1 NPAR TESTS.  Binomial Test
-+-+------#--------+--+--------------+----------+---------------------+
-| |      #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
-+-+------#--------+--+--------------+----------+---------------------+
-|x|Group1#    1.00| 7|          .538|      .400|                 .229|
-| |Group2#    2.00| 6|          .462|          |                     |
-| |Total #        |13|          1.00|          |                     |
-+-+------#--------+--+--------------+----------+---------------------+
+
+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
-3.1 NPAR TESTS.  Binomial Test
-+-+------#--------+--+--------------+----------+---------------------+
-| |      #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
-+-+------#--------+--+--------------+----------+---------------------+
-|x|Group1#    1.00| 8|          .500|      .400|                 .284|
-| |Group2#    2.00| 8|          .500|          |                     |
-| |Total #        |16|          1.00|          |                     |
-+-+------#--------+--+--------------+----------+---------------------+
+
+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
-4.1 NPAR TESTS.  Binomial Test
-+-+------#--------+--+--------------+----------+---------------------+
-| |      #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
-+-+------#--------+--+--------------+----------+---------------------+
-|x|Group1#    1.00|11|          .478|      .600|                 .164|
-| |Group2#    2.00|12|          .522|          |                     |
-| |Total #        |23|          1.00|          |                     |
-+-+------#--------+--+--------------+----------+---------------------+
+
+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
-5.1 NPAR TESTS.  Binomial Test
-+-+------#--------+--+--------------+----------+---------------------+
-| |      #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
-+-+------#--------+--+--------------+----------+---------------------+
-|x|Group1#    1.00|11|          .550|      .600|                 .404|
-| |Group2#    2.00| 9|          .450|          |                     |
-| |Total #        |20|          1.00|          |                     |
-+-+------#--------+--+--------------+----------+---------------------+
+
+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
-6.1 NPAR TESTS.  Binomial Test
-+-+------#--------+--+--------------+----------+---------------------+
-| |      #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
-+-+------#--------+--+--------------+----------+---------------------+
-|x|Group1#    1.00|11|          .500|      .600|                 .228|
-| |Group2#    2.00|11|          .500|          |                     |
-| |Total #        |22|          1.00|          |                     |
-+-+------#--------+--+--------------+----------+---------------------+
+
+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
-7.1 NPAR TESTS.  Binomial Test
-+-+------#--------+--+--------------+----------+---------------------+
-| |      #Category| N|Observed Prop.|Test Prop.|Exact Sig. (2-tailed)|
-+-+------#--------+--+--------------+----------+---------------------+
-|x|Group1#    1.00| 8|          .348|      .500|                 .210|
-| |Group2#    2.00|15|          .652|          |                     |
-| |Total #        |23|          1.00|          |                     |
-+-+------#--------+--+--------------+----------+---------------------+
+
+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
-8.1 NPAR TESTS.  Binomial Test
-+-+------#--------+--+--------------+----------+---------------------+
-| |      #Category| N|Observed Prop.|Test Prop.|Exact Sig. (2-tailed)|
-+-+------#--------+--+--------------+----------+---------------------+
-|x|Group1#    1.00|12|          .667|      .500|                 .238|
-| |Group2#    2.00| 6|          .333|          |                     |
-| |Total #        |18|          1.00|          |                     |
-+-+------#--------+--+--------------+----------+---------------------+
+
+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
-9.1 NPAR TESTS.  Binomial Test
-+-+------#--------+--+--------------+----------+---------------------+
-| |      #Category| N|Observed Prop.|Test Prop.|Exact Sig. (2-tailed)|
-+-+------#--------+--+--------------+----------+---------------------+
-|x|Group1#    1.00|10|          .500|      .500|                1.000|
-| |Group2#    2.00|10|          .500|          |                     |
-| |Total #        |20|          1.00|          |                     |
-+-+------#--------+--+--------------+----------+---------------------+
+
+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