3 AT_SETUP([T-TEST /PAIRS])
4 AT_DATA([t-test.sps], [dnl
5 data list list /ID * A * B *.
14 t-test /PAIRS a with b (PAIRED).
17 AT_CHECK([pspp -O format=csv t-test.sps], [0], [dnl
18 Table: Reading free-form data from INLINE.
24 Table: Paired Sample Statistics
25 ,,Mean,N,Std. Deviation,S.E. Mean
26 Pair 1,A,2.00,5,.71,.32
29 Table: Paired Samples Correlations
31 Pair 1,A & B,5,.92,.028
33 Table: Paired Samples Test
34 ,,Paired Differences,,,,,,,
35 ,,,,,95% Confidence Interval of the Difference,,,,
36 ,,Mean,Std. Deviation,Std. Error Mean,Lower,Upper,t,df,Sig. (2-tailed)
37 Pair 1,A - B,-2.00,.94,.42,-3.16,-.84,-4.78,4,.009
43 AT_SETUP([T-TEST /PAIRS with per-analysis missing values])
45 AT_DATA([ref.sps], [dnl
46 data list list /id * a * b * c * d *.
55 t-test /PAIRS a c with b d (PAIRED).
58 AT_DATA([expout], [dnl
59 Table: Reading free-form data from INLINE.
67 Table: Paired Sample Statistics
68 ,,Mean,N,Std. Deviation,S.E. Mean
69 Pair 1,a,2.00,5,.71,.32
71 Pair 2,c,5.10,5,.69,.31
74 Table: Paired Samples Correlations
76 Pair 1,a & b,5,.92,.028
77 Pair 2,c & d,5,-.92,.028
79 Table: Paired Samples Test
80 ,,Paired Differences,,,,,,,
81 ,,,,,95% Confidence Interval of the Difference,,,,
82 ,,Mean,Std. Deviation,Std. Error Mean,Lower,Upper,t,df,Sig. (2-tailed)
83 Pair 1,a - b,-2.00,.94,.42,-3.16,-.84,-4.78,4,.009
84 Pair 2,c - d,1.30,.84,.37,.26,2.34,3.47,4,.025
87 AT_CHECK([pspp -o ref.csv ref.sps])
88 AT_CHECK([cat ref.csv], [0], [expout])
89 AT_DATA([missing.sps], [dnl
90 data list list /id * a * b * c * d *.
101 t-test /MISSING=analysis /PAIRS a c with b d (PAIRED) /CRITERIA=CI(0.95).
104 AT_CHECK([pspp -o missing.csv missing.sps])
105 AT_CHECK([cat missing.csv], [0], [expout])
108 AT_SETUP([T-TEST /PAIRS with listwise missing values])
109 AT_DATA([ref.sps], [dnl
110 data list list /id * a * b * c * d *.
119 t-test /PAIRS a b with c d (PAIRED).
122 AT_DATA([expout], [dnl
123 Table: Reading free-form data from INLINE.
131 Table: Paired Sample Statistics
132 ,,Mean,N,Std. Deviation,S.E. Mean
133 Pair 1,a,2.00,5,.71,.32
135 Pair 2,b,4.00,5,1.54,.69
138 Table: Paired Samples Correlations
140 Pair 1,a & c,5,.41,.493
141 Pair 2,b & d,5,-.87,.054
143 Table: Paired Samples Test
144 ,,Paired Differences,,,,,,,
145 ,,,,,95% Confidence Interval of the Difference,,,,
146 ,,Mean,Std. Deviation,Std. Error Mean,Lower,Upper,t,df,Sig. (2-tailed)
147 Pair 1,a - c,-3.10,.76,.34,-4.04,-2.16,-9.14,4,.001
148 Pair 2,b - d,.20,1.68,.75,-1.89,2.29,.27,4,.803
151 AT_CHECK([pspp -o ref.csv ref.sps])
153 AT_CHECK([cat ref.csv], [0], [expout])
155 AT_DATA([missing.sps], [dnl
156 data list list /id * a * b * c * d *.
167 t-test /MISSING=listwise /PAIRS a b with c d (PAIRED).
169 AT_CHECK([pspp -o missing.csv missing.sps])
170 AT_CHECK([cat missing.csv], [0], [expout])
174 dnl Tests for a bug in the paired samples T test when weighted
175 dnl Thanks to Douglas Bonett for reporting this.
176 AT_SETUP([T-TEST weighted paired bug])
177 AT_DATA([t-test.sps], [dnl
178 DATA LIST notable LIST /x y w *.
191 PAIRS = y WITH x (PAIRED)
196 AT_CHECK([pspp -O format=csv t-test.sps], [0], [dnl
197 Table: Paired Sample Statistics
198 ,,Mean,N,Std. Deviation,S.E. Mean
199 Pair 1,y,1.94,530.00,.96,.04
200 ,x,1.03,530.00,.17,.01
202 Table: Paired Samples Correlations
204 Pair 1,y & x,530.00,.11,.008
206 Table: Paired Samples Test
207 ,,Paired Differences,,,,,,,
208 ,,,,,95% Confidence Interval of the Difference,,,,
209 ,,Mean,Std. Deviation,Std. Error Mean,Lower,Upper,t,df,Sig. (2-tailed)
210 Pair 1,y - x,.91,.95,.04,.83,.99,22.07,529.00,.000
216 dnl Tests for a bug in the paired samples T test.
217 dnl Thanks to Mike Griffiths for reporting this problem.
218 AT_SETUP([T-TEST /PAIRS bug])
219 AT_DATA([t-test.sps], [dnl
221 data list list /A * B *.
228 t-test pairs = a with b (paired).
230 AT_CHECK([pspp -o pspp.csv t-test.sps])
231 AT_CHECK([cat pspp.csv], [0], [dnl
232 Table: Reading free-form data from INLINE.
237 Table: Paired Sample Statistics
238 ,,Mean,N,Std. Deviation,S.E. Mean
239 Pair 1,A,4.333,3,5.774,3.333
242 Table: Paired Samples Correlations
244 Pair 1,A & B,3,1.000,.000
246 Table: Paired Samples Test
247 ,,Paired Differences,,,,,,,
248 ,,,,,95% Confidence Interval of the Difference,,,,
249 ,,Mean,Std. Deviation,Std. Error Mean,Lower,Upper,t,df,Sig. (2-tailed)
250 Pair 1,A - B,3.000,5.196,3.000,-9.908,15.908,1.000,2,.423
254 AT_SETUP([T-TEST /GROUPS])
255 AT_DATA([t-test.sps], [dnl
256 data list list /ID * INDEP * DEP1 * DEP2 *.
271 * Note that the last case should be IGNORED since it doesn't have a
272 dependent variable of either 1.1 or 2.1.
274 t-test /GROUPS=indep(1.1,2.1) /var=dep1 dep2.
277 AT_CHECK([pspp -O format=csv t-test.sps], [0], [dnl
278 Table: Reading free-form data from INLINE.
285 Table: Group Statistics
286 ,INDEP,N,Mean,Std. Deviation,S.E. Mean
287 DEP1,1.10,5,2.00,.71,.32
289 DEP2,1.10,5,4.00,.71,.32
292 Table: Independent Samples Test
293 ,,Levene's Test for Equality of Variances,,t-test for Equality of Means,,,,,,
294 ,,,,,,,,,95% Confidence Interval of the Difference,
295 ,,F,Sig.,t,df,Sig. (2-tailed),Mean Difference,Std. Error Difference,Lower,Upper
296 DEP1,Equal variances assumed,.00,1.000,-4.47,8.00,.002,-2.00,.45,-3.03,-.97
297 ,Equal variances not assumed,,,-4.47,8.00,.002,-2.00,.45,-3.03,-.97
298 DEP2,Equal variances assumed,.00,1.000,4.47,8.00,.002,2.00,.45,.97,3.03
299 ,Equal variances not assumed,,,4.47,8.00,.002,2.00,.45,.97,3.03
304 AT_SETUP([T-TEST /GROUPS with one value for independent variable])
305 AT_DATA([t-test.sps], [dnl
306 data list list /INDEP * DEP *.
331 t-test /groups=indep(1.514) /var=dep.
334 AT_CHECK([pspp -O format=csv t-test.sps], [0], [dnl
335 Table: Reading free-form data from INLINE.
340 Table: Group Statistics
341 ,INDEP,N,Mean,Std. Deviation,S.E. Mean
342 DEP,≥ 1.51,11,9.00,3.82,1.15
343 ,< 1.51,11,8.00,2.86,.86
345 Table: Independent Samples Test
346 ,,Levene's Test for Equality of Variances,,t-test for Equality of Means,,,,,,
347 ,,,,,,,,,95% Confidence Interval of the Difference,
348 ,,F,Sig.,t,df,Sig. (2-tailed),Mean Difference,Std. Error Difference,Lower,Upper
349 DEP,Equal variances assumed,.17,.683,.69,20.00,.495,1.00,1.44,-2.00,4.00
350 ,Equal variances not assumed,,,.69,18.54,.496,1.00,1.44,-2.02,4.02
354 AT_SETUP([T-TEST /GROUPS with per-analysis missing values])
355 AT_DATA([ref.sps], [dnl
356 data list list /id * indep * dep1 * dep2 *.
365 t-test /group=indep /var=dep1, dep2.
367 AT_DATA([expout], [dnl
368 Table: Reading free-form data from INLINE.
375 Table: Group Statistics
376 ,indep,N,Mean,Std. Deviation,S.E. Mean
377 dep1,1.00,3,2.50,.87,.50
379 dep2,1.00,3,5.00,1.00,.58
380 ,2.00,2,2.00,1.41,1.00
382 Table: Independent Samples Test
383 ,,Levene's Test for Equality of Variances,,t-test for Equality of Means,,,,,,
384 ,,,,,,,,,95% Confidence Interval of the Difference,
385 ,,F,Sig.,t,df,Sig. (2-tailed),Mean Difference,Std. Error Difference,Lower,Upper
386 dep1,Equal variances assumed,3.75,.148,-1.12,3.00,.346,-.75,.67,-2.89,1.39
387 ,Equal variances not assumed,,,-1.34,2.78,.279,-.75,.56,-2.61,1.11
388 dep2,Equal variances assumed,.60,.495,2.85,3.00,.065,3.00,1.05,-.35,6.35
389 ,Equal variances not assumed,,,2.60,1.68,.144,3.00,1.15,-2.98,8.98
391 AT_CHECK([pspp -o ref.csv ref.sps])
392 AT_CHECK([cat ref.csv], [0], [expout])
393 AT_DATA([missing.sps], [dnl
394 data list list /id * indep * dep1 * dep2.
405 * Note that if the independent variable is missing, then it's implicitly
408 t-test /missing=analysis /group=indep /var=dep1 dep2.
410 AT_CHECK([pspp -o missing.csv missing.sps])
411 AT_CHECK([cat missing.csv], [0], [expout])
414 AT_SETUP([T-TEST /GROUPS with listwise missing values])
415 AT_DATA([ref.sps], [dnl
416 data list list /id * indep * dep1 * dep2.
426 t-test /group=indep /var=dep1 dep2.
429 AT_DATA([expout], [dnl
430 Table: Reading free-form data from INLINE.
437 Table: Group Statistics
438 ,indep,N,Mean,Std. Deviation,S.E. Mean
439 dep1,1.00,3,2.50,.87,.50
441 dep2,1.00,3,5.00,1.00,.58
442 ,2.00,3,2.00,1.00,.58
444 Table: Independent Samples Test
445 ,,Levene's Test for Equality of Variances,,t-test for Equality of Means,,,,,,
446 ,,,,,,,,,95% Confidence Interval of the Difference,
447 ,,F,Sig.,t,df,Sig. (2-tailed),Mean Difference,Std. Error Difference,Lower,Upper
448 dep1,Equal variances assumed,2.00,.230,-1.73,4.00,.158,-1.00,.58,-2.60,.60
449 ,Equal variances not assumed,,,-1.73,3.20,.176,-1.00,.58,-2.77,.77
450 dep2,Equal variances assumed,.00,1.000,3.67,4.00,.021,3.00,.82,.73,5.27
451 ,Equal variances not assumed,,,3.67,4.00,.021,3.00,.82,.73,5.27
454 AT_CHECK([pspp -o ref.csv ref.sps])
455 AT_CHECK([cat ref.csv], [0], [expout])
456 AT_DATA([missing.sps], [dnl
457 data list list /id * indep * dep1 * dep2 *.
468 t-test /missing=listwise,exclude /group=indep /var=dep1, dep2.
470 AT_CHECK([pspp -o missing.csv missing.sps])
471 AT_CHECK([cat missing.csv], [0], [expout])
474 AT_SETUP([T-TEST /TESTVAL])
475 AT_DATA([t-test.sps], [dnl
476 data list list /ID * ABC *.
486 t-test /testval=2.0 /var=abc.
488 AT_CHECK([pspp -O format=csv t-test.sps], [0], [dnl
489 Table: Reading free-form data from INLINE.
494 Table: One-Sample Statistics
495 ,N,Mean,Std. Deviation,S.E. Mean
498 Table: One-Sample Test
499 ,Test Value = 2.000000,,,,,
500 ,,,,,95% Confidence Interval of the Difference,
501 ,t,df,Sig. (2-tailed),Mean Difference,Lower,Upper
502 ABC,2.93,5,.033,1.00,.12,1.88
506 AT_SETUP([T-TEST /TESTVAL with per-analysis missing values])
507 AT_DATA([ref.sps], [dnl
508 data list list /id * x1 * x2.
518 t-test /testval=3.0 /var=x1 x2.
520 AT_DATA([expout], [dnl
521 Table: Reading free-form data from INLINE.
527 Table: One-Sample Statistics
528 ,N,Mean,Std. Deviation,S.E. Mean
530 x2,6,32.67,33.40,13.64
532 Table: One-Sample Test
533 ,Test Value = 3.000000,,,,,
534 ,,,,,95% Confidence Interval of the Difference,
535 ,t,df,Sig. (2-tailed),Mean Difference,Lower,Upper
536 x1,.00,5,1.000,.00,-.88,.88
537 x2,2.18,5,.082,29.67,-5.39,64.72
539 AT_CHECK([pspp -o ref.csv ref.sps])
540 AT_CHECK([cat ref.csv], [0], [expout])
541 AT_DATA([missing.sps], [dnl
542 data list list /id * x1 * x2.
553 t-test /missing=analysis /testval=3.0 /var=x1 x2.
555 AT_CHECK([pspp -o missing.csv missing.sps])
556 AT_CHECK([cat missing.csv], [0], [expout])
559 AT_SETUP([T-TEST /TESTVAL with listwise missing values])
560 AT_DATA([ref.sps], [dnl
561 data list list /id * x1 * x2.
570 t-test /testval=3.0 /var=x1 x2.
572 AT_DATA([expout], [dnl
573 Table: Reading free-form data from INLINE.
579 Table: One-Sample Statistics
580 ,N,Mean,Std. Deviation,S.E. Mean
582 x2,5,37.60,34.82,15.57
584 Table: One-Sample Test
585 ,Test Value = 3.000000,,,,,
586 ,,,,,95% Confidence Interval of the Difference,
587 ,t,df,Sig. (2-tailed),Mean Difference,Lower,Upper
588 x1,-.59,4,.587,-.20,-1.14,.74
589 x2,2.22,4,.090,34.60,-8.63,77.83
591 AT_CHECK([pspp -o ref.csv ref.sps])
592 AT_CHECK([cat ref.csv], [0], [expout])
593 AT_DATA([missing.sps], [dnl
594 data list list /id * x1 * x2.
604 MISSING VALUES x2(99).
606 t-test /missing=listwise /testval=3.0 /var=x1 x2.
608 AT_CHECK([pspp -o missing.csv missing.sps])
609 AT_CHECK([cat missing.csv], [0], [expout])
612 AT_SETUP([T-TEST wih TEMPORARY transformation])
613 AT_DATA([ref.sps], [dnl
614 data list list /ind * x * .
624 t-test /groups=ind(1,2) /var x.
626 AT_DATA([expout], [dnl
627 Table: Reading free-form data from INLINE.
632 Table: Group Statistics
633 ,ind,N,Mean,Std. Deviation,S.E. Mean
634 x,1.00,3,2.50,.87,.50
637 Table: Independent Samples Test
638 ,,Levene's Test for Equality of Variances,,t-test for Equality of Means,,,,,,
639 ,,,,,,,,,95% Confidence Interval of the Difference,
640 ,,F,Sig.,t,df,Sig. (2-tailed),Mean Difference,Std. Error Difference,Lower,Upper
641 x,Equal variances assumed,2.00,.230,-1.73,4.00,.158,-1.00,.58,-2.60,.60
642 ,Equal variances not assumed,,,-1.73,3.20,.176,-1.00,.58,-2.77,.77
644 AT_CHECK([pspp -o ref.csv ref.sps])
645 AT_CHECK([cat ref.csv], [0], [expout])
646 AT_DATA([temporary.sps], [dnl
647 data list list /ind * x * .
661 t-test /groups=ind(1 2) /var x.
663 AT_CHECK([pspp -o temporary.csv temporary.sps])
664 AT_CHECK([cat temporary.csv], [0], [expout])
667 dnl Tests for a bug which caused T-TEST to crash when given invalid syntax.
668 AT_SETUP([T-TEST invalid syntax])
669 AT_DATA([t-test.sps], [dnl
670 DATA LIST LIST NOTABLE /id * a * .
680 T-TEST /testval=2.0 .
681 T-TEST /groups=id(3) .
683 AT_CHECK([pspp -O format=csv t-test.sps], [1], [dnl
684 t-test.sps:11: error: T-TEST: Required subcommand VARIABLES was not specified.
686 t-test.sps:12: error: T-TEST: Required subcommand VARIABLES was not specified.
690 dnl Tests for bug #11227, exhibited when the independent variable is a string.
691 AT_SETUP([T-TEST string variable])
692 AT_DATA([t-test.sps], [dnl
693 data list list /ID * INDEP (a1) DEP1 * DEP2 *.
709 t-test /GROUPS=indep('a','b') /var=dep1 dep2.
712 AT_CHECK([pspp -O format=csv t-test.sps], [0], [dnl
713 Table: Reading free-form data from INLINE.
720 Table: Group Statistics
721 ,INDEP,N,Mean,Std. Deviation,S.E. Mean
722 DEP1,a,5,2.00,.71,.32
724 DEP2,a,5,4.00,.71,.32
727 Table: Independent Samples Test
728 ,,Levene's Test for Equality of Variances,,t-test for Equality of Means,,,,,,
729 ,,,,,,,,,95% Confidence Interval of the Difference,
730 ,,F,Sig.,t,df,Sig. (2-tailed),Mean Difference,Std. Error Difference,Lower,Upper
731 DEP1,Equal variances assumed,.00,1.000,-4.47,8.00,.002,-2.00,.45,-3.03,-.97
732 ,Equal variances not assumed,,,-4.47,8.00,.002,-2.00,.45,-3.03,-.97
733 DEP2,Equal variances assumed,.00,1.000,4.47,8.00,.002,2.00,.45,.97,3.03
734 ,Equal variances not assumed,,,4.47,8.00,.002,2.00,.45,.97,3.03
738 AT_SETUP([T-TEST string variable, only one value])
739 AT_DATA([t-test.sps], [dnl
740 data list list notable /id * indep (a1) dep1 * dep2 *.
756 t-test /GROUPS=indep('a') /var=dep1 dep2.
758 AT_CHECK([pspp -O format=csv t-test.sps], [1], [dnl
759 "t-test.sps:17: error: T-TEST: When applying GROUPS to a string variable, two values must be specified."
763 dnl Tests for a bug which didn't properly compare string values.
764 AT_SETUP([T-TEST string variable comparison bug])
765 AT_DATA([t-test.sps], [dnl
766 data list list /x * gv (a8).
778 t-test group=gv('One', 'Two')
782 AT_CHECK([pspp -O format=csv t-test.sps], [0], [dnl
783 Table: Reading free-form data from INLINE.
788 Table: Group Statistics
789 ,gv,N,Mean,Std. Deviation,S.E. Mean
790 x,One ,5,2.60,.55,.24
793 Table: Independent Samples Test
794 ,,Levene's Test for Equality of Variances,,t-test for Equality of Means,,,,,,
795 ,,,,,,,,,95% Confidence Interval of the Difference,
796 ,,F,Sig.,t,df,Sig. (2-tailed),Mean Difference,Std. Error Difference,Lower,Upper
797 x,Equal variances assumed,1.13,.329,-2.32,6.00,.060,-.90,.39,-1.85,.05
798 ,Equal variances not assumed,,,-2.38,4.70,.067,-.90,.38,-1.89,.09
804 dnl Tests for a bug assert failed when the group variables were not of either class
805 AT_SETUP([T-TEST wrong group])
806 AT_DATA([t-test-crs.sps], [dnl
807 data list list /x * g *.
816 t-test /variables = x group=g(1,3).
819 AT_CHECK([pspp t-test-crs.sps], [0],[ignore], [ignore])