Implemented long variable names a la spss V12.
[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 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 export STAT_CONFIG_PATH=$top_srcdir/config
15
16
17 cleanup()
18 {
19      rm -rf $TEMPDIR
20 }
21
22
23 fail()
24 {
25     echo $activity
26     echo FAILED
27     cleanup;
28     exit 1;
29 }
30
31
32 no_result()
33 {
34     echo $activity
35     echo NO RESULT;
36     cleanup;
37     exit 2;
38 }
39
40 pass()
41 {
42     cleanup;
43     exit 0;
44 }
45
46 mkdir -p $TEMPDIR
47
48 cd $TEMPDIR
49
50 activity="create program"
51 cat > $TESTFILE <<EOF
52 DATA LIST LIST /quality * brand * s *.
53 BEGIN DATA
54 3 1 1
55 2 1 1
56 1 1 1
57 1 1 1
58 4 1 1
59 5 2 1
60 2 2 1
61 4 2 2
62 2 2 2
63 3 2 2
64 7  3 2
65 4  3 2
66 5  3 2
67 3  3 2
68 6  3 2
69 END DATA
70
71 VARIABLE LABELS brand 'Manufacturer'.
72 VARIABLE LABELS quality 'Breaking Strain'.
73
74 VALUE LABELS /brand 1 'Aspeger' 2 'Bloggs' 3 'Charlies'.
75
76 SPLIT FILE by s.
77
78 ONEWAY
79         quality BY brand
80         /STATISTICS descriptives homogeneity
81         /CONTRAST =  -2 2
82         /CONTRAST = -1 1
83         .
84 EOF
85 if [ $? -ne 0 ] ; then no_result ; fi
86
87
88 activity="run program"
89 $SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE
90 if [ $? -ne 0 ] ; then no_result ; fi
91
92 diff -b -B $TEMPDIR/pspp.list - << EOF
93 1.1 DATA LIST.  Reading free-form data from the command file.
94 +--------+------+
95 |Variable|Format|
96 #========#======#
97 |QUALITY |F8.0  |
98 |BRAND   |F8.0  |
99 |S       |F8.0  |
100 +--------+------+
101
102 Variable Value    Label
103 S            1.00
104
105 2.1 ONEWAY.  Descriptives
106 #===============#=======#=#====#==============#==========#=======================#=======#=======#
107 #               |       # |    |              |          |    95% Confidence     |       |       #
108 #               |       # |    |              |          +-----------+-----------+       |       #
109 #               |       #N|Mean|Std. Deviation|Std. Error|Lower Bound|Upper Bound|Minimum|Maximum#
110 #===============#=======#=#====#==============#==========#===========#===========#=======#=======#
111 #Breaking Strain|Aspeger#5|2.20|          1.30|       .58|        .58|       3.82|   1.00|   4.00#
112 #               |Bloggs #2|3.50|          2.12|      1.50|     -15.56|      22.56|   2.00|   5.00#
113 #               |Total  #7|2.57|          1.51|       .57|       1.17|       3.97|   1.00|   5.00#
114 #===============#=======#=#====#==============#==========#===========#===========#=======#=======#
115
116 2.2 ONEWAY.  Test of Homogeneity of Variances
117 #===============#================#===#===#============#
118 #               #Levene Statistic|df1|df2|Significance#
119 #===============#================#===#===#============#
120 #Breaking Strain#           1.086|  1|  5|        .345#
121 #===============#================#===#===#============#
122
123 2.3 ONEWAY.  ANOVA
124 #==============================#==============#==#===========#=====#============#
125 #                              #Sum of Squares|df|Mean Square|  F  |Significance#
126 #===============#==============#==============#==#===========#=====#============#
127 #Breaking Strain|Between Groups#          2.41| 1|      2.414|1.068|        .349#
128 #               |Within Groups #         11.30| 5|      2.260|     |            #
129 #               |Total         #         13.71| 6|           |     |            #
130 #===============#==============#==============#==#===========#=====#============#
131
132 2.4 ONEWAY.  Contrast Coefficients
133 #==========#==============#
134 #          # Manufacturer #
135 #          #-------+------#
136 #          #Aspeger|Bloggs#
137 #========#=#=======#======#
138 #Contrast|1#     -2|     2#
139 #        |2#     -1|     1#
140 #========#=#=======#======#
141
142 2.5 ONEWAY.  Contrast Tests
143 #===============================================#=================#==========#=====#=====#===============#
144 #                                       Contrast#Value of Contrast|Std. Error|  t  |  df |Sig. (2-tailed)#
145 #===============#======================#========#=================#==========#=====#=====#===============#
146 #Breaking Strain|Assume equal variances|    1   #             2.60|     2.516|1.034|    5|           .349#
147 #               |                      |    2   #             1.30|     1.258|1.034|    5|           .349#
148 #               |Does not assume equal |    1   #             2.60|     3.219| .808|1.318|           .539#
149 #               |                      |    2   #             1.30|     1.609| .808|1.318|           .539#
150 #===============#======================#========#=================#==========#=====#=====#===============#
151
152 Variable Value    Label
153 S            2.00
154
155 2.6 ONEWAY.  Descriptives
156 #===============#========#=#====#==============#==========#=======================#=======#=======#
157 #               |        # |    |              |          |    95% Confidence     |       |       #
158 #               |        # |    |              |          +-----------+-----------+       |       #
159 #               |        #N|Mean|Std. Deviation|Std. Error|Lower Bound|Upper Bound|Minimum|Maximum#
160 #===============#========#=#====#==============#==========#===========#===========#=======#=======#
161 #Breaking Strain|Bloggs  #3|3.00|          1.00|       .58|        .52|       5.48|   2.00|   4.00#
162 #               |Charlies#5|5.00|          1.58|       .71|       3.04|       6.96|   3.00|   7.00#
163 #               |Total   #8|4.25|          1.67|       .59|       2.85|       5.65|   2.00|   7.00#
164 #===============#========#=#====#==============#==========#===========#===========#=======#=======#
165
166 2.7 ONEWAY.  Test of Homogeneity of Variances
167 #===============#================#===#===#============#
168 #               #Levene Statistic|df1|df2|Significance#
169 #===============#================#===#===#============#
170 #Breaking Strain#            .923|  1|  6|        .374#
171 #===============#================#===#===#============#
172
173 2.8 ONEWAY.  ANOVA
174 #==============================#==============#==#===========#=====#============#
175 #                              #Sum of Squares|df|Mean Square|  F  |Significance#
176 #===============#==============#==============#==#===========#=====#============#
177 #Breaking Strain|Between Groups#          7.50| 1|      7.500|3.750|        .101#
178 #               |Within Groups #         12.00| 6|      2.000|     |            #
179 #               |Total         #         19.50| 7|           |     |            #
180 #===============#==============#==============#==#===========#=====#============#
181
182 2.9 ONEWAY.  Contrast Coefficients
183 #==========#===============#
184 #          #  Manufacturer #
185 #          #------+--------#
186 #          #Bloggs|Charlies#
187 #========#=#======#========#
188 #Contrast|1#    -2|       2#
189 #        |2#    -1|       1#
190 #========#=#======#========#
191
192 2.10 ONEWAY.  Contrast Tests
193 #===============================================#=================#==========#=====#=====#===============#
194 #                                       Contrast#Value of Contrast|Std. Error|  t  |  df |Sig. (2-tailed)#
195 #===============#======================#========#=================#==========#=====#=====#===============#
196 #Breaking Strain|Assume equal variances|    1   #             4.00|     2.066|1.936|    6|           .101#
197 #               |                      |    2   #             2.00|     1.033|1.936|    6|           .101#
198 #               |Does not assume equal |    1   #             4.00|     1.826|2.191|5.882|           .072#
199 #               |                      |    2   #             2.00|      .913|2.191|5.882|           .072#
200 #===============#======================#========#=================#==========#=====#=====#===============#
201
202 EOF
203 if [ $? -ne 0 ] ; then fail ; fi
204
205 pass