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