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,.03
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,.03
77 Pair 2,c & d,5,-.92,.03
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=CIN(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).
121 AT_DATA([expout], [dnl
122 Table: Reading free-form data from INLINE.
130 Table: Paired Sample Statistics
131 ,,Mean,N,Std. Deviation,S.E. Mean
132 Pair 1,a,2.00,5,.71,.32
134 Pair 2,b,4.00,5,1.54,.69
137 Table: Paired Samples Correlations
139 Pair 1,a & c,5,.41,.49
140 Pair 2,b & d,5,-.87,.05
142 Table: Paired Samples Test
143 ,,Paired Differences,,,,,,,
144 ,,,,,95% Confidence Interval of the Difference,,,,
145 ,,Mean,Std. Deviation,Std. Error Mean,Lower,Upper,t,df,Sig. (2-tailed)
146 Pair 1,a - c,-3.10,.76,.34,-4.04,-2.16,-9.14,4,.001
147 Pair 2,b - d,.20,1.68,.75,-1.89,2.29,.27,4,.803
150 AT_CHECK([pspp -o ref.csv ref.sps])
152 AT_CHECK([cat ref.csv], [0], [expout])
154 AT_DATA([missing.sps], [dnl
155 data list list /id * a * b * c * d *.
166 t-test /MISSING=listwise /PAIRS a b with c d (PAIRED).
168 AT_CHECK([pspp -o missing.csv missing.sps])
169 AT_CHECK([cat missing.csv], [0], [expout])
172 dnl Tests for a bug in the paired samples T test.
173 dnl Thanks to Mike Griffiths for reporting this problem.
174 AT_SETUP([T-TEST /PAIRS bug])
175 AT_DATA([t-test.sps], [dnl
177 data list list /A * B *.
184 t-test pairs = a with b (paired).
186 AT_CHECK([pspp -o pspp.csv t-test.sps])
187 AT_CHECK([cat pspp.csv], [0], [dnl
188 Table: Reading free-form data from INLINE.
193 Table: Paired Sample Statistics
194 ,,Mean,N,Std. Deviation,S.E. Mean
195 Pair 1,A,4.333,3,5.774,3.333
198 Table: Paired Samples Correlations
200 Pair 1,A & B,3,1.000,.000
202 Table: Paired Samples Test
203 ,,Paired Differences,,,,,,,
204 ,,,,,95% Confidence Interval of the Difference,,,,
205 ,,Mean,Std. Deviation,Std. Error Mean,Lower,Upper,t,df,Sig. (2-tailed)
206 Pair 1,A - B,3.000,5.196,3.000,-9.908,15.908,1.000,2,.423
210 AT_SETUP([T-TEST /GROUPS])
211 AT_DATA([t-test.sps], [dnl
212 data list list /ID * INDEP * DEP1 * DEP2 *.
227 * Note that the last case should be IGNORED since it doesn't have a
228 dependent variable of either 1.1 or 2.1.
230 t-test /GROUPS=indep(1.1,2.1) /var=dep1 dep2.
233 AT_CHECK([pspp -O format=csv t-test.sps], [0], [dnl
234 Table: Reading free-form data from INLINE.
241 Table: Group Statistics
242 ,INDEP,N,Mean,Std. Deviation,S.E. Mean
243 DEP1,1.10,5,2.00,.71,.32
245 DEP2,1.10,5,4.00,.71,.32
248 Table: Independent Samples Test
249 ,,Levene's Test for Equality of Variances,,t-test for Equality of Means,,,,,,
250 ,,,,,,,,,95% Confidence Interval of the Difference,
251 ,,F,Sig.,t,df,Sig. (2-tailed),Mean Difference,Std. Error Difference,Lower,Upper
252 DEP1,Equal variances assumed,.00,1.00,-4.47,8.00,.002,-2.00,.45,-3.03,-.97
253 ,Equal variances not assumed,,,-4.47,8.00,.002,-2.00,.45,-3.03,-.97
254 DEP2,Equal variances assumed,.00,1.00,4.47,8.00,.002,2.00,.45,.97,3.03
255 ,Equal variances not assumed,,,4.47,8.00,.002,2.00,.45,.97,3.03
260 AT_SETUP([T-TEST /GROUPS with one value for independent variable])
261 AT_DATA([t-test.sps], [dnl
262 data list list /INDEP * DEP *.
287 t-test /groups=indep(1.514) /var=dep.
289 AT_CHECK([pspp -O format=csv t-test.sps], [0], [dnl
290 Table: Reading free-form data from INLINE.
295 Table: Group Statistics
296 ,INDEP,N,Mean,Std. Deviation,S.E. Mean
297 DEP,≥ 1.51,11,9.00,3.82,1.15
298 ,< 1.51,11,8.00,2.86,.86
300 Table: Independent Samples Test
301 ,,Levene's Test for Equality of Variances,,t-test for Equality of Means,,,,,,
302 ,,,,,,,,,95% Confidence Interval of the Difference,
303 ,,F,Sig.,t,df,Sig. (2-tailed),Mean Difference,Std. Error Difference,Lower,Upper
304 DEP,Equal variances assumed,.17,.68,.69,20.00,.495,1.00,1.44,-2.00,4.00
305 ,Equal variances not assumed,,,.69,18.54,.496,1.00,1.44,-2.02,4.02
309 AT_SETUP([T-TEST /GROUPS with per-analysis missing values])
310 AT_DATA([ref.sps], [dnl
311 data list list /id * indep * dep1 * dep2 *.
320 t-test /group=indep /var=dep1, dep2.
322 AT_DATA([expout], [dnl
323 Table: Reading free-form data from INLINE.
330 Table: Group Statistics
331 ,indep,N,Mean,Std. Deviation,S.E. Mean
332 dep1,1.00,3,2.50,.87,.50
334 dep2,1.00,3,5.00,1.00,.58
335 ,2.00,2,2.00,1.41,1.00
337 Table: Independent Samples Test
338 ,,Levene's Test for Equality of Variances,,t-test for Equality of Means,,,,,,
339 ,,,,,,,,,95% Confidence Interval of the Difference,
340 ,,F,Sig.,t,df,Sig. (2-tailed),Mean Difference,Std. Error Difference,Lower,Upper
341 dep1,Equal variances assumed,3.75,.15,-1.12,3.00,.346,-.75,.67,-2.89,1.39
342 ,Equal variances not assumed,,,-1.34,2.78,.279,-.75,.56,-2.61,1.11
343 dep2,Equal variances assumed,.60,.50,2.85,3.00,.065,3.00,1.05,-.35,6.35
344 ,Equal variances not assumed,,,2.60,1.68,.144,3.00,1.15,-2.98,8.98
346 AT_CHECK([pspp -o ref.csv ref.sps])
347 AT_CHECK([cat ref.csv], [0], [expout])
348 AT_DATA([missing.sps], [dnl
349 data list list /id * indep * dep1 * dep2.
360 * Note that if the independent variable is missing, then it's implicitly
363 t-test /missing=analysis /group=indep /var=dep1 dep2.
365 AT_CHECK([pspp -o missing.csv missing.sps])
366 AT_CHECK([cat missing.csv], [0], [expout])
369 AT_SETUP([T-TEST /GROUPS with listwise missing values])
370 AT_DATA([ref.sps], [dnl
371 data list list /id * indep * dep1 * dep2.
381 t-test /group=indep /var=dep1 dep2.
384 AT_DATA([expout], [dnl
385 Table: Reading free-form data from INLINE.
392 Table: Group Statistics
393 ,indep,N,Mean,Std. Deviation,S.E. Mean
394 dep1,1.00,3,2.50,.87,.50
396 dep2,1.00,3,5.00,1.00,.58
397 ,2.00,3,2.00,1.00,.58
399 Table: Independent Samples Test
400 ,,Levene's Test for Equality of Variances,,t-test for Equality of Means,,,,,,
401 ,,,,,,,,,95% Confidence Interval of the Difference,
402 ,,F,Sig.,t,df,Sig. (2-tailed),Mean Difference,Std. Error Difference,Lower,Upper
403 dep1,Equal variances assumed,2.00,.23,-1.73,4.00,.158,-1.00,.58,-2.60,.60
404 ,Equal variances not assumed,,,-1.73,3.20,.176,-1.00,.58,-2.77,.77
405 dep2,Equal variances assumed,.00,1.00,3.67,4.00,.021,3.00,.82,.73,5.27
406 ,Equal variances not assumed,,,3.67,4.00,.021,3.00,.82,.73,5.27
409 AT_CHECK([pspp -o ref.csv ref.sps])
410 AT_CHECK([cat ref.csv], [0], [expout])
411 AT_DATA([missing.sps], [dnl
412 data list list /id * indep * dep1 * dep2 *.
423 t-test /missing=listwise,exclude /group=indep /var=dep1, dep2.
425 AT_CHECK([pspp -o missing.csv missing.sps])
426 AT_CHECK([cat missing.csv], [0], [expout])
429 AT_SETUP([T-TEST /TESTVAL])
430 AT_DATA([t-test.sps], [dnl
431 data list list /ID * ABC *.
441 t-test /testval=2.0 /var=abc.
443 AT_CHECK([pspp -O format=csv t-test.sps], [0], [dnl
444 Table: Reading free-form data from INLINE.
449 Table: One-Sample Statistics
450 ,N,Mean,Std. Deviation,S.E. Mean
453 Table: One-Sample Test
454 ,Test Value = 2.000000,,,,,
455 ,,,,,95% Confidence Interval of the Difference,
456 ,t,df,Sig. (2-tailed),Mean Difference,Lower,Upper
457 ABC,2.93,5,.033,1.00,.12,1.88
461 AT_SETUP([T-TEST /TESTVAL with per-analysis missing values])
462 AT_DATA([ref.sps], [dnl
463 data list list /id * x1 * x2.
473 t-test /testval=3.0 /var=x1 x2.
475 AT_DATA([expout], [dnl
476 Table: Reading free-form data from INLINE.
482 Table: One-Sample Statistics
483 ,N,Mean,Std. Deviation,S.E. Mean
485 x2,6,32.67,33.40,13.64
487 Table: One-Sample Test
488 ,Test Value = 3.000000,,,,,
489 ,,,,,95% Confidence Interval of the Difference,
490 ,t,df,Sig. (2-tailed),Mean Difference,Lower,Upper
491 x1,.00,5,1.000,.00,-.88,.88
492 x2,2.18,5,.082,29.67,-5.39,64.72
494 AT_CHECK([pspp -o ref.csv ref.sps])
495 AT_CHECK([cat ref.csv], [0], [expout])
496 AT_DATA([missing.sps], [dnl
497 data list list /id * x1 * x2.
508 t-test /missing=analysis /testval=3.0 /var=x1 x2.
510 AT_CHECK([pspp -o missing.csv missing.sps])
511 AT_CHECK([cat missing.csv], [0], [expout])
514 AT_SETUP([T-TEST /TESTVAL with listwise missing values])
515 AT_DATA([ref.sps], [dnl
516 data list list /id * x1 * x2.
525 t-test /testval=3.0 /var=x1 x2.
527 AT_DATA([expout], [dnl
528 Table: Reading free-form data from INLINE.
534 Table: One-Sample Statistics
535 ,N,Mean,Std. Deviation,S.E. Mean
537 x2,5,37.60,34.82,15.57
539 Table: One-Sample Test
540 ,Test Value = 3.000000,,,,,
541 ,,,,,95% Confidence Interval of the Difference,
542 ,t,df,Sig. (2-tailed),Mean Difference,Lower,Upper
543 x1,-.59,4,.587,-.20,-1.14,.74
544 x2,2.22,4,.090,34.60,-8.63,77.83
546 AT_CHECK([pspp -o ref.csv ref.sps])
547 AT_CHECK([cat ref.csv], [0], [expout])
548 AT_DATA([missing.sps], [dnl
549 data list list /id * x1 * x2.
559 MISSING VALUES x2(99).
561 t-test /missing=listwise /testval=3.0 /var=x1 x2.
563 AT_CHECK([pspp -o missing.csv missing.sps])
564 AT_CHECK([cat missing.csv], [0], [expout])
567 AT_SETUP([T-TEST wih TEMPORARY transformation])
568 AT_DATA([ref.sps], [dnl
569 data list list /ind * x * .
579 t-test /groups=ind(1,2) /var x.
581 AT_DATA([expout], [dnl
582 Table: Reading free-form data from INLINE.
587 Table: Group Statistics
588 ,ind,N,Mean,Std. Deviation,S.E. Mean
589 x,1.00,3,2.50,.87,.50
592 Table: Independent Samples Test
593 ,,Levene's Test for Equality of Variances,,t-test for Equality of Means,,,,,,
594 ,,,,,,,,,95% Confidence Interval of the Difference,
595 ,,F,Sig.,t,df,Sig. (2-tailed),Mean Difference,Std. Error Difference,Lower,Upper
596 x,Equal variances assumed,2.00,.23,-1.73,4.00,.158,-1.00,.58,-2.60,.60
597 ,Equal variances not assumed,,,-1.73,3.20,.176,-1.00,.58,-2.77,.77
599 AT_CHECK([pspp -o ref.csv ref.sps])
600 AT_CHECK([cat ref.csv], [0], [expout])
601 AT_DATA([temporary.sps], [dnl
602 data list list /ind * x * .
616 t-test /groups=ind(1,2) /var x.
618 AT_CHECK([pspp -o temporary.csv temporary.sps])
619 AT_CHECK([cat temporary.csv], [0], [expout])
622 dnl Tests for a bug which caused T-TEST to crash when given invalid syntax.
623 AT_SETUP([T-TEST invalid syntax])
624 AT_DATA([t-test.sps], [dnl
625 DATA LIST LIST NOTABLE /id * a * .
635 T-TEST /testval=2.0 .
636 T-TEST /groups=id(3) .
638 AT_CHECK([pspp -O format=csv t-test.sps], [1], [dnl
639 t-test.sps:11: error: T-TEST: Required subcommand VARIABLES was not specified.
641 t-test.sps:12: error: T-TEST: Required subcommand VARIABLES was not specified.
645 dnl Tests for bug #11227, exhibited when the independent variable is a string.
646 AT_SETUP([T-TEST string variable])
647 AT_DATA([t-test.sps], [dnl
648 data list list /ID * INDEP (a1) DEP1 * DEP2 *.
664 t-test /GROUPS=indep('a','b') /var=dep1 dep2.
667 AT_CHECK([pspp -O format=csv t-test.sps], [0], [dnl
668 Table: Reading free-form data from INLINE.
675 Table: Group Statistics
676 ,INDEP,N,Mean,Std. Deviation,S.E. Mean
677 DEP1,a,5,2.00,.71,.32
679 DEP2,a,5,4.00,.71,.32
682 Table: Independent Samples Test
683 ,,Levene's Test for Equality of Variances,,t-test for Equality of Means,,,,,,
684 ,,,,,,,,,95% Confidence Interval of the Difference,
685 ,,F,Sig.,t,df,Sig. (2-tailed),Mean Difference,Std. Error Difference,Lower,Upper
686 DEP1,Equal variances assumed,.00,1.00,-4.47,8.00,.002,-2.00,.45,-3.03,-.97
687 ,Equal variances not assumed,,,-4.47,8.00,.002,-2.00,.45,-3.03,-.97
688 DEP2,Equal variances assumed,.00,1.00,4.47,8.00,.002,2.00,.45,.97,3.03
689 ,Equal variances not assumed,,,4.47,8.00,.002,2.00,.45,.97,3.03
693 AT_SETUP([T-TEST string variable, only one value])
694 AT_DATA([t-test.sps], [dnl
695 data list list notable /id * indep (a1) dep1 * dep2 *.
711 t-test /GROUPS=indep('a') /var=dep1 dep2.
713 AT_CHECK([pspp -O format=csv t-test.sps], [1], [dnl
714 "t-test.sps:17: error: T-TEST: When applying GROUPS to a string variable, two values must be specified."
718 dnl Tests for a bug which didn't properly compare string values.
719 AT_SETUP([T-TEST string variable comparison bug])
720 AT_DATA([t-test.sps], [dnl
721 data list list /x * gv (a8).
733 t-test group=gv('One', 'Two')
736 AT_CHECK([pspp -O format=csv t-test.sps], [0], [dnl
737 Table: Reading free-form data from INLINE.
742 Table: Group Statistics
743 ,gv,N,Mean,Std. Deviation,S.E. Mean
744 x,One ,5,2.60,.55,.24
747 Table: Independent Samples Test
748 ,,Levene's Test for Equality of Variances,,t-test for Equality of Means,,,,,,
749 ,,,,,,,,,95% Confidence Interval of the Difference,
750 ,,F,Sig.,t,df,Sig. (2-tailed),Mean Difference,Std. Error Difference,Lower,Upper
751 x,Equal variances assumed,1.13,.33,-2.32,6.00,.060,-.90,.39,-1.85,.05
752 ,Equal variances not assumed,,,-2.38,4.70,.067,-.90,.38,-1.89,.09
758 dnl Tests for a bug assert failed when the group variables were not of either class
759 AT_SETUP([T-TEST wrong group])
760 AT_DATA([t-test-crs.sps], [dnl
761 data list list /x * g *.
770 t-test /variables = x group=g(1,3).
773 AT_CHECK([pspp t-test-crs.sps], [0],[ignore], [ignore])