Checkin of new directory structure.
[pspp-builds.git] / tests / command / t-test-groups.sh
1 #!/bin/sh
2
3 # This program tests that the T-TEST /GROUPS command works
4
5 TEMPDIR=/tmp/pspp-tst-$$
6 TESTFILE=$TEMPDIR/`basename $0`.sps
7
8 # ensure that top_builddir  are absolute
9 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
10 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
11 top_builddir=`cd $top_builddir; pwd`
12
13 # ensure that top_srcdir is absolute
14 top_srcdir=`cd $top_srcdir; pwd`
15
16 STAT_CONFIG_PATH=$top_srcdir/config
17 export STAT_CONFIG_PATH
18
19
20 cleanup()
21 {
22      cd /
23      rm -rf $TEMPDIR
24 }
25
26
27 fail()
28 {
29     echo $activity
30     echo FAILED
31     cleanup;
32     exit 1;
33 }
34
35
36 no_result()
37 {
38     echo $activity
39     echo NO RESULT;
40     cleanup;
41     exit 2;
42 }
43
44 pass()
45 {
46     cleanup;
47     exit 0;
48 }
49
50 mkdir -p $TEMPDIR
51
52 cd $TEMPDIR
53
54 activity="create program"
55 cat > $TESTFILE <<EOF
56 data list list /ID * INDEP * DEP1 * DEP2 *.
57 begin data.
58 1  1.1 1 3
59 2  1.1 2 4
60 3  1.1 2 4 
61 4  1.1 2 4 
62 5  1.1 3 5
63 6  2.1 3 1
64 7  2.1 4 2
65 8  2.1 4 2
66 9  2.1 4 2
67 10 2.1 5 3
68 11 3.1 2 2
69 end data.
70
71 * Note that this last case should be IGNORED since it doesn't have a dependent variable of either 1 or 2
72
73 t-test /GROUPS=indep(1.1,2.1) /var=dep1 dep2.
74 EOF
75 if [ $? -ne 0 ] ; then no_result ; fi
76
77
78 activity="run program"
79 $SUPERVISOR $top_builddir/src/pspp -o raw-ascii $TESTFILE
80 if [ $? -ne 0 ] ; then no_result ; fi
81
82 activity="compare output"
83 perl -pi -e s/^\s*\$//g $TEMPDIR/pspp.list
84 diff  -b $TEMPDIR/pspp.list - <<EOF | perl -e 's/^\s*$//g'
85 1.1 DATA LIST.  Reading free-form data from INLINE.
86 +--------+------+
87 |Variable|Format|
88 #========#======#
89 |ID      |F8.0  |
90 |INDEP   |F8.0  |
91 |DEP1    |F8.0  |
92 |DEP2    |F8.0  |
93 +--------+------+
94
95 2.1 T-TEST.  Group Statistics
96 #==========#=#====#==============#========#
97 #     INDEP|N|Mean|Std. Deviation|SE. Mean#
98 #==========#=#====#==============#========#
99 #DEP1 1.1  |5|2.00|          .707|    .316#
100 #     2.1  |5|4.00|          .707|    .316#
101 #DEP2 1.1  |5|4.00|          .707|    .316#
102 #     2.1  |5|2.00|          .707|    .316#
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 #DEP1Equal variances assumed    #.000|1.000|-4.472|    8|           .002|         -2.000|                 .447|-3.031|-.969#
114 #    Equal variances not assumed#    |     |-4.472|8.000|           .002|         -2.000|                 .447|-3.031|-.969#
115 #DEP2Equal variances assumed    #.000|1.000| 4.472|    8|           .002|          2.000|                 .447|  .969|3.031#
116 #    Equal variances not assumed#    |     | 4.472|8.000|           .002|          2.000|                 .447|  .969|3.031#
117 #===============================#====#=====#======#=====#===============#===============#=====================#======#=====#
118 EOF
119 if [ $? -ne 0 ] ; then fail ; fi
120
121
122 pass