3 # This program tests the BINOMIAL subcommand of the NPAR TESTS command.
5 TEMPDIR=/tmp/pspp-tst-$$
6 TESTFILE=$TEMPDIR/`basename $0`.sps
8 # ensure that top_srcdir and top_builddir are absolute
9 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
10 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
11 top_srcdir=`cd $top_srcdir; pwd`
12 top_builddir=`cd $top_builddir; pwd`
14 PSPP=$top_builddir/src/ui/terminal/pspp
16 STAT_CONFIG_PATH=$top_srcdir/config
17 export STAT_CONFIG_PATH
25 if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then
26 echo "NOT cleaning $TEMPDIR"
62 # Tests for exact calculations
63 activity="create file 1"
65 ECHO 'P < 0.5; N1/N2 < 1' .
69 DATA LIST LIST NOTABLE /x * w *.
84 ECHO 'P < 0.5; N1/N2 > 1' .
90 DATA LIST LIST NOTABLE /x (F8.0) w (F8.0).
104 ECHO 'P < 0.5; N1/N2 = 1' .
108 DATA LIST LIST NOTABLE /x (F8.0) w (F8.0).
120 ECHO 'P > 0.5; N1/N2 < 1' .
124 DATA LIST LIST NOTABLE /x (F8.0) w (F8.0).
137 ECHO 'P > 0.5; N1/N2 > 1' .
141 DATA LIST LIST NOTABLE /x (F8.0) w (F8.0).
152 ECHO 'P > 0.5; N1/N2 == 1' .
156 DATA LIST LIST NOTABLE /x (F8.0) w (F8.0).
168 ECHO 'P == 0.5; N1/N2 < 1' .
172 DATA LIST LIST NOTABLE /x (F8.0) w (F8.0).
185 ECHO 'P == 0.5; N1/N2 > 1' .
189 DATA LIST LIST NOTABLE /x (F8.0) w (F8.0).
200 ECHO 'P == 0.5; N1/N2 == 1' .
204 DATA LIST LIST NOTABLE /x (F8.0) w (F8.0).
216 ECHO 'P == 0.5; N1/N2 == 1 Cutpoint' .
218 DATA LIST LIST NOTABLE /x * w *.
228 /BINOMIAL(0.5) = x (10)
231 ECHO 'P == 0.5; N1/N2 == 1 Named values' .
233 DATA LIST LIST NOTABLE /x * w *.
243 /BINOMIAL(0.5) = x (10, 20)
246 if [ $? -ne 0 ] ; then no_result ; fi
249 activity="run program 1"
250 $SUPERVISOR $PSPP --testing-mode $TESTFILE
251 if [ $? -ne 0 ] ; then no_result ; fi
253 activity="compare output 1"
254 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
255 diff -b $TEMPDIR/pspp.list - << EOF
257 1.1 NPAR TESTS. Binomial Test
258 +-+------#--------+-----+--------------+----------+---------------------+
259 | | #Category| N |Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
260 +-+------#--------+-----+--------------+----------+---------------------+
261 |x|Group1# 1.00| 6.00| .286| .300| .551|
262 | |Group2# 2.00|15.00| .714| | |
263 | |Total # |21.00| 1.000| | |
264 +-+------#--------+-----+--------------+----------+---------------------+
266 2.1 NPAR TESTS. Binomial Test
267 +-+------#--------+--+--------------+----------+---------------------+
268 | | #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
269 +-+------#--------+--+--------------+----------+---------------------+
270 |x|Group1# 1| 7| .538| .400| .229|
271 | |Group2# 2| 6| .462| | |
272 | |Total # |13| 1.000| | |
273 +-+------#--------+--+--------------+----------+---------------------+
275 3.1 NPAR TESTS. Binomial Test
276 +-+------#--------+--+--------------+----------+---------------------+
277 | | #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
278 +-+------#--------+--+--------------+----------+---------------------+
279 |x|Group1# 1| 8| .500| .400| .284|
280 | |Group2# 2| 8| .500| | |
281 | |Total # |16| 1.000| | |
282 +-+------#--------+--+--------------+----------+---------------------+
284 4.1 NPAR TESTS. Binomial Test
285 +-+------#--------+--+--------------+----------+---------------------+
286 | | #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
287 +-+------#--------+--+--------------+----------+---------------------+
288 |x|Group1# 1|11| .478| .600| .164|
289 | |Group2# 2|12| .522| | |
290 | |Total # |23| 1.000| | |
291 +-+------#--------+--+--------------+----------+---------------------+
293 5.1 NPAR TESTS. Binomial Test
294 +-+------#--------+--+--------------+----------+---------------------+
295 | | #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
296 +-+------#--------+--+--------------+----------+---------------------+
297 |x|Group1# 1|11| .550| .600| .404|
298 | |Group2# 2| 9| .450| | |
299 | |Total # |20| 1.000| | |
300 +-+------#--------+--+--------------+----------+---------------------+
302 6.1 NPAR TESTS. Binomial Test
303 +-+------#--------+--+--------------+----------+---------------------+
304 | | #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
305 +-+------#--------+--+--------------+----------+---------------------+
306 |x|Group1# 1|11| .500| .600| .228|
307 | |Group2# 2|11| .500| | |
308 | |Total # |22| 1.000| | |
309 +-+------#--------+--+--------------+----------+---------------------+
311 7.1 NPAR TESTS. Binomial Test
312 +-+------#--------+--+--------------+----------+---------------------+
313 | | #Category| N|Observed Prop.|Test Prop.|Exact Sig. (2-tailed)|
314 +-+------#--------+--+--------------+----------+---------------------+
315 |x|Group1# 1| 8| .348| .500| .210|
316 | |Group2# 2|15| .652| | |
317 | |Total # |23| 1.000| | |
318 +-+------#--------+--+--------------+----------+---------------------+
320 8.1 NPAR TESTS. Binomial Test
321 +-+------#--------+--+--------------+----------+---------------------+
322 | | #Category| N|Observed Prop.|Test Prop.|Exact Sig. (2-tailed)|
323 +-+------#--------+--+--------------+----------+---------------------+
324 |x|Group1# 1|12| .667| .500| .238|
325 | |Group2# 2| 6| .333| | |
326 | |Total # |18| 1.000| | |
327 +-+------#--------+--+--------------+----------+---------------------+
329 9.1 NPAR TESTS. Binomial Test
330 +-+------#--------+--+--------------+----------+---------------------+
331 | | #Category| N|Observed Prop.|Test Prop.|Exact Sig. (2-tailed)|
332 +-+------#--------+--+--------------+----------+---------------------+
333 |x|Group1# 1|10| .500| .500| 1.000|
334 | |Group2# 2|10| .500| | |
335 | |Total # |20| 1.000| | |
336 +-+------#--------+--+--------------+----------+---------------------+
337 P == 0.5; N1/N2 == 1 Cutpoint
338 10.1 NPAR TESTS. Binomial Test
339 +-+------#--------+------+--------------+----------+---------------------+
340 | | #Category| N |Observed Prop.|Test Prop.|Exact Sig. (2-tailed)|
341 +-+------#--------+------+--------------+----------+---------------------+
342 |x|Group1# <= 10|10.000| .385| .500| .327|
343 | |Group2# |16.000| .615| | |
344 | |Total # |26.000| 1.000| | |
345 +-+------#--------+------+--------------+----------+---------------------+
346 P == 0.5; N1/N2 == 1 Named values
347 11.1 NPAR TESTS. Binomial Test
348 +-+------#--------+------+--------------+----------+---------------------+
349 | | #Category| N |Observed Prop.|Test Prop.|Exact Sig. (2-tailed)|
350 +-+------#--------+------+--------------+----------+---------------------+
351 |x|Group1# 10.000|10.000| .435| .500| .678|
352 | |Group2# 20.000|13.000| .565| | |
353 | |Total # |23.000| 1.000| | |
354 +-+------#--------+------+--------------+----------+---------------------+
356 if [ $? -ne 0 ] ; then fail ; fi