MEANS: Added further tests for missing value behaviour
[pspp-builds.git] / tests / language / stats / means.at
1 AT_BANNER([MEANS procedure])
2
3 AT_SETUP([MEANS simple example])
4
5 AT_DATA([means-simple.sps], [dnl
6 SET FORMAT=F12.5.
7
8 data list notable list /score * factor *.
9 BEGIN DATA.
10 22 01
11 22 01
12 29 01
13 16 01
14 24 02
15 21 02
16 22 01
17 24 01
18 19 01
19 17 01
20 22 01
21 17 02
22 23 02
23 25 02
24 20 01
25 15 01
26 18 01
27 26 01
28 23 02
29 35 02
30 20 01
31 16 01
32 19 01
33 14 01
34 14 01
35 21 01
36 END DATA.
37
38 MEANS TABLES = score BY factor.
39 ])
40
41 AT_CHECK([pspp -O format=csv means-simple.sps], [0],
42   [dnl
43 Table: Case Processing Summary
44 ,Cases,,,,,
45 ,Included,,Excluded,,Total,
46 ,N,Percent,N,Percent,N,Percent
47 score: factor,26,100%,0,0%,26,100%
48
49 Table: Report
50 ,factor,Mean,N,Std. Deviation
51 score,1.00000,19.78947,19.00000,4.03566
52 ,2.00000,24.00000,7.00000,5.50757
53 ])
54
55 AT_CLEANUP
56
57
58
59 AT_SETUP([MEANS very simple example])
60
61 AT_DATA([means-vsimple.sps], [dnl
62 SET FORMAT=F12.5.
63
64 data list notable list /score.
65 begin data.
66 1
67 1
68 2
69 2
70 end data.
71
72 means tables = score.
73 ])
74
75 AT_CHECK([pspp -O format=csv means-vsimple.sps], [0],
76   [dnl
77 Table: Case Processing Summary
78 ,Cases,,,,,
79 ,Included,,Excluded,,Total,
80 ,N,Percent,N,Percent,N,Percent
81 score: ,4,100%,0,0%,4,100%
82
83 Table: Report
84 ,Mean,N,Std. Deviation
85 score,1.50000,4.00000,.57735
86 ])
87
88 AT_CLEANUP
89
90
91
92
93 AT_SETUP([MEANS default missing])
94
95 AT_DATA([means-dmiss.sps], [dnl
96 SET FORMAT=F12.2.
97 data list notable list /a * g1 * g2 *.
98 begin data.
99 3 1 . 
100 4 1 11
101 3 1 21
102 6 2 21
103 2 2 31
104 . 2 31
105 8 2 31
106 7 2 31
107 end data.
108
109 MEANS TABLES = 
110       a BY g1
111       a BY g2
112       /cells = MEAN COUNT
113       .
114 ])
115
116 AT_CHECK([pspp -O format=csv means-dmiss.sps], [0],
117   [dnl
118 Table: Case Processing Summary
119 ,Cases,,,,,
120 ,Included,,Excluded,,Total,
121 ,N,Percent,N,Percent,N,Percent
122 a: g1 * g2,6,75%,2,25%,8,100%
123 a: a * g2,6,75%,2,25%,8,100%
124
125 Table: Report
126 ,g1,g2,Mean,N
127 a,1.00,11.00,4.00,1.00
128 ,1.00,21.00,3.00,1.00
129 ,2.00,21.00,6.00,1.00
130 ,2.00,31.00,5.67,3.00
131
132 Table: Report
133 ,a,g2,Mean,N
134 a,2.00,31.00,2.00,1.00
135 ,3.00,21.00,3.00,1.00
136 ,4.00,11.00,4.00,1.00
137 ,6.00,21.00,6.00,1.00
138 ,7.00,31.00,7.00,1.00
139 ,8.00,31.00,8.00,1.00
140 ])
141
142 AT_CLEANUP
143
144
145 AT_SETUP([MEANS linear stats])
146
147 dnl Slightly more involved example to test the linear statistics
148 AT_DATA([means-linear.sps], [dnl
149 set format F12.4.
150 data list notable list /id * group * test1 *
151 begin data.
152 1 1 85
153 2 1 90
154 3 1 82
155 4 1 75
156 5 1 99
157 6 2 70
158 7 2 66
159 8 2 52
160 9 2 71
161 10 2 50
162 end data.
163
164 add value labels /group 1 "experimental group" 2 "control group".
165
166 means test1 by group
167   /cells = mean count stddev sum min max range variance kurt skew
168   .
169 ])
170
171
172 AT_CHECK([pspp -O format=csv means-linear.sps], [0],
173   [dnl
174 Table: Case Processing Summary
175 ,Cases,,,,,
176 ,Included,,Excluded,,Total,
177 ,N,Percent,N,Percent,N,Percent
178 test1: group,10,100%,0,0%,10,100%
179
180 Table: Report
181 ,group,Mean,N,Std. Deviation,Sum,Min,Max,Range,Variance,Kurtosis,Skewness
182 test1,experimental group,86.2000,5.0000,8.9833,431.0000,75.0000,99.0000,24.0000,80.7000,.2727,.3858
183 ,control group,61.8000,5.0000,10.0598,309.0000,50.0000,71.0000,21.0000,101.2000,-3.0437,-.4830
184 ])
185
186 AT_CLEANUP
187
188
189 AT_SETUP([MEANS standard errors])
190
191 AT_DATA([means-stderr.sps], [dnl
192 set format F12.4.
193 data list notable list /id * group * test1 *
194 begin data.
195 1 1 85
196 2 1 90
197 3 1 82
198 4 1 75
199 5 1 99
200 6 1 70
201 7 2 66
202 8 2 52
203 9 2 71
204 10 2 50
205 end data.
206
207 means test1 by group 
208         /cells = mean count semean seskew sekurt.
209 ])
210
211
212 AT_CHECK([pspp -O format=csv means-stderr.sps], [0],
213   [dnl
214 Table: Case Processing Summary
215 ,Cases,,,,,
216 ,Included,,Excluded,,Total,
217 ,N,Percent,N,Percent,N,Percent
218 test1: group,10,100%,0,0%,10,100%
219
220 Table: Report
221 ,group,Mean,N,S.E. Mean,S.E. Skew,S.E. Kurt
222 test1,1.0000,83.5000,6.0000,4.2485,.8452,1.7408
223 ,2.0000,59.7500,4.0000,5.1700,1.0142,2.6186
224 ])
225
226 AT_CLEANUP
227
228
229
230 AT_SETUP([MEANS harmonic and geometric means])
231
232 AT_DATA([means-hg.sps], [dnl
233 set format F12.4.
234 data list notable list /x * y *.
235 begin data.
236 1 3
237 2 3
238 3 3
239 4 3
240 5 3
241 end data.
242
243
244 means x y
245         /cells = mean harmonic geometric
246 .
247 ])
248
249
250 AT_CHECK([pspp -O format=csv means-hg.sps], [0],
251   [dnl
252 Table: Case Processing Summary
253 ,Cases,,,,,
254 ,Included,,Excluded,,Total,
255 ,N,Percent,N,Percent,N,Percent
256 x: ,5,100%,0,0%,5,100%
257 y: ,5,100%,0,0%,5,100%
258
259 Table: Report
260 ,Mean,Harmonic Mean,Geom. Mean
261 x,3.0000,2.1898,2.6052
262 y,3.0000,3.0000,3.0000
263 ])
264
265 AT_CLEANUP
266
267
268
269
270
271
272 AT_SETUP([MEANS all/none/default])
273
274 dnl Make sure that /CELLS = {ALL,NONE,DEFAULT} work properly
275 AT_DATA([means-stat-keywords.sps], [dnl
276 SET FORMAT=F12.2.
277 SET DECIMAL=DOT.
278
279 DATA LIST NOTABLE LIST /score *.
280 BEGIN DATA.
281 22
282 22
283 29
284 16
285 23
286 END DATA.
287
288 MEANS score /CELLS = ALL.
289 MEANS score /CELLS = DEFAULT.
290 MEANS score /CELLS = NONE.
291 ])
292
293
294 AT_CHECK([pspp -O format=csv means-stat-keywords.sps], [0],
295   [dnl
296 Table: Case Processing Summary
297 ,Cases,,,,,
298 ,Included,,Excluded,,Total,
299 ,N,Percent,N,Percent,N,Percent
300 score: ,5,100%,0,0%,5,100%
301
302 Table: Report
303 ,Mean,N,Std. Deviation,S.E. Mean,Sum,Min,Max,Range,Variance,Kurtosis,S.E. Kurt,Skewness,S.E. Skew,First,Last,Harmonic Mean,Geom. Mean
304 score,22.40,5.00,4.62,2.06,112.00,16.00,29.00,13.00,21.30,1.85,2.00,.11,.91,22.00,23.00,21.61,22.01
305
306 Table: Case Processing Summary
307 ,Cases,,,,,
308 ,Included,,Excluded,,Total,
309 ,N,Percent,N,Percent,N,Percent
310 score: ,5,100%,0,0%,5,100%
311
312 Table: Report
313 ,Mean,N,Std. Deviation
314 score,22.40,5.00,4.62
315
316 Table: Case Processing Summary
317 ,Cases,,,,,
318 ,Included,,Excluded,,Total,
319 ,N,Percent,N,Percent,N,Percent
320 score: ,5,100%,0,0%,5,100%
321
322 Table: Report
323
324 score
325 ])
326
327 AT_CLEANUP
328
329
330
331
332 AT_SETUP([MEANS missing=table ])
333
334 AT_DATA([means-miss-table.sps], [dnl
335 data list notable list /a * b * g1.
336 begin data.
337 1 9 1  
338 2 9 1 
339 3 9 1 
340 4 9 2 
341 5 9 2 
342 6 9 2 
343 7 . 2 
344 end data.
345
346 MEANS a b BY g1
347       /a  BY g1
348       /cells =  COUNT
349       /missing = TABLE
350       .
351
352 MEANS a b BY g1
353       /a  BY g1
354       /cells =  COUNT
355       .
356 ])
357
358
359 AT_CHECK([pspp -O format=csv means-miss-table.sps], [0],
360   [dnl
361 Table: Case Processing Summary
362 ,Cases,,,,,
363 ,Included,,Excluded,,Total,
364 ,N,Percent,N,Percent,N,Percent
365 a: g1,7,100%,0,0%,7,100%
366 b: g1,6,85.7143%,1,14.2857%,7,100%
367
368 Table: Report
369 ,g1,N
370 a,1.00,3.00
371 ,2.00,3.00
372 b,1.00,3.00
373 ,2.00,3.00
374
375 Table: Case Processing Summary
376 ,Cases,,,,,
377 ,Included,,Excluded,,Total,
378 ,N,Percent,N,Percent,N,Percent
379 a: g1,7,100%,0,0%,7,100%
380
381 Table: Report
382 ,g1,N
383 a,1.00,3.00
384 ,2.00,4.00
385
386 Table: Case Processing Summary
387 ,Cases,,,,,
388 ,Included,,Excluded,,Total,
389 ,N,Percent,N,Percent,N,Percent
390 a: g1,7,100%,0,0%,7,100%
391 b: g1,6,85.7143%,1,14.2857%,7,100%
392
393 Table: Report
394 ,g1,N
395 a,1.00,3.00
396 ,2.00,4.00
397 b,1.00,3.00
398 ,2.00,3.00
399
400 Table: Case Processing Summary
401 ,Cases,,,,,
402 ,Included,,Excluded,,Total,
403 ,N,Percent,N,Percent,N,Percent
404 a: g1,7,100%,0,0%,7,100%
405
406 Table: Report
407 ,g1,N
408 a,1.00,3.00
409 ,2.00,4.00
410 ])
411
412 AT_CLEANUP
413
414
415
416
417
418 AT_SETUP([MEANS user missing values])
419
420 AT_DATA([means-missing.sps], [dnl
421 data list notable list /a * b * g1.
422 begin data.
423 1 2 9  
424 2 2 1 
425 3 2 1 
426 4 2 2 
427 5 2 2 
428 6 2 2 
429 7 9 2 
430 end data.
431
432 MISSING VALUES a b g1 (9).
433
434 MEANS a b BY g1 /cells =  COUNT .
435
436 MEANS a b BY g1 /cells =  COUNT /missing = include .
437
438 MEANS a b BY g1 /cells =  COUNT /missing = dependent .
439 ])
440
441
442 AT_CHECK([pspp -O format=csv means-missing.sps], [0],
443   [dnl
444 Table: Case Processing Summary
445 ,Cases,,,,,
446 ,Included,,Excluded,,Total,
447 ,N,Percent,N,Percent,N,Percent
448 a: g1,6,85.7143%,1,14.2857%,7,100%
449 b: g1,5,71.4286%,2,28.5714%,7,100%
450
451 Table: Report
452 ,g1,N
453 a,1.00,2.00
454 ,2.00,4.00
455 b,1.00,2.00
456 ,2.00,3.00
457
458 Table: Case Processing Summary
459 ,Cases,,,,,
460 ,Included,,Excluded,,Total,
461 ,N,Percent,N,Percent,N,Percent
462 a: g1,7,100%,0,0%,7,100%
463 b: g1,7,100%,0,0%,7,100%
464
465 Table: Report
466 ,g1,N
467 a,1.00,2.00
468 ,2.00,4.00
469 ,9.00,1.00
470 b,1.00,2.00
471 ,2.00,4.00
472 ,9.00,1.00
473
474 Table: Case Processing Summary
475 ,Cases,,,,,
476 ,Included,,Excluded,,Total,
477 ,N,Percent,N,Percent,N,Percent
478 a: g1,7,100%,0,0%,7,100%
479 b: g1,6,85.7143%,1,14.2857%,7,100%
480
481 Table: Report
482 ,g1,N
483 a,1.00,2.00
484 ,2.00,4.00
485 ,9.00,1.00
486 b,1.00,2.00
487 ,2.00,3.00
488 ,9.00,1.00
489 ])
490
491 AT_CLEANUP
492
493
494