Migrate the tests for the ONEWAY command to autotest style
[pspp] / tests / language / stats / oneway.at
1 AT_BANNER([ONEWAY procedure])
2
3 AT_SETUP([ONEWAY basic operation])
4 AT_DATA([oneway.sps],
5   [DATA LIST NOTABLE LIST /QUALITY * BRAND * .
6 BEGIN DATA
7 3 1
8 2 1
9 1 1
10 1 1
11 4 1
12 5 2
13 2 2
14 4 2
15 2 2
16 3 2
17 7  3
18 4  3
19 5  3
20 3  3
21 6  3
22 END DATA
23
24 VARIABLE LABELS brand 'Manufacturer'.
25 VARIABLE LABELS quality 'Breaking Strain'.
26
27 VALUE LABELS /brand 1 'Aspeger' 2 'Bloggs' 3 'Charlies'.
28
29 ONEWAY
30         quality BY brand
31         /STATISTICS descriptives homogeneity
32         /CONTRAST =  -2 1 1 
33         /CONTRAST = 0 -1 1
34         .
35 ])
36
37 AT_CHECK([pspp -O format=csv oneway.sps], [0], 
38 [Table: Descriptives
39 ,,,,,,95% Confidence Interval for Mean,,,
40 ,,N,Mean,Std. Deviation,Std. Error,Lower Bound,Upper Bound,Minimum,Maximum
41 Breaking Strain,Aspeger,5,2.20,1.30,.58,.58,3.82,1.00,4.00
42 ,Bloggs,5,3.20,1.30,.58,1.58,4.82,2.00,5.00
43 ,Charlies,5,5.00,1.58,.71,3.04,6.96,3.00,7.00
44 ,Total,15,3.47,1.77,.46,2.49,4.45,1.00,7.00
45
46 Table: Test of Homogeneity of Variances
47 ,Levene Statistic,df1,df2,Significance
48 Breaking Strain,.09,2,12,.91
49
50 Table: ANOVA
51 ,,Sum of Squares,df,Mean Square,F,Significance
52 Breaking Strain,Between Groups,20.13,2,10.07,5.12,.02
53 ,Within Groups,23.60,12,1.97,,
54 ,Total,43.73,14,,,
55
56 Table: Contrast Coefficients
57 ,,Manufacturer,,
58 ,,Aspeger,Bloggs,Charlies
59 Contrast,1,-2,1,1
60 ,2,0,-1,1
61
62 Table: Contrast Tests
63 ,,Contrast,Value of Contrast,Std. Error,t,df,Sig. (2-tailed)
64 Breaking Strain,Assume equal variances,1,3.80,1.54,2.47,12,.03
65 ,,2,1.80,.89,2.03,12,.07
66 ,Does not assume equal,1,3.80,1.48,2.56,8.74,.03
67 ,,2,1.80,.92,1.96,7.72,.09
68 ])
69 AT_CLEANUP
70
71
72 AT_SETUP([ONEWAY with splits])
73 AT_DATA([oneway-splits.sps],
74 [DATA LIST NOTABLE LIST /QUALITY * BRAND * S *.
75 BEGIN DATA
76 3 1 1
77 2 1 1
78 1 1 1
79 1 1 1
80 4 1 1
81 5 2 1
82 2 2 1
83 4 2 2
84 2 2 2
85 3 2 2
86 7  3 2
87 4  3 2
88 5  3 2
89 3  3 2
90 6  3 2
91 END DATA
92
93 VARIABLE LABELS brand 'Manufacturer'.
94 VARIABLE LABELS quality 'Breaking Strain'.
95
96 VALUE LABELS /brand 1 'Aspeger' 2 'Bloggs' 3 'Charlies'.
97
98 SPLIT FILE by s.
99
100 ONEWAY
101         quality BY brand
102         /STATISTICS descriptives homogeneity
103         /CONTRAST =  -2 2
104         /CONTRAST = -1 1
105         .
106 ])
107
108 AT_CHECK([pspp -O format=csv oneway-splits.sps], [0], 
109 [Variable,Value,Label
110 S,1.00,
111
112 Table: Descriptives
113 ,,,,,,95% Confidence Interval for Mean,,,
114 ,,N,Mean,Std. Deviation,Std. Error,Lower Bound,Upper Bound,Minimum,Maximum
115 Breaking Strain,Aspeger,5,2.20,1.30,.58,.58,3.82,1.00,4.00
116 ,Bloggs,2,3.50,2.12,1.50,-15.56,22.56,2.00,5.00
117 ,Total,7,2.57,1.51,.57,1.17,3.97,1.00,5.00
118
119 Table: Test of Homogeneity of Variances
120 ,Levene Statistic,df1,df2,Significance
121 Breaking Strain,1.09,1,5,.35
122
123 Table: ANOVA
124 ,,Sum of Squares,df,Mean Square,F,Significance
125 Breaking Strain,Between Groups,2.41,1,2.41,1.07,.35
126 ,Within Groups,11.30,5,2.26,,
127 ,Total,13.71,6,,,
128
129 Table: Contrast Coefficients
130 ,,Manufacturer,
131 ,,Aspeger,Bloggs
132 Contrast,1,-2,2
133 ,2,-1,1
134
135 Table: Contrast Tests
136 ,,Contrast,Value of Contrast,Std. Error,t,df,Sig. (2-tailed)
137 Breaking Strain,Assume equal variances,1,2.60,2.52,1.03,5,.35
138 ,,2,1.30,1.26,1.03,5,.35
139 ,Does not assume equal,1,2.60,3.22,.81,1.32,.54
140 ,,2,1.30,1.61,.81,1.32,.54
141
142 Variable,Value,Label
143 S,2.00,
144
145 Table: Descriptives
146 ,,,,,,95% Confidence Interval for Mean,,,
147 ,,N,Mean,Std. Deviation,Std. Error,Lower Bound,Upper Bound,Minimum,Maximum
148 Breaking Strain,Bloggs,3,3.00,1.00,.58,.52,5.48,2.00,4.00
149 ,Charlies,5,5.00,1.58,.71,3.04,6.96,3.00,7.00
150 ,Total,8,4.25,1.67,.59,2.85,5.65,2.00,7.00
151
152 Table: Test of Homogeneity of Variances
153 ,Levene Statistic,df1,df2,Significance
154 Breaking Strain,.92,1,6,.37
155
156 Table: ANOVA
157 ,,Sum of Squares,df,Mean Square,F,Significance
158 Breaking Strain,Between Groups,7.50,1,7.50,3.75,.10
159 ,Within Groups,12.00,6,2.00,,
160 ,Total,19.50,7,,,
161
162 Table: Contrast Coefficients
163 ,,Manufacturer,
164 ,,Bloggs,Charlies
165 Contrast,1,-2,2
166 ,2,-1,1
167
168 Table: Contrast Tests
169 ,,Contrast,Value of Contrast,Std. Error,t,df,Sig. (2-tailed)
170 Breaking Strain,Assume equal variances,1,4.00,2.07,1.94,6,.10
171 ,,2,2.00,1.03,1.94,6,.10
172 ,Does not assume equal,1,4.00,1.83,2.19,5.88,.07
173 ,,2,2.00,.91,2.19,5.88,.07
174 ])
175
176 AT_CLEANUP
177
178
179 AT_SETUP([ONEWAY with missing values])
180 dnl Check that missing are treated properly
181 AT_DATA([oneway-missing1.sps],
182 [DATA LIST NOTABLE LIST /v1 * v2 * dep * vn *.
183 BEGIN DATA
184 . .  1  4
185 3 3  1  2
186 2 2  1  2
187 1 1  1  2
188 1 1  1  2
189 4 4  1  2
190 5 5  2  2
191 2 2  2  2
192 4 4  2  2
193 2 2  2  2
194 3 3  2  2
195 7 7  3  2
196 4 4  3  2
197 5 5  3  2
198 3 3  3  2
199 6 6  3  2
200 END DATA
201
202 ONEWAY
203         v1 v2 BY dep
204         /STATISTICS descriptives homogeneity
205         /MISSING ANALYSIS 
206         .
207 ])
208
209 AT_DATA([oneway-missing2.sps],
210 [DATA LIST NOTABLE LIST /v1 * v2 * dep * vn * .
211 BEGIN DATA
212 4 .  1  2 
213 3 3  1  2
214 2 2  1  2
215 1 1  1  2
216 1 1  1  2
217 4 4  1  2
218 5 5  2  2
219 2 2  2  2
220 4 4  2  2
221 2 2  2  2
222 3 3  2  2
223 7 7  3  2
224 4 4  3  2
225 5 5  3  2
226 3 3  3  2
227 6 6  3  2
228 END DATA
229
230 ONEWAY
231         v1 v2 BY dep
232         /STATISTICS descriptives homogeneity
233         /MISSING LISTWISE
234         .
235 ])
236
237
238
239 AT_CHECK([pspp -O format=csv oneway-missing1.sps > first.out], [0])
240
241 AT_CHECK([pspp -O format=csv oneway-missing2.sps > second.out], [0])
242
243 AT_CHECK([diff first.out second.out], [0], [])
244
245 dnl Now a test with missing values in the independent variable
246 AT_DATA([oneway-missing3.sps],
247 [DATA LIST NOTABLE LIST /v1 * v2 * dep * vn * .
248 BEGIN DATA
249 4 2  .  2 
250 3 3  1  2
251 2 2  1  2
252 1 1  1  2
253 1 1  1  2
254 4 4  1  2
255 5 5  2  2
256 2 2  2  2
257 4 4  2  2
258 2 2  2  2
259 3 3  2  2
260 7 7  3  2
261 4 4  3  2
262 5 5  3  4
263 3 3  3  2
264 6 6  3  2
265 END DATA
266
267 ONEWAY
268         v1 v2 BY dep
269         /STATISTICS descriptives homogeneity
270         /MISSING ANALYSIS
271         .
272 ])
273
274 AT_CHECK([pspp -O format=csv oneway-missing3.sps > third.out], [0])
275
276 AT_CHECK([diff first.out third.out], [0], [])
277
278 AT_CLEANUP