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"
61 # Tests for exact calculations
62 activity="create file 1"
64 ECHO 'P < 0.5; N1/N2 < 1' .
68 DATA LIST LIST NOTABLE /x * w *.
81 ECHO 'P < 0.5; N1/N2 > 1' .
85 DATA LIST LIST NOTABLE /x * w *.
99 ECHO 'P < 0.5; N1/N2 = 1' .
103 DATA LIST LIST NOTABLE /x * w *.
115 ECHO 'P > 0.5; N1/N2 < 1' .
119 DATA LIST LIST NOTABLE /x * w *.
132 ECHO 'P > 0.5; N1/N2 > 1' .
136 DATA LIST LIST NOTABLE /x * w *.
147 ECHO 'P > 0.5; N1/N2 == 1' .
151 DATA LIST LIST NOTABLE /x * w *.
163 ECHO 'P == 0.5; N1/N2 < 1' .
167 DATA LIST LIST NOTABLE /x * w *.
180 ECHO 'P == 0.5; N1/N2 > 1' .
184 DATA LIST LIST NOTABLE /x * w *.
195 ECHO 'P == 0.5; N1/N2 == 1' .
199 DATA LIST LIST NOTABLE /x * w *.
211 if [ $? -ne 0 ] ; then no_result ; fi
214 activity="run program 1"
215 $SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE
216 if [ $? -ne 0 ] ; then no_result ; fi
218 activity="compare output 1"
219 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
220 diff -b $TEMPDIR/pspp.list - << EOF
222 1.1 NPAR TESTS. Binomial Test
223 +-+------#--------+--+--------------+----------+---------------------+
224 | | #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
225 +-+------#--------+--+--------------+----------+---------------------+
226 |x|Group1# 1.00| 6| .286| .300| .551|
227 | |Group2# 2.00|15| .714| | |
228 | |Total # |21| 1.00| | |
229 +-+------#--------+--+--------------+----------+---------------------+
231 2.1 NPAR TESTS. Binomial Test
232 +-+------#--------+--+--------------+----------+---------------------+
233 | | #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
234 +-+------#--------+--+--------------+----------+---------------------+
235 |x|Group1# 1.00| 7| .538| .400| .229|
236 | |Group2# 2.00| 6| .462| | |
237 | |Total # |13| 1.00| | |
238 +-+------#--------+--+--------------+----------+---------------------+
240 3.1 NPAR TESTS. Binomial Test
241 +-+------#--------+--+--------------+----------+---------------------+
242 | | #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
243 +-+------#--------+--+--------------+----------+---------------------+
244 |x|Group1# 1.00| 8| .500| .400| .284|
245 | |Group2# 2.00| 8| .500| | |
246 | |Total # |16| 1.00| | |
247 +-+------#--------+--+--------------+----------+---------------------+
249 4.1 NPAR TESTS. Binomial Test
250 +-+------#--------+--+--------------+----------+---------------------+
251 | | #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
252 +-+------#--------+--+--------------+----------+---------------------+
253 |x|Group1# 1.00|11| .478| .600| .164|
254 | |Group2# 2.00|12| .522| | |
255 | |Total # |23| 1.00| | |
256 +-+------#--------+--+--------------+----------+---------------------+
258 5.1 NPAR TESTS. Binomial Test
259 +-+------#--------+--+--------------+----------+---------------------+
260 | | #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
261 +-+------#--------+--+--------------+----------+---------------------+
262 |x|Group1# 1.00|11| .550| .600| .404|
263 | |Group2# 2.00| 9| .450| | |
264 | |Total # |20| 1.00| | |
265 +-+------#--------+--+--------------+----------+---------------------+
267 6.1 NPAR TESTS. Binomial Test
268 +-+------#--------+--+--------------+----------+---------------------+
269 | | #Category| N|Observed Prop.|Test Prop.|Exact Sig. (1-tailed)|
270 +-+------#--------+--+--------------+----------+---------------------+
271 |x|Group1# 1.00|11| .500| .600| .228|
272 | |Group2# 2.00|11| .500| | |
273 | |Total # |22| 1.00| | |
274 +-+------#--------+--+--------------+----------+---------------------+
276 7.1 NPAR TESTS. Binomial Test
277 +-+------#--------+--+--------------+----------+---------------------+
278 | | #Category| N|Observed Prop.|Test Prop.|Exact Sig. (2-tailed)|
279 +-+------#--------+--+--------------+----------+---------------------+
280 |x|Group1# 1.00| 8| .348| .500| .210|
281 | |Group2# 2.00|15| .652| | |
282 | |Total # |23| 1.00| | |
283 +-+------#--------+--+--------------+----------+---------------------+
285 8.1 NPAR TESTS. Binomial Test
286 +-+------#--------+--+--------------+----------+---------------------+
287 | | #Category| N|Observed Prop.|Test Prop.|Exact Sig. (2-tailed)|
288 +-+------#--------+--+--------------+----------+---------------------+
289 |x|Group1# 1.00|12| .667| .500| .238|
290 | |Group2# 2.00| 6| .333| | |
291 | |Total # |18| 1.00| | |
292 +-+------#--------+--+--------------+----------+---------------------+
294 9.1 NPAR TESTS. Binomial Test
295 +-+------#--------+--+--------------+----------+---------------------+
296 | | #Category| N|Observed Prop.|Test Prop.|Exact Sig. (2-tailed)|
297 +-+------#--------+--+--------------+----------+---------------------+
298 |x|Group1# 1.00|10| .500| .500| 1.000|
299 | |Group2# 2.00|10| .500| | |
300 | |Total # |20| 1.00| | |
301 +-+------#--------+--+--------------+----------+---------------------+
303 if [ $? -ne 0 ] ; then fail ; fi