Fixed bug #11227 (T-Test not working with alpha independent variable )
[pspp-builds.git] / tests / bugs / t-test-alpha.sh
1 #!/bin/sh
2
3 # This program tests that the T-TEST works when the independent
4 # variable is alpha
5 # BUG #11227
6
7 TEMPDIR=/tmp/pspp-tst-$$
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 > $TEMPDIR/out.stat <<EOF
52 data list list /id * indep (a1) dep1 * dep2 *.
53 begin data.
54 1  'a' 1 3
55 2  'a' 2 4
56 3  'a' 2 4 
57 4  'a' 2 4 
58 5  'a' 3 5
59 6  'b' 3 1
60 7  'b' 4 2
61 8  'b' 4 2
62 9  'b' 4 2
63 10 'b' 5 3
64 11 'c' 2 2
65 end data.
66
67
68 t-test /GROUPS=indep('a','b') /var=dep1 dep2.
69 EOF
70 if [ $? -ne 0 ] ; then no_result ; fi
71
72
73 activity="run program"
74 $SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/out.stat
75 if [ $? -ne 0 ] ; then no_result ; fi
76
77 activity="compare output"
78 diff -B -b $TEMPDIR/pspp.list - <<EOF
79 1.1 DATA LIST.  Reading free-form data from the command file.
80 +--------+------+
81 |Variable|Format|
82 #========#======#
83 |ID      |F8.0  |
84 |INDEP   |A1    |
85 |DEP1    |F8.0  |
86 |DEP2    |F8.0  |
87 +--------+------+
88
89 2.1 T-TEST.  Group Statistics
90 #==========#=#====#==============#========#
91 #     INDEP|N|Mean|Std. Deviation|SE. Mean#
92 #==========#=#====#==============#========#
93 #DEP1 a    |5|2.00|          .707|    .316#
94 #     b    |5|4.00|          .707|    .316#
95 #DEP2 a    |5|4.00|          .707|    .316#
96 #     b    |5|2.00|          .707|    .316#
97 #==========#=#====#==============#========#
98
99 2.2 T-TEST.  Independent Samples Test
100 #===============================#==========#===============================================================================#
101 #                               # Levene's |                          t-test for Equality of Means                         #
102 #                               #----+-----+------+-----+---------------+---------------+---------------------+------------#
103 #                               #    |     |      |     |               |               |                     |    95%     #
104 #                               #    |     |      |     |               |               |                     +------+-----#
105 #                               # F  | Sig.|   t  |  df |Sig. (2-tailed)|Mean Difference|Std. Error Difference| Lower|Upper#
106 #===============================#====#=====#======#=====#===============#===============#=====================#======#=====#
107 #DEP1Equal variances assumed    #.000|1.000|-4.472|    8|           .002|         -2.000|                 .447|-3.031|-.969#
108 #    Equal variances not assumed#    |     |-4.472|8.000|           .002|         -2.000|                 .447|-3.031|-.969#
109 #DEP2Equal variances assumed    #.000|1.000| 4.472|    8|           .002|          2.000|                 .447|  .969|3.031#
110 #    Equal variances not assumed#    |     | 4.472|8.000|           .002|          2.000|                 .447|  .969|3.031#
111 #===============================#====#=====#======#=====#===============#===============#=====================#======#=====#
112 EOF
113 if [ $? -ne 0 ] ; then fail ; fi
114
115
116 pass