Fixed problem where oneway didn't deal properly with splits.
[pspp-builds.git] / tests / command / oneway-with-splits.sh
1 #!/bin/sh
2
3 # This program tests that the ONEWAY anova command works OK
4 # when SPLIT FILE is active
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 /quality * brand * s *.
52 BEGIN DATA
53 3 1 1
54 2 1 1
55 1 1 1
56 1 1 1
57 4 1 1
58 5 2 1
59 2 2 1
60 4 2 2
61 2 2 2
62 3 2 2
63 7  3 2
64 4  3 2
65 5  3 2
66 3  3 2
67 6  3 2
68 END DATA
69
70 VARIABLE LABELS brand 'Manufacturer'.
71 VARIABLE LABELS quality 'Breaking Strain'.
72
73 VALUE LABELS /brand 1 'Aspeger' 2 'Bloggs' 3 'Charlies'.
74
75 SPLIT FILE by s.
76
77 ONEWAY
78         quality BY brand
79         /STATISTICS descriptives homogeneity
80         /CONTRASTS =  -2 2
81         /CONTRASTS = -1 1
82         .
83 EOF
84 if [ $? -ne 0 ] ; then no_result ; fi
85
86
87 activity="run program"
88 $SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/out.stat
89 if [ $? -ne 0 ] ; then no_result ; fi
90
91 diff $TEMPDIR/pspp.list - << EOF
92 1.1 DATA LIST.  Reading free-form data from the command file.
93 +--------+------+
94 |Variable|Format|
95 #========#======#
96 |QUALITY |F8.0  |
97 |BRAND   |F8.0  |
98 |S       |F8.0  |
99 +--------+------+
100
101 Variable Value    Label
102 S            1.00
103
104 2.1 ONEWAY.  Descriptives
105 #===============#=======#=#====#==============#==========#=======================#=======#=======#
106 #               |       # |    |              |          |    95% Confidence     |       |       #
107 #               |       # |    |              |          +-----------+-----------+       |       #
108 #               |       #N|Mean|Std. Deviation|Std. Error|Lower Bound|Upper Bound|Minimum|Maximum#
109 #===============#=======#=#====#==============#==========#===========#===========#=======#=======#
110 #Breaking Strain|Aspeger#5|2.20|          1.30|       .58|        .58|       3.82|   1.00|   4.00#
111 #               |Bloggs #2|3.50|          2.12|      1.50|     -15.56|      22.56|   2.00|   5.00#
112 #               |Total  #7|2.57|          1.51|       .57|       1.17|       3.97|   1.00|   5.00#
113 #===============#=======#=#====#==============#==========#===========#===========#=======#=======#
114
115 2.2 ONEWAY.  Test of Homogeneity of Variances
116 #===============#================#===#===#============#
117 #               #Levene Statistic|df1|df2|Significance#
118 #===============#================#===#===#============#
119 #Breaking Strain#           1.086|  1|  5|        .345#
120 #===============#================#===#===#============#
121
122 2.3 ONEWAY.  ANOVA
123 #==============================#==============#==#===========#=====#============#
124 #                              #Sum of Squares|df|Mean Square|  F  |Significance#
125 #===============#==============#==============#==#===========#=====#============#
126 #Breaking Strain|Between Groups#          2.41| 1|      2.414|1.068|        .349#
127 #               |Within Groups #         11.30| 5|      2.260|     |            #
128 #               |Total         #         13.71| 6|           |     |            #
129 #===============#==============#==============#==#===========#=====#============#
130
131 2.4 ONEWAY.  Contrast Coefficients
132 #==========#==============#
133 #          # Manufacturer #
134 #          #-------+------#
135 #          #Aspeger|Bloggs#
136 #========#=#=======#======#
137 #Contrast|1#     -2|     2#
138 #        |2#     -1|     1#
139 #========#=#=======#======#
140
141 2.5 ONEWAY.  Contrast Tests
142 #===============================================#=================#==========#=====#=====#===============#
143 #                                       Contrast#Value of Contrast|Std. Error|  t  |  df |Sig. (2-tailed)#
144 #===============#======================#========#=================#==========#=====#=====#===============#
145 #Breaking Strain|Assume equal variances|    1   #             2.60|     2.516|1.034|    5|           .349#
146 #               |                      |    2   #             1.30|     1.258|1.034|    5|           .349#
147 #               |Does not assume equal |    1   #             2.60|     3.219| .808|1.318|           .539#
148 #               |                      |    2   #             1.30|     1.609| .808|1.318|           .539#
149 #===============#======================#========#=================#==========#=====#=====#===============#
150
151 Variable Value    Label
152 S            2.00
153
154 2.6 ONEWAY.  Descriptives
155 #===============#========#=#====#==============#==========#=======================#=======#=======#
156 #               |        # |    |              |          |    95% Confidence     |       |       #
157 #               |        # |    |              |          +-----------+-----------+       |       #
158 #               |        #N|Mean|Std. Deviation|Std. Error|Lower Bound|Upper Bound|Minimum|Maximum#
159 #===============#========#=#====#==============#==========#===========#===========#=======#=======#
160 #Breaking Strain|Bloggs  #3|3.00|          1.00|       .58|        .52|       5.48|   2.00|   4.00#
161 #               |Charlies#5|5.00|          1.58|       .71|       3.04|       6.96|   3.00|   7.00#
162 #               |Total   #8|4.25|          1.67|       .59|       2.85|       5.65|   2.00|   7.00#
163 #===============#========#=#====#==============#==========#===========#===========#=======#=======#
164
165 2.7 ONEWAY.  Test of Homogeneity of Variances
166 #===============#================#===#===#============#
167 #               #Levene Statistic|df1|df2|Significance#
168 #===============#================#===#===#============#
169 #Breaking Strain#           2.199|  1|  6|        .189#
170 #===============#================#===#===#============#
171
172 2.8 ONEWAY.  ANOVA
173 #==============================#==============#==#===========#=====#============#
174 #                              #Sum of Squares|df|Mean Square|  F  |Significance#
175 #===============#==============#==============#==#===========#=====#============#
176 #Breaking Strain|Between Groups#          7.50| 1|      7.500|3.750|        .101#
177 #               |Within Groups #         12.00| 6|      2.000|     |            #
178 #               |Total         #         19.50| 7|           |     |            #
179 #===============#==============#==============#==#===========#=====#============#
180
181 2.9 ONEWAY.  Contrast Coefficients
182 #==========#===============#
183 #          #  Manufacturer #
184 #          #------+--------#
185 #          #Bloggs|Charlies#
186 #========#=#======#========#
187 #Contrast|1#    -2|       2#
188 #        |2#    -1|       1#
189 #========#=#======#========#
190
191 2.10 ONEWAY.  Contrast Tests
192 #===============================================#=================#==========#=====#=====#===============#
193 #                                       Contrast#Value of Contrast|Std. Error|  t  |  df |Sig. (2-tailed)#
194 #===============#======================#========#=================#==========#=====#=====#===============#
195 #Breaking Strain|Assume equal variances|    1   #             4.00|     2.066|1.936|    6|           .101#
196 #               |                      |    2   #             2.00|     1.033|1.936|    6|           .101#
197 #               |Does not assume equal |    1   #             4.00|     1.826|2.191|5.882|           .072#
198 #               |                      |    2   #             2.00|      .913|2.191|5.882|           .072#
199 #===============#======================#========#=================#==========#=====#=====#===============#
200
201 EOF
202 if [ $? -ne 0 ] ; then fail ; fi
203
204 pass