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 *.
82 ECHO 'P < 0.5; N1/N2 > 1' .
86 DATA LIST LIST NOTABLE /x * w *.
100 ECHO 'P < 0.5; N1/N2 = 1' .
104 DATA LIST LIST NOTABLE /x * w *.
116 ECHO 'P > 0.5; N1/N2 < 1' .
120 DATA LIST LIST NOTABLE /x * w *.
133 ECHO 'P > 0.5; N1/N2 > 1' .
137 DATA LIST LIST NOTABLE /x * w *.
148 ECHO 'P > 0.5; N1/N2 == 1' .
152 DATA LIST LIST NOTABLE /x * w *.
164 ECHO 'P == 0.5; N1/N2 < 1' .
168 DATA LIST LIST NOTABLE /x * w *.
181 ECHO 'P == 0.5; N1/N2 > 1' .
185 DATA LIST LIST NOTABLE /x * w *.
196 ECHO 'P == 0.5; N1/N2 == 1' .
200 DATA LIST LIST NOTABLE /x * w *.
212 if [ $? -ne 0 ] ; then no_result ; fi
215 activity="run program 1"
216 $SUPERVISOR $PSPP --testing-mode $TESTFILE
217 if [ $? -ne 0 ] ; then no_result ; fi
219 activity="compare output 1"
220 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
221 diff -b $TEMPDIR/pspp.list - << EOF
223 1.1 NPAR TESTS. Binomial Test
224 +-+------#--------+--+--------------+----------+---------------------+
225 | | #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
226 +-+------#--------+--+--------------+----------+---------------------+
227 |x|Group1# 1.00| 6| .286| .300| .551|
228 | |Group2# 2.00|15| .714| | |
229 | |Total # |21| 1.00| | |
230 +-+------#--------+--+--------------+----------+---------------------+
232 2.1 NPAR TESTS. Binomial Test
233 +-+------#--------+--+--------------+----------+---------------------+
234 | | #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
235 +-+------#--------+--+--------------+----------+---------------------+
236 |x|Group1# 1.00| 7| .538| .400| .229|
237 | |Group2# 2.00| 6| .462| | |
238 | |Total # |13| 1.00| | |
239 +-+------#--------+--+--------------+----------+---------------------+
241 3.1 NPAR TESTS. Binomial Test
242 +-+------#--------+--+--------------+----------+---------------------+
243 | | #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
244 +-+------#--------+--+--------------+----------+---------------------+
245 |x|Group1# 1.00| 8| .500| .400| .284|
246 | |Group2# 2.00| 8| .500| | |
247 | |Total # |16| 1.00| | |
248 +-+------#--------+--+--------------+----------+---------------------+
250 4.1 NPAR TESTS. Binomial Test
251 +-+------#--------+--+--------------+----------+---------------------+
252 | | #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
253 +-+------#--------+--+--------------+----------+---------------------+
254 |x|Group1# 1.00|11| .478| .600| .164|
255 | |Group2# 2.00|12| .522| | |
256 | |Total # |23| 1.00| | |
257 +-+------#--------+--+--------------+----------+---------------------+
259 5.1 NPAR TESTS. Binomial Test
260 +-+------#--------+--+--------------+----------+---------------------+
261 | | #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
262 +-+------#--------+--+--------------+----------+---------------------+
263 |x|Group1# 1.00|11| .550| .600| .404|
264 | |Group2# 2.00| 9| .450| | |
265 | |Total # |20| 1.00| | |
266 +-+------#--------+--+--------------+----------+---------------------+
268 6.1 NPAR TESTS. Binomial Test
269 +-+------#--------+--+--------------+----------+---------------------+
270 | | #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
271 +-+------#--------+--+--------------+----------+---------------------+
272 |x|Group1# 1.00|11| .500| .600| .228|
273 | |Group2# 2.00|11| .500| | |
274 | |Total # |22| 1.00| | |
275 +-+------#--------+--+--------------+----------+---------------------+
277 7.1 NPAR TESTS. Binomial Test
278 +-+------#--------+--+--------------+----------+---------------------+
279 | | #Category| N|Observed Prop.|Test Prop.|Exact Sig. (2-tailed)|
280 +-+------#--------+--+--------------+----------+---------------------+
281 |x|Group1# 1.00| 8| .348| .500| .210|
282 | |Group2# 2.00|15| .652| | |
283 | |Total # |23| 1.00| | |
284 +-+------#--------+--+--------------+----------+---------------------+
286 8.1 NPAR TESTS. Binomial Test
287 +-+------#--------+--+--------------+----------+---------------------+
288 | | #Category| N|Observed Prop.|Test Prop.|Exact Sig. (2-tailed)|
289 +-+------#--------+--+--------------+----------+---------------------+
290 |x|Group1# 1.00|12| .667| .500| .238|
291 | |Group2# 2.00| 6| .333| | |
292 | |Total # |18| 1.00| | |
293 +-+------#--------+--+--------------+----------+---------------------+
295 9.1 NPAR TESTS. Binomial Test
296 +-+------#--------+--+--------------+----------+---------------------+
297 | | #Category| N|Observed Prop.|Test Prop.|Exact Sig. (2-tailed)|
298 +-+------#--------+--+--------------+----------+---------------------+
299 |x|Group1# 1.00|10| .500| .500| 1.000|
300 | |Group2# 2.00|10| .500| | |
301 | |Total # |20| 1.00| | |
302 +-+------#--------+--+--------------+----------+---------------------+
304 if [ $? -ne 0 ] ; then fail ; fi