Sat Jul 30 21:54:23 2005 Ben Pfaff <blp@gnu.org>
[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 here=`pwd`;
9
10 # ensure that top_srcdir is absolute
11 cd $top_srcdir; top_srcdir=`pwd`
12
13 STAT_CONFIG_PATH=$top_srcdir/config
14 export STAT_CONFIG_PATH
15
16
17 cleanup()
18 {
19      cd /
20      rm -rf $TEMPDIR
21 }
22
23
24 fail()
25 {
26     echo $activity
27     echo FAILED
28     cleanup;
29     exit 1;
30 }
31
32
33 no_result()
34 {
35     echo $activity
36     echo NO RESULT;
37     cleanup;
38     exit 2;
39 }
40
41 pass()
42 {
43     cleanup;
44     exit 0;
45 }
46
47 mkdir -p $TEMPDIR
48
49 cd $TEMPDIR
50
51 activity="create program"
52 cat > $TESTFILE <<EOF
53 data list list /ID * INDEP * DEP1 * DEP2 *.
54 begin data.
55 1  1.1 1 3
56 2  1.1 2 4
57 3  1.1 2 4 
58 4  1.1 2 4 
59 5  1.1 3 5
60 6  2.1 3 1
61 7  2.1 4 2
62 8  2.1 4 2
63 9  2.1 4 2
64 10 2.1 5 3
65 11 3.1 2 2
66 end data.
67
68 * Note that this last case should be IGNORED since it doesn't have a dependent variable of either 1 or 2
69
70 t-test /GROUPS=indep(1.1,2.1) /var=dep1 dep2.
71 EOF
72 if [ $? -ne 0 ] ; then no_result ; fi
73
74
75 activity="run program"
76 $SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE
77 if [ $? -ne 0 ] ; then no_result ; fi
78
79 activity="compare output"
80 diff -B -b $TEMPDIR/pspp.list - <<EOF
81 1.1 DATA LIST.  Reading free-form data from the command file.
82 +--------+------+
83 |Variable|Format|
84 #========#======#
85 |ID      |F8.0  |
86 |INDEP   |F8.0  |
87 |DEP1    |F8.0  |
88 |DEP2    |F8.0  |
89 +--------+------+
90
91 2.1 T-TEST.  Group Statistics
92 #==========#=#====#==============#========#
93 #     INDEP|N|Mean|Std. Deviation|SE. Mean#
94 #==========#=#====#==============#========#
95 #DEP1 1.1  |5|2.00|          .707|    .316#
96 #     2.1  |5|4.00|          .707|    .316#
97 #DEP2 1.1  |5|4.00|          .707|    .316#
98 #     2.1  |5|2.00|          .707|    .316#
99 #==========#=#====#==============#========#
100
101 2.2 T-TEST.  Independent Samples Test
102 #===============================#==========#===============================================================================#
103 #                               # Levene's |                          t-test for Equality of Means                         #
104 #                               #----+-----+------+-----+---------------+---------------+---------------------+------------#
105 #                               #    |     |      |     |               |               |                     |    95%     #
106 #                               #    |     |      |     |               |               |                     +------+-----#
107 #                               # F  | Sig.|   t  |  df |Sig. (2-tailed)|Mean Difference|Std. Error Difference| Lower|Upper#
108 #===============================#====#=====#======#=====#===============#===============#=====================#======#=====#
109 #DEP1Equal variances assumed    #.000|1.000|-4.472|    8|           .002|         -2.000|                 .447|-3.031|-.969#
110 #    Equal variances not assumed#    |     |-4.472|8.000|           .002|         -2.000|                 .447|-3.031|-.969#
111 #DEP2Equal variances assumed    #.000|1.000| 4.472|    8|           .002|          2.000|                 .447|  .969|3.031#
112 #    Equal variances not assumed#    |     | 4.472|8.000|           .002|          2.000|                 .447|  .969|3.031#
113 #===============================#====#=====#======#=====#===============#===============#=====================#======#=====#
114 EOF
115 if [ $? -ne 0 ] ; then fail ; fi
116
117
118 pass