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