Add copyright and licence notices to files which lack them.
[pspp] / tests / language / stats / oneway.at
1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2017 Free Software Foundation, Inc.
3 dnl 
4 dnl This program is free software: you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation, either version 3 of the License, or
7 dnl (at your option) any later version.
8 dnl 
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 dnl GNU General Public License for more details.
13 dnl 
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 dnl AT_BANNER([ONEWAY procedure])
17
18 AT_SETUP([ONEWAY basic operation])
19 AT_DATA([oneway.sps],
20   [DATA LIST NOTABLE LIST /QUALITY * BRAND * .
21 BEGIN DATA
22 7  3
23 4  3
24 3  1
25 2  1
26 1  1
27 4  2
28 2  2
29 3  2
30 5  3
31 1  1
32 4  1
33 5  2
34 2  2
35 3  3
36 6  3
37 END DATA
38
39 VARIABLE LABELS brand 'Manufacturer'.
40 VARIABLE LABELS quality 'Breaking Strain'.
41
42 VALUE LABELS /brand 1 'Aspeger' 2 'Bloggs' 3 'Charlies'.
43
44 ONEWAY
45         quality BY brand
46         /STATISTICS descriptives homogeneity
47         /CONTRAST =  -2 1 1 
48         /CONTRAST = 0 -1 1
49         .
50 ])
51
52 AT_CHECK([pspp -O format=csv oneway.sps], [0], [dnl
53 Table: Descriptives
54 ,,,,,,95% Confidence Interval for Mean,,,
55 ,,N,Mean,Std. Deviation,Std. Error,Lower Bound,Upper Bound,Minimum,Maximum
56 Breaking Strain,Aspeger,5,2.20,1.30,.58,.58,3.82,1.00,4.00
57 ,Bloggs,5,3.20,1.30,.58,1.58,4.82,2.00,5.00
58 ,Charlies,5,5.00,1.58,.71,3.04,6.96,3.00,7.00
59 ,Total,15,3.47,1.77,.46,2.49,4.45,1.00,7.00
60
61 Table: Test of Homogeneity of Variances
62 ,Levene Statistic,df1,df2,Sig.
63 Breaking Strain,.09,2,12,.913
64
65 Table: ANOVA
66 ,,Sum of Squares,df,Mean Square,F,Sig.
67 Breaking Strain,Between Groups,20.13,2,10.07,5.12,.025
68 ,Within Groups,23.60,12,1.97,,
69 ,Total,43.73,14,,,
70
71 Table: Contrast Coefficients
72 ,,Manufacturer,,
73 ,,Aspeger,Bloggs,Charlies
74 Contrast,1,-2,1,1
75 ,2,0,-1,1
76
77 Table: Contrast Tests
78 ,,Contrast,Value of Contrast,Std. Error,t,df,Sig. (2-tailed)
79 Breaking Strain,Assume equal variances,1,3.80,1.54,2.47,12,.029
80 ,,2,1.80,.89,2.03,12,.065
81 ,Does not assume equal,1,3.80,1.48,2.56,8.74,.031
82 ,,2,1.80,.92,1.96,7.72,.086
83 ])
84 AT_CLEANUP
85
86
87 AT_SETUP([ONEWAY with splits])
88 AT_DATA([oneway-splits.sps],
89 [DATA LIST NOTABLE LIST /QUALITY * BRAND * S *.
90 BEGIN DATA
91 3 1 1
92 2 1 1
93 1 1 1
94 1 1 1
95 4 1 1
96 5 2 1
97 2 2 1
98 4 2 2
99 2 2 2
100 3 2 2
101 7  3 2
102 4  3 2
103 5  3 2
104 3  3 2
105 6  3 2
106 END DATA
107
108 VARIABLE LABELS brand 'Manufacturer'.
109 VARIABLE LABELS quality 'Breaking Strain'.
110
111 VALUE LABELS /brand 1 'Aspeger' 2 'Bloggs' 3 'Charlies'.
112
113 SPLIT FILE by s.
114
115 ONEWAY
116         quality BY brand
117         /STATISTICS descriptives homogeneity
118         /CONTRAST =  -2 2
119         /CONTRAST = -1 1
120         .
121 ])
122
123 AT_CHECK([pspp -O format=csv oneway-splits.sps], [0], 
124 [Variable,Value,Label
125 S,1.00,
126
127 Table: Descriptives
128 ,,,,,,95% Confidence Interval for Mean,,,
129 ,,N,Mean,Std. Deviation,Std. Error,Lower Bound,Upper Bound,Minimum,Maximum
130 Breaking Strain,Aspeger,5,2.20,1.30,.58,.58,3.82,1.00,4.00
131 ,Bloggs,2,3.50,2.12,1.50,-15.56,22.56,2.00,5.00
132 ,Total,7,2.57,1.51,.57,1.17,3.97,1.00,5.00
133
134 Table: Test of Homogeneity of Variances
135 ,Levene Statistic,df1,df2,Sig.
136 Breaking Strain,1.09,1,5,.345
137
138 Table: ANOVA
139 ,,Sum of Squares,df,Mean Square,F,Sig.
140 Breaking Strain,Between Groups,2.41,1,2.41,1.07,.349
141 ,Within Groups,11.30,5,2.26,,
142 ,Total,13.71,6,,,
143
144 Table: Contrast Coefficients
145 ,,Manufacturer,
146 ,,Aspeger,Bloggs
147 Contrast,1,-2,2
148 ,2,-1,1
149
150 Table: Contrast Tests
151 ,,Contrast,Value of Contrast,Std. Error,t,df,Sig. (2-tailed)
152 Breaking Strain,Assume equal variances,1,2.60,2.52,1.03,5,.349
153 ,,2,1.30,1.26,1.03,5,.349
154 ,Does not assume equal,1,2.60,3.22,.81,1.32,.539
155 ,,2,1.30,1.61,.81,1.32,.539
156
157 Variable,Value,Label
158 S,2.00,
159
160 Table: Descriptives
161 ,,,,,,95% Confidence Interval for Mean,,,
162 ,,N,Mean,Std. Deviation,Std. Error,Lower Bound,Upper Bound,Minimum,Maximum
163 Breaking Strain,Bloggs,3,3.00,1.00,.58,.52,5.48,2.00,4.00
164 ,Charlies,5,5.00,1.58,.71,3.04,6.96,3.00,7.00
165 ,Total,8,4.25,1.67,.59,2.85,5.65,2.00,7.00
166
167 Table: Test of Homogeneity of Variances
168 ,Levene Statistic,df1,df2,Sig.
169 Breaking Strain,.92,1,6,.374
170
171 Table: ANOVA
172 ,,Sum of Squares,df,Mean Square,F,Sig.
173 Breaking Strain,Between Groups,7.50,1,7.50,3.75,.101
174 ,Within Groups,12.00,6,2.00,,
175 ,Total,19.50,7,,,
176
177 Table: Contrast Coefficients
178 ,,Manufacturer,
179 ,,Bloggs,Charlies
180 Contrast,1,-2,2
181 ,2,-1,1
182
183 Table: Contrast Tests
184 ,,Contrast,Value of Contrast,Std. Error,t,df,Sig. (2-tailed)
185 Breaking Strain,Assume equal variances,1,4.00,2.07,1.94,6,.101
186 ,,2,2.00,1.03,1.94,6,.101
187 ,Does not assume equal,1,4.00,1.83,2.19,5.88,.072
188 ,,2,2.00,.91,2.19,5.88,.072
189 ])
190
191 AT_CLEANUP
192
193
194 AT_SETUP([ONEWAY with missing values])
195 dnl Check that missing are treated properly
196 AT_DATA([oneway-missing1.sps],
197 [DATA LIST NOTABLE LIST /v1 * v2 * dep * vn *.
198 BEGIN DATA
199 . .  1  4
200 3 3  1  2
201 2 2  1  2
202 1 1  1  2
203 1 1  1  2
204 4 4  1  2
205 5 5  2  2
206 2 2  2  2
207 4 4  2  2
208 2 2  2  2
209 3 3  2  2
210 7 7  3  2
211 4 4  3  2
212 5 5  3  2
213 3 3  3  2
214 6 6  3  2
215 END DATA
216
217 ONEWAY
218         v1 v2 BY dep
219         /STATISTICS descriptives homogeneity
220         /MISSING ANALYSIS 
221         .
222 ])
223
224 AT_DATA([oneway-missing2.sps],
225 [DATA LIST NOTABLE LIST /v1 * v2 * dep * vn * .
226 BEGIN DATA
227 4 .  1  2 
228 3 3  1  2
229 2 2  1  2
230 1 1  1  2
231 1 1  1  2
232 4 4  1  2
233 5 5  2  2
234 2 2  2  2
235 4 4  2  2
236 2 2  2  2
237 3 3  2  2
238 7 7  3  2
239 4 4  3  2
240 5 5  3  2
241 3 3  3  2
242 6 6  3  2
243 END DATA
244
245 ONEWAY
246         v1 v2 BY dep
247         /STATISTICS descriptives homogeneity
248         /MISSING LISTWISE
249         .
250 ])
251
252
253
254 AT_CHECK([pspp -O format=csv oneway-missing1.sps > first.out], [0])
255
256 AT_CHECK([pspp -O format=csv oneway-missing2.sps > second.out], [0])
257
258 AT_CHECK([diff first.out second.out], [0], [])
259
260 dnl Now a test with missing values in the independent variable
261 AT_DATA([oneway-missing3.sps],
262 [DATA LIST NOTABLE LIST /v1 * v2 * dep * vn * .
263 BEGIN DATA
264 4 2  .  2 
265 3 3  1  2
266 2 2  1  2
267 1 1  1  2
268 1 1  1  2
269 4 4  1  2
270 5 5  2  2
271 2 2  2  2
272 4 4  2  2
273 2 2  2  2
274 3 3  2  2
275 7 7  3  2
276 4 4  3  2
277 5 5  3  4
278 3 3  3  2
279 6 6  3  2
280 END DATA
281
282 ONEWAY
283         v1 v2 BY dep
284         /STATISTICS descriptives homogeneity
285         /MISSING ANALYSIS
286         .
287 ])
288
289 AT_CHECK([pspp -O format=csv oneway-missing3.sps > third.out], [0])
290
291 AT_CHECK([diff first.out third.out], [0], [])
292
293 AT_CLEANUP
294
295
296
297
298
299 AT_SETUP([ONEWAY descriptives subcommand])
300
301 AT_DATA([oneway-descriptives.sps],
302   [DATA LIST NOTABLE LIST /QUALITY * BRAND * .
303 BEGIN DATA
304 13 11
305 12 11
306 11 11
307 11 11
308 14 11
309 15 25
310 12 25
311 14 25
312 12 25
313 13 25
314 17  301
315 14  301
316 15  301
317 13  301
318 16  301
319 END DATA
320
321
322 ONEWAY
323         quality BY brand
324         /STATISTICS descriptives
325         .
326 ])
327
328 AT_CHECK([pspp -O format=csv oneway-descriptives.sps], [0], 
329 [Table: Descriptives
330 ,,,,,,95% Confidence Interval for Mean,,,
331 ,,N,Mean,Std. Deviation,Std. Error,Lower Bound,Upper Bound,Minimum,Maximum
332 QUALITY,11.00,5,12.20,1.30,.58,10.58,13.82,11.00,14.00
333 ,25.00,5,13.20,1.30,.58,11.58,14.82,12.00,15.00
334 ,301.00,5,15.00,1.58,.71,13.04,16.96,13.00,17.00
335 ,Total,15,13.47,1.77,.46,12.49,14.45,11.00,17.00
336
337 Table: ANOVA
338 ,,Sum of Squares,df,Mean Square,F,Sig.
339 QUALITY,Between Groups,20.13,2,10.07,5.12,.025
340 ,Within Groups,23.60,12,1.97,,
341 ,Total,43.73,14,,,
342 ])
343
344 AT_CLEANUP
345
346
347
348 AT_SETUP([ONEWAY homogeneity subcommand])
349
350 AT_DATA([oneway-homogeneity.sps],
351   [DATA LIST NOTABLE LIST /QUALITY * BRAND * .
352 BEGIN DATA
353 13 11
354 12 11
355 11 11
356 11 11
357 14 11
358 15 25
359 12 25
360 14 25
361 12 25
362 13 25
363 17  301
364 14  301
365 15  301
366 13  301
367 16  301
368 END DATA
369
370
371 ONEWAY
372         quality BY brand
373         /STATISTICS homogeneity
374         .
375 ])
376
377 AT_CHECK([pspp -O format=csv oneway-homogeneity.sps], [0], 
378 [Table: Test of Homogeneity of Variances
379 ,Levene Statistic,df1,df2,Sig.
380 QUALITY,.09,2,12,.913
381
382 Table: ANOVA
383 ,,Sum of Squares,df,Mean Square,F,Sig.
384 QUALITY,Between Groups,20.13,2,10.07,5.12,.025
385 ,Within Groups,23.60,12,1.97,,
386 ,Total,43.73,14,,,
387 ])
388
389 AT_CLEANUP
390
391
392
393 AT_SETUP([ONEWAY multiple variables])
394 dnl check that everything works ok when several different dependent variables are specified.
395 dnl This of course does not mean that we're doing a multivariate analysis.  It's just like
396 dnl running several tests at once.
397 AT_DATA([multivar.sps],
398 [DATA LIST notable LIST /x * y * z * g *.
399 begin data.
400 1 1 0 10
401 1 1 9 10
402 9 1 2 10
403 1 1 3 20
404 1 1 8 20
405 1 1 1 20
406 1 1 2 20
407 0 1 3 20
408 1 1 4 30
409 0 1 5 30
410 1 1 6 30
411 0 1 7 30
412 1 2 8 30
413 2 2 9 30
414 1 2 1 30
415 1 2 0 30
416 1 2 2 40
417 8 2 3 40
418 1 2 4 40
419 1 2 9 40
420 9 2 8 40
421 7 3 7 40
422 2 3 6 40
423 3 3 5 40
424 end data.
425
426 ONEWAY x y z by g
427         /STATISTICS = DESCRIPTIVES HOMOGENEITY
428         /CONTRAST 3  2 0 -5
429         /CONTRAST 2 -9 7  0
430         .
431 ])
432
433 AT_CHECK([pspp -o pspp.csv multivar.sps])
434
435 dnl Some machines return 3.88 instead of 3.87 below (see bug #31611).
436 AT_CHECK([sed 's/^,Within Groups,3.88/,Within Groups,3.87/' pspp.csv], [0], [dnl
437 Table: Descriptives
438 ,,,,,,95% Confidence Interval for Mean,,,
439 ,,N,Mean,Std. Deviation,Std. Error,Lower Bound,Upper Bound,Minimum,Maximum
440 x,10.00,3,3.67,4.62,2.67,-7.81,15.14,1.00,9.00
441 ,20.00,5,.80,.45,.20,.24,1.36,.00,1.00
442 ,30.00,8,.88,.64,.23,.34,1.41,.00,2.00
443 ,40.00,8,4.00,3.42,1.21,1.14,6.86,1.00,9.00
444 ,Total,24,2.25,2.83,.58,1.05,3.45,.00,9.00
445 y,10.00,3,1.00,.00,.00,1.00,1.00,1.00,1.00
446 ,20.00,5,1.00,.00,.00,1.00,1.00,1.00,1.00
447 ,30.00,8,1.50,.53,.19,1.05,1.95,1.00,2.00
448 ,40.00,8,2.38,.52,.18,1.94,2.81,2.00,3.00
449 ,Total,24,1.63,.71,.15,1.32,1.93,1.00,3.00
450 z,10.00,3,3.67,4.73,2.73,-8.07,15.41,.00,9.00
451 ,20.00,5,3.40,2.70,1.21,.05,6.75,1.00,8.00
452 ,30.00,8,5.00,3.21,1.13,2.32,7.68,.00,9.00
453 ,40.00,8,5.50,2.45,.87,3.45,7.55,2.00,9.00
454 ,Total,24,4.67,2.99,.61,3.40,5.93,.00,9.00
455
456 Table: Test of Homogeneity of Variances
457 ,Levene Statistic,df1,df2,Sig.
458 x,18.76,3,20,.000
459 y,71.41,3,20,.000
460 z,.89,3,20,.463
461
462 Table: ANOVA
463 ,,Sum of Squares,df,Mean Square,F,Sig.
464 x,Between Groups,56.16,3,18.72,2.92,.059
465 ,Within Groups,128.34,20,6.42,,
466 ,Total,184.50,23,,,
467 y,Between Groups,7.75,3,2.58,13.33,.000
468 ,Within Groups,3.87,20,.19,,
469 ,Total,11.63,23,,,
470 z,Between Groups,17.47,3,5.82,.62,.610
471 ,Within Groups,187.87,20,9.39,,
472 ,Total,205.33,23,,,
473
474 Table: Contrast Coefficients
475 ,,g,,,
476 ,,10.00,20.00,30.00,40.00
477 Contrast,1,3,2,0,-5
478 ,2,2,-9,7,0
479
480 Table: Contrast Tests
481 ,,Contrast,Value of Contrast,Std. Error,t,df,Sig. (2-tailed)
482 x,Assume equal variances,1,-7.40,6.67,1.11,20,.280
483 ,,2,6.26,12.32,.51,20,.617
484 ,Does not assume equal,1,-7.40,10.04,-.74,4.53,.497
485 ,,2,6.26,5.85,1.07,2.87,.366
486 y,Assume equal variances,1,-6.88,1.16,5.94,20,.000
487 ,,2,3.50,2.14,1.63,20,.118
488 ,Does not assume equal,1,-6.88,.91,-7.51,7.00,.000
489 ,,2,3.50,1.32,2.65,7.00,.033
490 z,Assume equal variances,1,-9.70,8.07,1.20,20,.243
491 ,,2,11.73,14.91,.79,20,.440
492 ,Does not assume equal,1,-9.70,9.57,-1.01,3.64,.373
493 ,,2,11.73,14.53,.81,9.88,.438
494 ])
495
496 AT_CLEANUP
497
498
499
500 dnl Tests that everything treats weights properly
501 AT_SETUP([ONEWAY vs. weights])
502
503 AT_DATA([oneway-unweighted.sps],
504 [DATA LIST NOTABLE LIST /QUALITY * BRAND * W *.
505 BEGIN DATA
506 3  1   1
507 2  1   1
508 1  1   1
509 1  1   1
510 4  1   1
511 5  2   1
512 2  2   1
513 4  2   1
514 4  2   1
515 4  2   1
516 2  2   1
517 2  2   1
518 3  2   1
519 7  3   1
520 4  3   1
521 5  3   1
522 5  3   1
523 3  3   1
524 6  3   1
525 END DATA.
526
527 WEIGHT BY W.
528
529 ONEWAY
530         quality BY brand
531         /STATISTICS descriptives homogeneity
532         .
533 ])
534
535 AT_CHECK([pspp -o pspp-unweighted.csv oneway-unweighted.sps], [0], [ignore], [ignore])
536
537 AT_DATA([oneway-weighted.sps],
538 [DATA LIST NOTABLE LIST /QUALITY * BRAND * W *.
539 BEGIN DATA
540 3  1   1
541 2  1   1
542 1  1   2
543 4  1   1
544 5  2   1
545 2  2   1
546 4  2   3
547 2  2   2
548 3  2   1
549 7  3   1
550 4  3   1
551 5  3   2
552 3  3   1
553 6  3   1
554 END DATA.
555
556 WEIGHT BY W.
557
558 ONEWAY
559         quality BY brand
560         /STATISTICS descriptives homogeneity
561         .
562 ])
563
564 AT_CHECK([pspp -o pspp-weighted.csv oneway-weighted.sps], [0], [ignore], [ignore])
565
566 AT_CHECK([diff pspp-weighted.csv pspp-unweighted.csv], [0])
567
568 AT_CLEANUP
569
570
571
572 AT_SETUP([ONEWAY posthoc LSD and BONFERRONI])
573 AT_DATA([oneway-pig.sps],[dnl
574 SET FORMAT F12.3.
575 data list notable list /pigmentation * family *.
576 begin data.
577 36 1
578 39 1
579 43 1
580 38 1
581 37 1
582 46 2
583 47 2
584 47 2
585 47 2
586 43 2
587 40 3
588 50 3
589 44 3
590 48 3
591 50 3
592 45 4
593 53 4
594 56 4
595 52 4
596 56 4
597 end data.
598
599
600 oneway pigmentation by family
601         /statistics = descriptives
602         /posthoc = lsd bonferroni alpha (0.05)
603          .
604 ])
605
606 AT_CHECK([pspp -O format=csv oneway-pig.sps], [0], 
607 [Table: Descriptives
608 ,,,,,,95% Confidence Interval for Mean,,,
609 ,,N,Mean,Std. Deviation,Std. Error,Lower Bound,Upper Bound,Minimum,Maximum
610 pigmentation,1.000,5,38.600,2.702,1.208,35.245,41.955,36.000,43.000
611 ,2.000,5,46.000,1.732,.775,43.849,48.151,43.000,47.000
612 ,3.000,5,46.400,4.336,1.939,41.016,51.784,40.000,50.000
613 ,4.000,5,52.400,4.506,2.015,46.806,57.994,45.000,56.000
614 ,Total,20,45.850,5.967,1.334,43.057,48.643,36.000,56.000
615
616 Table: ANOVA
617 ,,Sum of Squares,df,Mean Square,F,Sig.
618 pigmentation,Between Groups,478.950,3,159.650,12.927,.000
619 ,Within Groups,197.600,16,12.350,,
620 ,Total,676.550,19,,,
621
622 Table: Multiple Comparisons (pigmentation)
623 ,,,Mean Difference,,,95% Confidence Interval,
624 ,(I) family,(J) family,(I - J),Std. Error,Sig.,Lower Bound,Upper Bound
625 LSD,1.000,2.000,-7.400,2.223,.004,-12.112,-2.688
626 ,,3.000,-7.800,2.223,.003,-12.512,-3.088
627 ,,4.000,-13.800,2.223,.000,-18.512,-9.088
628 ,2.000,1.000,7.400,2.223,.004,2.688,12.112
629 ,,3.000,-.400,2.223,.859,-5.112,4.312
630 ,,4.000,-6.400,2.223,.011,-11.112,-1.688
631 ,3.000,1.000,7.800,2.223,.003,3.088,12.512
632 ,,2.000,.400,2.223,.859,-4.312,5.112
633 ,,4.000,-6.000,2.223,.016,-10.712,-1.288
634 ,4.000,1.000,13.800,2.223,.000,9.088,18.512
635 ,,2.000,6.400,2.223,.011,1.688,11.112
636 ,,3.000,6.000,2.223,.016,1.288,10.712
637 Bonferroni,1.000,2.000,-7.400,2.223,.025,-14.086,-.714
638 ,,3.000,-7.800,2.223,.017,-14.486,-1.114
639 ,,4.000,-13.800,2.223,.000,-20.486,-7.114
640 ,2.000,1.000,7.400,2.223,.025,.714,14.086
641 ,,3.000,-.400,2.223,1.000,-7.086,6.286
642 ,,4.000,-6.400,2.223,.065,-13.086,.286
643 ,3.000,1.000,7.800,2.223,.017,1.114,14.486
644 ,,2.000,.400,2.223,1.000,-6.286,7.086
645 ,,4.000,-6.000,2.223,.095,-12.686,.686
646 ,4.000,1.000,13.800,2.223,.000,7.114,20.486
647 ,,2.000,6.400,2.223,.065,-.286,13.086
648 ,,3.000,6.000,2.223,.095,-.686,12.686
649 ])
650
651 AT_CLEANUP
652
653
654 AT_SETUP([ONEWAY posthoc Tukey HSD and Games-Howell])
655 AT_DATA([oneway-tukey.sps],[dnl
656 set format = f11.3.
657 data list notable list /libido * dose *.
658 begin data.
659 3 0
660 2 0
661 1 0
662 1 0
663 4 0
664 5 1
665 2 1
666 4 1
667 2 1
668 3 1
669 7 2
670 4 2
671 5 2
672 3 2
673 6 2
674 end data.
675
676 variable label dose 'Dose of Viagra'.
677
678 add value labels dose 0 'Placebo' 1 '1 Dose' 2 '2 Doses'.
679
680 oneway libido by dose
681         /posthoc tukey gh.
682 ])
683
684 AT_CHECK([pspp -O format=csv oneway-tukey.sps], [0], 
685 [Table: ANOVA
686 ,,Sum of Squares,df,Mean Square,F,Sig.
687 libido,Between Groups,20.133,2,10.067,5.119,.025
688 ,Within Groups,23.600,12,1.967,,
689 ,Total,43.733,14,,,
690
691 Table: Multiple Comparisons (libido)
692 ,,,Mean Difference,,,95% Confidence Interval,
693 ,(I) Dose of Viagra,(J) Dose of Viagra,(I - J),Std. Error,Sig.,Lower Bound,Upper Bound
694 Tukey HSD,Placebo,1 Dose,-1.000,.887,.516,-3.366,1.366
695 ,,2 Doses,-2.800,.887,.021,-5.166,-.434
696 ,1 Dose,Placebo,1.000,.887,.516,-1.366,3.366
697 ,,2 Doses,-1.800,.887,.147,-4.166,.566
698 ,2 Doses,Placebo,2.800,.887,.021,.434,5.166
699 ,,1 Dose,1.800,.887,.147,-.566,4.166
700 Games-Howell,Placebo,1 Dose,-1.000,.887,.479,-3.356,1.356
701 ,,2 Doses,-2.800,.887,.039,-5.439,-.161
702 ,1 Dose,Placebo,1.000,.887,.479,-1.356,3.356
703 ,,2 Doses,-1.800,.887,.185,-4.439,.839
704 ,2 Doses,Placebo,2.800,.887,.039,.161,5.439
705 ,,1 Dose,1.800,.887,.185,-.839,4.439
706 ])
707
708 AT_CLEANUP
709
710 AT_SETUP([ONEWAY posthoc Sidak])
711 AT_DATA([oneway-sidak.sps],[dnl
712 SET FORMAT F20.4.
713
714 DATA LIST notable LIST /program score.
715 BEGIN DATA.
716 1   9
717 1  12
718 1  14
719 1  11
720 1  13
721 2  10
722 2   6
723 2   9
724 2   9
725 2  10
726 3  12
727 3  14
728 3  11
729 3  13
730 3  11
731 4   9
732 4   8
733 4  11
734 4   7
735 4   8
736 END DATA.
737
738 ONEWAY
739   score BY program
740   /MISSING ANALYSIS
741   /POSTHOC = SIDAK.
742 ])
743
744 AT_CHECK([pspp -O format=csv oneway-sidak.sps], [0], 
745 [Table: ANOVA
746 ,,Sum of Squares,df,Mean Square,F,Sig.
747 score,Between Groups,54.9500,3,18.3167,7.0449,.003
748 ,Within Groups,41.6000,16,2.6000,,
749 ,Total,96.5500,19,,,
750
751 Table: Multiple Comparisons (score)
752 ,,,Mean Difference,,,95% Confidence Interval,
753 ,(I) program,(J) program,(I - J),Std. Error,Sig.,Lower Bound,Upper Bound
754 Šidák,1.0000,2.0000,3.0000,1.0198,.056,-.0575,6.0575
755 ,,3.0000,-.4000,1.0198,.999,-3.4575,2.6575
756 ,,4.0000,3.2000,1.0198,.038,.1425,6.2575
757 ,2.0000,1.0000,-3.0000,1.0198,.056,-6.0575,.0575
758 ,,3.0000,-3.4000,1.0198,.025,-6.4575,-.3425
759 ,,4.0000,.2000,1.0198,1.000,-2.8575,3.2575
760 ,3.0000,1.0000,.4000,1.0198,.999,-2.6575,3.4575
761 ,,2.0000,3.4000,1.0198,.025,.3425,6.4575
762 ,,4.0000,3.6000,1.0198,.017,.5425,6.6575
763 ,4.0000,1.0000,-3.2000,1.0198,.038,-6.2575,-.1425
764 ,,2.0000,-.2000,1.0198,1.000,-3.2575,2.8575
765 ,,3.0000,-3.6000,1.0198,.017,-6.6575,-.5425
766 ])
767
768 AT_CLEANUP
769
770 AT_SETUP([ONEWAY posthoc Scheffe])
771 AT_DATA([oneway-scheffe.sps],[dnl
772 set format = f11.3.
773 data list notable list /usage * group *.
774 begin data.
775 21.00     1
776 19.00     1
777 18.00     1
778 25.00     1
779 14.00     1
780 13.00     1
781 24.00     1
782 19.00     1
783 20.00     1
784 21.00     1
785 15.00     2
786 10.00     2
787 13.00     2
788 16.00     2
789 14.00     2
790 24.00     2
791 16.00     2
792 14.00     2
793 18.00     2
794 16.00     2
795 10.00     3
796  7.00     3
797 13.00     3
798 20.00     3
799   .00     3
800  8.00     3
801  6.00     3
802  1.00     3
803 12.00     3
804 14.00     3
805 18.00     4
806 15.00     4
807  3.00     4
808 27.00     4
809  6.00     4
810 14.00     4
811 13.00     4
812 11.00     4
813  9.00     4
814 18.00     4
815 end data.
816
817 variable label usage 'Days of Use'.
818
819 add value labels group 0 'none' 1 'one' 2 'two' 3 'three' 4 'four'.
820
821 oneway usage by group
822         /posthoc scheffe.
823 ])
824
825 AT_CHECK([pspp -O format=csv oneway-scheffe.sps], [0], 
826 [Table: ANOVA
827 ,,Sum of Squares,df,Mean Square,F,Sig.
828 Days of Use,Between Groups,555.275,3,185.092,6.663,.001
829 ,Within Groups,1000.100,36,27.781,,
830 ,Total,1555.375,39,,,
831
832 Table: Multiple Comparisons (Days of Use)
833 ,,,Mean Difference,,,95% Confidence Interval,
834 ,(I) group,(J) group,(I - J),Std. Error,Sig.,Lower Bound,Upper Bound
835 Scheffé,one,two,3.800,2.357,.467,-3.112,10.712
836 ,,three,10.300,2.357,.001,3.388,17.212
837 ,,four,6.000,2.357,.110,-.912,12.912
838 ,two,one,-3.800,2.357,.467,-10.712,3.112
839 ,,three,6.500,2.357,.072,-.412,13.412
840 ,,four,2.200,2.357,.832,-4.712,9.112
841 ,three,one,-10.300,2.357,.001,-17.212,-3.388
842 ,,two,-6.500,2.357,.072,-13.412,.412
843 ,,four,-4.300,2.357,.358,-11.212,2.612
844 ,four,one,-6.000,2.357,.110,-12.912,.912
845 ,,two,-2.200,2.357,.832,-9.112,4.712
846 ,,three,4.300,2.357,.358,-2.612,11.212
847 ])
848
849 AT_CLEANUP
850
851
852 AT_SETUP([ONEWAY bad contrast count])
853
854 AT_DATA([oneway-bad-contrast.sps],[dnl
855 DATA LIST NOTABLE LIST /height * weight * temperature * sex *.
856 BEGIN DATA.
857 1884     88.6       39.97     0
858 1801     90.9       39.03     0
859 1801     91.7       38.98     0
860 1607     56.3       36.26     1
861 1608     46.3       46.26     1
862 1607     55.9       37.84     1
863 1604     56.6       36.81     1
864 1606     56.1       34.56     1
865 END DATA.
866
867 ONEWAY /VARIABLES= height weight temperature BY sex
868  /CONTRAST = -1  1 
869  /CONTRAST = -3  3 
870  /CONTRAST =  2 -2  1
871  /CONTRAST = -9  9
872  . 
873 ])
874
875
876 AT_CHECK([pspp -O format=csv oneway-bad-contrast.sps], [0], [dnl
877 "oneway-bad-contrast.sps:18: warning: ONEWAY: In contrast list 3, the number of coefficients (3) does not equal the number of groups (2). This contrast list will be ignored."
878
879 Table: ANOVA
880 ,,Sum of Squares,df,Mean Square,F,Sig.
881 height,Between Groups,92629.63,1,92629.63,120.77,.000
882 ,Within Groups,4601.87,6,766.98,,
883 ,Total,97231.50,7,,,
884 weight,Between Groups,2451.65,1,2451.65,174.59,.000
885 ,Within Groups,84.25,6,14.04,,
886 ,Total,2535.90,7,,,
887 temperature,Between Groups,1.80,1,1.80,.13,.733
888 ,Within Groups,84.55,6,14.09,,
889 ,Total,86.36,7,,,
890
891 Table: Contrast Coefficients
892 ,,sex,
893 ,,.00,1.00
894 Contrast,1,-1,1
895 ,2,-3,3
896 ,3,-9,9
897
898 Table: Contrast Tests
899 ,,Contrast,Value of Contrast,Std. Error,t,df,Sig. (2-tailed)
900 height,Assume equal variances,1,-222.27,20.23,10.99,6,.000
901 ,,2,-666.80,60.68,10.99,6,.000
902 ,,3,-2000.40,182.03,10.99,6,.000
903 ,Does not assume equal,1,-222.27,27.67,-8.03,2.00,.015
904 ,,2,-666.80,83.02,-8.03,2.00,.015
905 ,,3,-2000.40,249.07,-8.03,2.00,.015
906 weight,Assume equal variances,1,-36.16,2.74,13.21,6,.000
907 ,,2,-108.48,8.21,13.21,6,.000
908 ,,3,-325.44,24.63,13.21,6,.000
909 ,Does not assume equal,1,-36.16,2.19,-16.48,5.42,.000
910 ,,2,-108.48,6.58,-16.48,5.42,.000
911 ,,3,-325.44,19.75,-16.48,5.42,.000
912 temperature,Assume equal variances,1,-.98,2.74,.36,6,.733
913 ,,2,-2.94,8.22,.36,6,.733
914 ,,3,-8.83,24.67,.36,6,.733
915 ,Does not assume equal,1,-.98,2.07,-.47,4.19,.660
916 ,,2,-2.94,6.22,-.47,4.19,.660
917 ,,3,-8.83,18.66,-.47,4.19,.660
918 ])
919
920 AT_CLEANUP
921
922
923 AT_SETUP([ONEWAY crash on single category independent variable])
924 AT_DATA([crash.sps],[
925 input program.
926 loop #i = 1 to 10.
927 compute test = #i.
928 end case.
929 end loop.
930 end file.
931 end input program.
932
933 compute x = 1.
934
935 oneway test by x.
936 ])
937
938 AT_CHECK([pspp -O format=csv crash.sps], [0], [ignore])
939
940 AT_CLEANUP
941
942
943
944 AT_SETUP([ONEWAY crash on missing dependent variable])
945 AT_DATA([crash2.sps],[dnl
946 data list notable list /dv1 * dv2  *  y * .
947 begin data.
948 2  .  2     
949 1  .  2 
950 1  .  1    
951 2  .  4    
952 3  .  4
953 4  .  4    
954 5  .  4    
955 end data.
956
957 ONEWAY 
958        /VARIABLES= dv1 dv2  BY y
959        /STATISTICS = DESCRIPTIVES
960        /POSTHOC = BONFERRONI LSD SCHEFFE SIDAK TUKEY
961        /MISSING = ANALYSIS      
962        .
963 ])
964
965 AT_CHECK([pspp -O format=csv crash2.sps], [0], [ignore])
966
967 AT_CLEANUP
968
969
970
971
972 AT_SETUP([ONEWAY Games-Howell test with few cases])
973 AT_DATA([crash3.sps],[dnl
974 data list notable list /dv * y * .
975 begin data.
976 2 2
977 1 2
978 1 1
979 2 4
980 3 4
981 end data.
982
983 ONEWAY
984  /VARIABLES= dv BY y
985  /POSTHOC = GH
986  . 
987 ])
988
989 AT_CHECK([pspp -O format=csv crash3.sps], [0], [ignore])
990
991 AT_CLEANUP
992
993
994 AT_SETUP([ONEWAY Crash on empty data])
995 AT_DATA([crash4.sps],[dnl
996 DATA LIST NOTABLE LIST /height * weight * temperature * sex *.
997 BEGIN DATA.
998 1801     .       .     0
999 1606     .       .     1
1000 END DATA.
1001
1002 ONEWAY /VARIABLES= height weight temperature BY sex
1003  /CONTRAST = -1  1
1004  /CONTRAST = -3  3
1005  /CONTRAST =  2 -2  1
1006  /CONTRAST = -9  9
1007  .
1008 ])
1009
1010 AT_CHECK([pspp -O format=csv crash4.sps], [0], [ignore])
1011
1012 AT_CLEANUP
1013
1014
1015
1016 AT_SETUP([ONEWAY Crash on invalid dependent variable])
1017 AT_DATA([crash5.sps],[dnl
1018 data list notable list /a * b *.
1019 begin data.
1020 3 0
1021 2 0
1022 6 2
1023 end data.
1024
1025 oneway a"by b.
1026
1027 ])
1028
1029 AT_CHECK([pspp -O format=csv crash5.sps], [1], [ignore])
1030
1031 AT_CLEANUP
1032
1033
1034
1035
1036 AT_SETUP([ONEWAY Crash on unterminated string])
1037
1038 AT_DATA([crash6.sps], [dnl
1039 DATA LIST NOTABLE LIST /height * weight * temperature * sex *.
1040 BEGIN DATA.
1041 1801     .       .     0
1042 1606     .   0   .     1
1043 END DATA.
1044
1045 ONEWAY /VARIABLES= height weight temperature BY sex
1046  /CONTRAST =" 2 -2  1
1047  .
1048 ])
1049
1050 AT_CHECK([pspp -O format=csv crash6.sps], [1], [ignore])
1051
1052 AT_CLEANUP