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=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).
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])
173 dnl Tests for a bug in the paired samples T test.
174 dnl Thanks to Mike Griffiths for reporting this problem.
175 AT_SETUP([T-TEST /PAIRS bug])
176 AT_DATA([t-test.sps], [dnl
178 data list list /A * B *.
185 t-test pairs = a with b (paired).
187 AT_CHECK([pspp -o pspp.csv t-test.sps])
188 AT_CHECK([cat pspp.csv], [0], [dnl
189 Table: Reading free-form data from INLINE.
194 Table: Paired Sample Statistics
195 ,,Mean,N,Std. Deviation,S.E. Mean
196 Pair 1,A,4.333,3,5.774,3.333
199 Table: Paired Samples Correlations
201 Pair 1,A & B,3,1.000,.000
203 Table: Paired Samples Test
204 ,,Paired Differences,,,,,,,
205 ,,,,,95% Confidence Interval of the Difference,,,,
206 ,,Mean,Std. Deviation,Std. Error Mean,Lower,Upper,t,df,Sig. (2-tailed)
207 Pair 1,A - B,3.000,5.196,3.000,-9.908,15.908,1.000,2,.423
211 AT_SETUP([T-TEST /GROUPS])
212 AT_DATA([t-test.sps], [dnl
213 data list list /ID * INDEP * DEP1 * DEP2 *.
228 * Note that the last case should be IGNORED since it doesn't have a
229 dependent variable of either 1.1 or 2.1.
231 t-test /GROUPS=indep(1.1,2.1) /var=dep1 dep2.
234 AT_CHECK([pspp -O format=csv t-test.sps], [0], [dnl
235 Table: Reading free-form data from INLINE.
242 Table: Group Statistics
243 ,INDEP,N,Mean,Std. Deviation,S.E. Mean
244 DEP1,1.10,5,2.00,.71,.32
246 DEP2,1.10,5,4.00,.71,.32
249 Table: Independent Samples Test
250 ,,Levene's Test for Equality of Variances,,t-test for Equality of Means,,,,,,
251 ,,,,,,,,,95% Confidence Interval of the Difference,
252 ,,F,Sig.,t,df,Sig. (2-tailed),Mean Difference,Std. Error Difference,Lower,Upper
253 DEP1,Equal variances assumed,.00,1.000,-4.47,8.00,.002,-2.00,.45,-3.03,-.97
254 ,Equal variances not assumed,,,-4.47,8.00,.002,-2.00,.45,-3.03,-.97
255 DEP2,Equal variances assumed,.00,1.000,4.47,8.00,.002,2.00,.45,.97,3.03
256 ,Equal variances not assumed,,,4.47,8.00,.002,2.00,.45,.97,3.03
261 AT_SETUP([T-TEST /GROUPS with one value for independent variable])
262 AT_DATA([t-test.sps], [dnl
263 data list list /INDEP * DEP *.
288 t-test /groups=indep(1.514) /var=dep.
291 AT_CHECK([pspp -O format=csv t-test.sps], [0], [dnl
292 Table: Reading free-form data from INLINE.
297 Table: Group Statistics
298 ,INDEP,N,Mean,Std. Deviation,S.E. Mean
299 DEP,≥ 1.51,11,9.00,3.82,1.15
300 ,< 1.51,11,8.00,2.86,.86
302 Table: Independent Samples Test
303 ,,Levene's Test for Equality of Variances,,t-test for Equality of Means,,,,,,
304 ,,,,,,,,,95% Confidence Interval of the Difference,
305 ,,F,Sig.,t,df,Sig. (2-tailed),Mean Difference,Std. Error Difference,Lower,Upper
306 DEP,Equal variances assumed,.17,.683,.69,20.00,.495,1.00,1.44,-2.00,4.00
307 ,Equal variances not assumed,,,.69,18.54,.496,1.00,1.44,-2.02,4.02
311 AT_SETUP([T-TEST /GROUPS with per-analysis missing values])
312 AT_DATA([ref.sps], [dnl
313 data list list /id * indep * dep1 * dep2 *.
322 t-test /group=indep /var=dep1, dep2.
324 AT_DATA([expout], [dnl
325 Table: Reading free-form data from INLINE.
332 Table: Group Statistics
333 ,indep,N,Mean,Std. Deviation,S.E. Mean
334 dep1,1.00,3,2.50,.87,.50
336 dep2,1.00,3,5.00,1.00,.58
337 ,2.00,2,2.00,1.41,1.00
339 Table: Independent Samples Test
340 ,,Levene's Test for Equality of Variances,,t-test for Equality of Means,,,,,,
341 ,,,,,,,,,95% Confidence Interval of the Difference,
342 ,,F,Sig.,t,df,Sig. (2-tailed),Mean Difference,Std. Error Difference,Lower,Upper
343 dep1,Equal variances assumed,3.75,.148,-1.12,3.00,.346,-.75,.67,-2.89,1.39
344 ,Equal variances not assumed,,,-1.34,2.78,.279,-.75,.56,-2.61,1.11
345 dep2,Equal variances assumed,.60,.495,2.85,3.00,.065,3.00,1.05,-.35,6.35
346 ,Equal variances not assumed,,,2.60,1.68,.144,3.00,1.15,-2.98,8.98
348 AT_CHECK([pspp -o ref.csv ref.sps])
349 AT_CHECK([cat ref.csv], [0], [expout])
350 AT_DATA([missing.sps], [dnl
351 data list list /id * indep * dep1 * dep2.
362 * Note that if the independent variable is missing, then it's implicitly
365 t-test /missing=analysis /group=indep /var=dep1 dep2.
367 AT_CHECK([pspp -o missing.csv missing.sps])
368 AT_CHECK([cat missing.csv], [0], [expout])
371 AT_SETUP([T-TEST /GROUPS with listwise missing values])
372 AT_DATA([ref.sps], [dnl
373 data list list /id * indep * dep1 * dep2.
383 t-test /group=indep /var=dep1 dep2.
386 AT_DATA([expout], [dnl
387 Table: Reading free-form data from INLINE.
394 Table: Group Statistics
395 ,indep,N,Mean,Std. Deviation,S.E. Mean
396 dep1,1.00,3,2.50,.87,.50
398 dep2,1.00,3,5.00,1.00,.58
399 ,2.00,3,2.00,1.00,.58
401 Table: Independent Samples Test
402 ,,Levene's Test for Equality of Variances,,t-test for Equality of Means,,,,,,
403 ,,,,,,,,,95% Confidence Interval of the Difference,
404 ,,F,Sig.,t,df,Sig. (2-tailed),Mean Difference,Std. Error Difference,Lower,Upper
405 dep1,Equal variances assumed,2.00,.230,-1.73,4.00,.158,-1.00,.58,-2.60,.60
406 ,Equal variances not assumed,,,-1.73,3.20,.176,-1.00,.58,-2.77,.77
407 dep2,Equal variances assumed,.00,1.000,3.67,4.00,.021,3.00,.82,.73,5.27
408 ,Equal variances not assumed,,,3.67,4.00,.021,3.00,.82,.73,5.27
411 AT_CHECK([pspp -o ref.csv ref.sps])
412 AT_CHECK([cat ref.csv], [0], [expout])
413 AT_DATA([missing.sps], [dnl
414 data list list /id * indep * dep1 * dep2 *.
425 t-test /missing=listwise,exclude /group=indep /var=dep1, dep2.
427 AT_CHECK([pspp -o missing.csv missing.sps])
428 AT_CHECK([cat missing.csv], [0], [expout])
431 AT_SETUP([T-TEST /TESTVAL])
432 AT_DATA([t-test.sps], [dnl
433 data list list /ID * ABC *.
443 t-test /testval=2.0 /var=abc.
445 AT_CHECK([pspp -O format=csv t-test.sps], [0], [dnl
446 Table: Reading free-form data from INLINE.
451 Table: One-Sample Statistics
452 ,N,Mean,Std. Deviation,S.E. Mean
455 Table: One-Sample Test
456 ,Test Value = 2.000000,,,,,
457 ,,,,,95% Confidence Interval of the Difference,
458 ,t,df,Sig. (2-tailed),Mean Difference,Lower,Upper
459 ABC,2.93,5,.033,1.00,.12,1.88
463 AT_SETUP([T-TEST /TESTVAL with per-analysis missing values])
464 AT_DATA([ref.sps], [dnl
465 data list list /id * x1 * x2.
475 t-test /testval=3.0 /var=x1 x2.
477 AT_DATA([expout], [dnl
478 Table: Reading free-form data from INLINE.
484 Table: One-Sample Statistics
485 ,N,Mean,Std. Deviation,S.E. Mean
487 x2,6,32.67,33.40,13.64
489 Table: One-Sample Test
490 ,Test Value = 3.000000,,,,,
491 ,,,,,95% Confidence Interval of the Difference,
492 ,t,df,Sig. (2-tailed),Mean Difference,Lower,Upper
493 x1,.00,5,1.000,.00,-.88,.88
494 x2,2.18,5,.082,29.67,-5.39,64.72
496 AT_CHECK([pspp -o ref.csv ref.sps])
497 AT_CHECK([cat ref.csv], [0], [expout])
498 AT_DATA([missing.sps], [dnl
499 data list list /id * x1 * x2.
510 t-test /missing=analysis /testval=3.0 /var=x1 x2.
512 AT_CHECK([pspp -o missing.csv missing.sps])
513 AT_CHECK([cat missing.csv], [0], [expout])
516 AT_SETUP([T-TEST /TESTVAL with listwise missing values])
517 AT_DATA([ref.sps], [dnl
518 data list list /id * x1 * x2.
527 t-test /testval=3.0 /var=x1 x2.
529 AT_DATA([expout], [dnl
530 Table: Reading free-form data from INLINE.
536 Table: One-Sample Statistics
537 ,N,Mean,Std. Deviation,S.E. Mean
539 x2,5,37.60,34.82,15.57
541 Table: One-Sample Test
542 ,Test Value = 3.000000,,,,,
543 ,,,,,95% Confidence Interval of the Difference,
544 ,t,df,Sig. (2-tailed),Mean Difference,Lower,Upper
545 x1,-.59,4,.587,-.20,-1.14,.74
546 x2,2.22,4,.090,34.60,-8.63,77.83
548 AT_CHECK([pspp -o ref.csv ref.sps])
549 AT_CHECK([cat ref.csv], [0], [expout])
550 AT_DATA([missing.sps], [dnl
551 data list list /id * x1 * x2.
561 MISSING VALUES x2(99).
563 t-test /missing=listwise /testval=3.0 /var=x1 x2.
565 AT_CHECK([pspp -o missing.csv missing.sps])
566 AT_CHECK([cat missing.csv], [0], [expout])
569 AT_SETUP([T-TEST wih TEMPORARY transformation])
570 AT_DATA([ref.sps], [dnl
571 data list list /ind * x * .
581 t-test /groups=ind(1,2) /var x.
583 AT_DATA([expout], [dnl
584 Table: Reading free-form data from INLINE.
589 Table: Group Statistics
590 ,ind,N,Mean,Std. Deviation,S.E. Mean
591 x,1.00,3,2.50,.87,.50
594 Table: Independent Samples Test
595 ,,Levene's Test for Equality of Variances,,t-test for Equality of Means,,,,,,
596 ,,,,,,,,,95% Confidence Interval of the Difference,
597 ,,F,Sig.,t,df,Sig. (2-tailed),Mean Difference,Std. Error Difference,Lower,Upper
598 x,Equal variances assumed,2.00,.230,-1.73,4.00,.158,-1.00,.58,-2.60,.60
599 ,Equal variances not assumed,,,-1.73,3.20,.176,-1.00,.58,-2.77,.77
601 AT_CHECK([pspp -o ref.csv ref.sps])
602 AT_CHECK([cat ref.csv], [0], [expout])
603 AT_DATA([temporary.sps], [dnl
604 data list list /ind * x * .
618 t-test /groups=ind(1,2) /var x.
620 AT_CHECK([pspp -o temporary.csv temporary.sps])
621 AT_CHECK([cat temporary.csv], [0], [expout])
624 dnl Tests for a bug which caused T-TEST to crash when given invalid syntax.
625 AT_SETUP([T-TEST invalid syntax])
626 AT_DATA([t-test.sps], [dnl
627 DATA LIST LIST NOTABLE /id * a * .
637 T-TEST /testval=2.0 .
638 T-TEST /groups=id(3) .
640 AT_CHECK([pspp -O format=csv t-test.sps], [1], [dnl
641 t-test.sps:11: error: T-TEST: Required subcommand VARIABLES was not specified.
643 t-test.sps:12: error: T-TEST: Required subcommand VARIABLES was not specified.
647 dnl Tests for bug #11227, exhibited when the independent variable is a string.
648 AT_SETUP([T-TEST string variable])
649 AT_DATA([t-test.sps], [dnl
650 data list list /ID * INDEP (a1) DEP1 * DEP2 *.
666 t-test /GROUPS=indep('a','b') /var=dep1 dep2.
669 AT_CHECK([pspp -O format=csv t-test.sps], [0], [dnl
670 Table: Reading free-form data from INLINE.
677 Table: Group Statistics
678 ,INDEP,N,Mean,Std. Deviation,S.E. Mean
679 DEP1,a,5,2.00,.71,.32
681 DEP2,a,5,4.00,.71,.32
684 Table: Independent Samples Test
685 ,,Levene's Test for Equality of Variances,,t-test for Equality of Means,,,,,,
686 ,,,,,,,,,95% Confidence Interval of the Difference,
687 ,,F,Sig.,t,df,Sig. (2-tailed),Mean Difference,Std. Error Difference,Lower,Upper
688 DEP1,Equal variances assumed,.00,1.000,-4.47,8.00,.002,-2.00,.45,-3.03,-.97
689 ,Equal variances not assumed,,,-4.47,8.00,.002,-2.00,.45,-3.03,-.97
690 DEP2,Equal variances assumed,.00,1.000,4.47,8.00,.002,2.00,.45,.97,3.03
691 ,Equal variances not assumed,,,4.47,8.00,.002,2.00,.45,.97,3.03
695 AT_SETUP([T-TEST string variable, only one value])
696 AT_DATA([t-test.sps], [dnl
697 data list list notable /id * indep (a1) dep1 * dep2 *.
713 t-test /GROUPS=indep('a') /var=dep1 dep2.
715 AT_CHECK([pspp -O format=csv t-test.sps], [1], [dnl
716 "t-test.sps:17: error: T-TEST: When applying GROUPS to a string variable, two values must be specified."
720 dnl Tests for a bug which didn't properly compare string values.
721 AT_SETUP([T-TEST string variable comparison bug])
722 AT_DATA([t-test.sps], [dnl
723 data list list /x * gv (a8).
735 t-test group=gv('One', 'Two')
739 AT_CHECK([pspp -O format=csv t-test.sps], [0], [dnl
740 Table: Reading free-form data from INLINE.
745 Table: Group Statistics
746 ,gv,N,Mean,Std. Deviation,S.E. Mean
747 x,One ,5,2.60,.55,.24
750 Table: Independent Samples Test
751 ,,Levene's Test for Equality of Variances,,t-test for Equality of Means,,,,,,
752 ,,,,,,,,,95% Confidence Interval of the Difference,
753 ,,F,Sig.,t,df,Sig. (2-tailed),Mean Difference,Std. Error Difference,Lower,Upper
754 x,Equal variances assumed,1.13,.329,-2.32,6.00,.060,-.90,.39,-1.85,.05
755 ,Equal variances not assumed,,,-2.38,4.70,.067,-.90,.38,-1.89,.09
761 dnl Tests for a bug assert failed when the group variables were not of either class
762 AT_SETUP([T-TEST wrong group])
763 AT_DATA([t-test-crs.sps], [dnl
764 data list list /x * g *.
773 t-test /variables = x group=g(1,3).
776 AT_CHECK([pspp t-test-crs.sps], [0],[ignore], [ignore])