12986d07e1936bac6e7f3d2e7b1c880cd6c015ce
[pspp-builds.git] / tests / command / t-test-1-indep-val.sh
1 #!/bin/sh
2
3 # This program tests that the T-TEST /GROUPS command works properly 
4 # when a single value in the independent variable is given.
5
6 TEMPDIR=/tmp/pspp-tst-$$
7 TESTFILE=$TEMPDIR/`basename $0`.sps
8
9 here=`pwd`;
10
11 # ensure that top_srcdir is absolute
12 cd $top_srcdir; top_srcdir=`pwd`
13
14 export STAT_CONFIG_PATH=$top_srcdir/config
15
16
17 cleanup()
18 {
19      rm -rf $TEMPDIR
20 }
21
22
23 fail()
24 {
25     echo $activity
26     echo FAILED
27     cleanup;
28     exit 1;
29 }
30
31
32 no_result()
33 {
34     echo $activity
35     echo NO RESULT;
36     cleanup;
37     exit 2;
38 }
39
40 pass()
41 {
42     cleanup;
43     exit 0;
44 }
45
46 mkdir -p $TEMPDIR
47
48 cd $TEMPDIR
49
50 activity="create program"
51 cat > $TESTFILE <<EOF
52 data list list /INDEP * DEP *.
53 begin data.
54        1        6
55        1        6
56        1        7
57        1        6
58        1       13
59        1        4
60        1        7
61        1        9
62        1        7
63        1       12
64        1       11
65        2       11
66        2        9
67        2        8
68        2        4
69        2       16
70        2        9
71        2        9
72        2        5
73        2        4
74        2       10
75        2       14
76 end data.
77 t-test /groups=indep(1.514) /var=dep.
78 EOF
79 if [ $? -ne 0 ] ; then no_result ; fi
80
81
82 activity="run program"
83 $SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE
84 if [ $? -ne 0 ] ; then no_result ; fi
85
86
87 activity="compare output"
88 diff -B -b $TEMPDIR/pspp.list - <<EOF
89 1.1 DATA LIST.  Reading free-form data from the command file.
90 +--------+------+
91 |Variable|Format|
92 #========#======#
93 |INDEP   |F8.0  |
94 |DEP     |F8.0  |
95 +--------+------+
96
97 2.1 T-TEST.  Group Statistics
98 #===========#==#====#==============#========#
99 #     INDEP | N|Mean|Std. Deviation|SE. Mean#
100 #===========#==#====#==============#========#
101 #DEP < 1.514|11|8.00|         2.864|    .863#
102 #    >=1.514|11|9.00|         3.821|   1.152#
103 #===========#==#====#==============#========#
104
105 2.2 T-TEST.  Independent Samples Test
106 #==============================#=========#===============================================================================#
107 #                              #Levene's |                          t-test for Equality of Means                         #
108 #                              #----+----+-----+------+---------------+---------------+---------------------+------------#
109 #                              #    |    |     |      |               |               |                     |    95%     #
110 #                              #    |    |     |      |               |               |                     +------+-----#
111 #                              #  F |Sig.|  t  |  df  |Sig. (2-tailed)|Mean Difference|Std. Error Difference| Lower|Upper#
112 #==============================#====#====#=====#======#===============#===============#=====================#======#=====#
113 #DEPEqual variances assumed    #.172|.683|-.695|    20|           .495|         -1.000|                1.440|-4.003|2.003#
114 #   Equal variances not assumed#    |    |-.695|18.539|           .496|         -1.000|                1.440|-4.018|2.018#
115 #==============================#====#====#=====#======#===============#===============#=====================#======#=====#
116 EOF
117 if [ $? -ne 0 ] ; then fail ; fi
118
119
120 pass