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