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