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).
16 AT_CHECK([pspp -o pspp.csv t-test.sps])
17 AT_CHECK([cat pspp.csv], [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 0,A,2.00,5,.71,.32
29 Table: Paired Samples Correlations
31 Pair 0,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 0,A - B,-2.00,.94,.42,-3.16,-.84,-4.78,4,.01
41 AT_SETUP([T-TEST /PAIRS with per-analysis missing values])
42 AT_DATA([ref.sps], [dnl
43 data list list /id * a * b * c * d *.
52 t-test /PAIRS a c with b d (PAIRED).
54 AT_DATA([expout], [dnl
55 Table: Reading free-form data from INLINE.
63 Table: Paired Sample Statistics
64 ,,Mean,N,Std. Deviation,S.E. Mean
65 Pair 0,a,2.00,5,.71,.32
67 Pair 1,c,5.10,5,.69,.31
70 Table: Paired Samples Correlations
72 Pair 0,a & b,5,.92,.03
73 Pair 1,c & d,5,-.92,.03
75 Table: Paired Samples Test
76 ,,Paired Differences,,,,,,,
77 ,,,,,95% Confidence Interval of the Difference,,,,
78 ,,Mean,Std. Deviation,Std. Error Mean,Lower,Upper,t,df,Sig. (2-tailed)
79 Pair 0,a - b,-2.00,.94,.42,-3.16,-.84,-4.78,4,.01
80 Pair 1,c - d,1.30,.84,.37,.26,2.34,3.47,4,.03
82 AT_CHECK([pspp -o ref.csv ref.sps])
83 AT_CHECK([cat ref.csv], [0], [expout])
84 AT_DATA([missing.sps], [dnl
85 data list list /id * a * b * c * d *.
96 t-test /MISSING=analysis /PAIRS a c with b d (PAIRED) /CRITERIA=CIN(0.95).
98 AT_CHECK([pspp -o missing.csv missing.sps])
99 AT_CHECK([cat missing.csv], [0], [expout])
102 AT_SETUP([T-TEST /PAIRS with listwise missing values])
103 AT_DATA([ref.sps], [dnl
104 data list list /id * a * b * c * d *.
113 t-test /PAIRS a b with c d (PAIRED).
115 AT_DATA([expout], [dnl
116 Table: Reading free-form data from INLINE.
124 Table: Paired Sample Statistics
125 ,,Mean,N,Std. Deviation,S.E. Mean
126 Pair 0,a,2.00,5,.71,.32
128 Pair 1,b,4.00,5,1.54,.69
131 Table: Paired Samples Correlations
133 Pair 0,a & c,5,.41,.49
134 Pair 1,b & d,5,-.87,.05
136 Table: Paired Samples Test
137 ,,Paired Differences,,,,,,,
138 ,,,,,95% Confidence Interval of the Difference,,,,
139 ,,Mean,Std. Deviation,Std. Error Mean,Lower,Upper,t,df,Sig. (2-tailed)
140 Pair 0,a - c,-3.10,.76,.34,-4.04,-2.16,-9.14,4,.00
141 Pair 1,b - d,.20,1.68,.75,-1.89,2.29,.27,4,.80
143 AT_CHECK([pspp -o ref.csv ref.sps])
144 AT_CHECK([cat ref.csv], [0], [expout])
145 AT_DATA([missing.sps], [dnl
146 data list list /id * a * b * c * d *.
157 t-test /MISSING=listwise /PAIRS a b with c d (PAIRED).
159 AT_CHECK([pspp -o missing.csv missing.sps])
160 AT_CHECK([cat missing.csv], [0], [expout])
163 dnl Tests for a bug in the paired samples T test.
164 dnl Thanks to Mike Griffiths for reporting this problem.
165 AT_SETUP([T-TEST /PAIRS bug])
166 AT_DATA([t-test.sps], [dnl
168 data list list /A * B *.
175 t-test pairs = a with b (paired).
177 AT_CHECK([pspp -o pspp.csv t-test.sps])
178 AT_CHECK([cat pspp.csv], [0], [dnl
179 Table: Reading free-form data from INLINE.
184 Table: Paired Sample Statistics
185 ,,Mean,N,Std. Deviation,S.E. Mean
186 Pair 0,A,4.333,3,5.774,3.333
189 Table: Paired Samples Correlations
191 Pair 0,A & B,3,1.000,.000
193 Table: Paired Samples Test
194 ,,Paired Differences,,,,,,,
195 ,,,,,95% Confidence Interval of the Difference,,,,
196 ,,Mean,Std. Deviation,Std. Error Mean,Lower,Upper,t,df,Sig. (2-tailed)
197 Pair 0,A - B,3.000,5.196,3.000,-9.908,15.908,1.000,2,.423
201 AT_SETUP([T-TEST /GROUPS])
202 AT_DATA([t-test.sps], [dnl
203 data list list /ID * INDEP * DEP1 * DEP2 *.
218 * Note that the last case should be IGNORED since it doesn't have a
219 dependent variable of either 1.1 or 2.1.
221 t-test /GROUPS=indep(1.1,2.1) /var=dep1 dep2.
223 AT_CHECK([pspp -o pspp.csv t-test.sps])
224 AT_CHECK([cat pspp.csv], [0], [dnl
225 Table: Reading free-form data from INLINE.
232 Table: Group Statistics
233 ,INDEP,N,Mean,Std. Deviation,S.E. Mean
234 DEP1,1.10,5,2.00,.71,.32
236 DEP2,1.10,5,4.00,.71,.32
239 Table: Independent Samples Test
240 ,,Levene's Test for Equality of Variances,,t-test for Equality of Means,,,,,,
241 ,,,,,,,,,95% Confidence Interval of the Difference,
242 ,,F,Sig.,t,df,Sig. (2-tailed),Mean Difference,Std. Error Difference,Lower,Upper
243 DEP1,Equal variances assumed,.00,1.00,-4.47,8.00,.00,-2.00,.45,-3.03,-.97
244 ,Equal variances not assumed,,,-4.47,8.00,.00,-2.00,.45,-3.03,-.97
245 DEP2,Equal variances assumed,.00,1.00,4.47,8.00,.00,2.00,.45,.97,3.03
246 ,Equal variances not assumed,,,4.47,8.00,.00,2.00,.45,.97,3.03
250 AT_SETUP([T-TEST /GROUPS with one value for independent variable])
251 AT_DATA([t-test.sps], [dnl
252 data list list /INDEP * DEP *.
277 t-test /groups=indep(1.514) /var=dep.
279 AT_CHECK([pspp -o pspp.csv t-test.sps])
280 AT_CHECK([cat pspp.csv], [0], [dnl
281 Table: Reading free-form data from INLINE.
286 Table: Group Statistics
287 ,INDEP,N,Mean,Std. Deviation,S.E. Mean
288 DEP,>= 1.51,11,9.00,3.82,1.15
289 ,< 1.51,11,8.00,2.86,.86
291 Table: Independent Samples Test
292 ,,Levene's Test for Equality of Variances,,t-test for Equality of Means,,,,,,
293 ,,,,,,,,,95% Confidence Interval of the Difference,
294 ,,F,Sig.,t,df,Sig. (2-tailed),Mean Difference,Std. Error Difference,Lower,Upper
295 DEP,Equal variances assumed,.17,.68,.69,20.00,.50,1.00,1.44,-2.00,4.00
296 ,Equal variances not assumed,,,.69,18.54,.50,1.00,1.44,-2.02,4.02
300 AT_SETUP([T-TEST /GROUPS with per-analysis missing values])
301 AT_DATA([ref.sps], [dnl
302 data list list /id * indep * dep1 * dep2 *.
311 t-test /group=indep /var=dep1, dep2.
313 AT_DATA([expout], [dnl
314 Table: Reading free-form data from INLINE.
321 Table: Group Statistics
322 ,indep,N,Mean,Std. Deviation,S.E. Mean
323 dep1,1.00,3,2.50,.87,.50
325 dep2,1.00,3,5.00,1.00,.58
326 ,2.00,2,2.00,1.41,1.00
328 Table: Independent Samples Test
329 ,,Levene's Test for Equality of Variances,,t-test for Equality of Means,,,,,,
330 ,,,,,,,,,95% Confidence Interval of the Difference,
331 ,,F,Sig.,t,df,Sig. (2-tailed),Mean Difference,Std. Error Difference,Lower,Upper
332 dep1,Equal variances assumed,3.75,.15,-1.12,3.00,.35,-.75,.56,-2.53,1.03
333 ,Equal variances not assumed,,,-1.34,2.78,.28,-.75,.56,-2.61,1.11
334 dep2,Equal variances assumed,.60,.50,2.85,3.00,.07,3.00,1.15,-.67,6.67
335 ,Equal variances not assumed,,,2.60,1.68,.14,3.00,1.15,-2.98,8.98
337 AT_CHECK([pspp -o ref.csv ref.sps])
338 AT_CHECK([cat ref.csv], [0], [expout])
339 AT_DATA([missing.sps], [dnl
340 data list list /id * indep * dep1 * dep2.
351 * Note that if the independent variable is missing, then it's implicitly
354 t-test /missing=analysis /group=indep /var=dep1 dep2.
356 AT_CHECK([pspp -o missing.csv missing.sps])
357 AT_CHECK([cat missing.csv], [0], [expout])
360 AT_SETUP([T-TEST /GROUPS with listwise missing values])
361 AT_DATA([ref.sps], [dnl
362 data list list /id * indep * dep1 * dep2.
372 t-test /group=indep /var=dep1 dep2.
374 AT_DATA([expout], [dnl
375 Table: Reading free-form data from INLINE.
382 Table: Group Statistics
383 ,indep,N,Mean,Std. Deviation,S.E. Mean
384 dep1,1.00,3,2.50,.87,.50
386 dep2,1.00,3,5.00,1.00,.58
387 ,2.00,3,2.00,1.00,.58
389 Table: Independent Samples Test
390 ,,Levene's Test for Equality of Variances,,t-test for Equality of Means,,,,,,
391 ,,,,,,,,,95% Confidence Interval of the Difference,
392 ,,F,Sig.,t,df,Sig. (2-tailed),Mean Difference,Std. Error Difference,Lower,Upper
393 dep1,Equal variances assumed,2.00,.23,-1.73,4.00,.16,-1.00,.58,-2.60,.60
394 ,Equal variances not assumed,,,-1.73,3.20,.18,-1.00,.58,-2.77,.77
395 dep2,Equal variances assumed,.00,1.00,3.67,4.00,.02,3.00,.82,.73,5.27
396 ,Equal variances not assumed,,,3.67,4.00,.02,3.00,.82,.73,5.27
398 AT_CHECK([pspp -o ref.csv ref.sps])
399 AT_CHECK([cat ref.csv], [0], [expout])
400 AT_DATA([missing.sps], [dnl
401 data list list /id * indep * dep1 * dep2 *.
412 t-test /missing=listwise,exclude /group=indep /var=dep1, dep2.
414 AT_CHECK([pspp -o missing.csv missing.sps])
415 AT_CHECK([cat missing.csv], [0], [expout])
418 AT_SETUP([T-TEST /TESTVAL])
419 AT_DATA([t-test.sps], [dnl
420 data list list /ID * ABC *.
430 t-test /testval=2.0 /var=abc.
432 AT_CHECK([pspp -o pspp.csv t-test.sps])
433 AT_CHECK([cat pspp.csv], [0], [dnl
434 Table: Reading free-form data from INLINE.
439 Table: One-Sample Statistics
440 ,N,Mean,Std. Deviation,S.E. Mean
443 Table: One-Sample Test
444 ,Test Value = 2.000000,,,,,
445 ,,,,,95% Confidence Interval of the Difference,
446 ,t,df,Sig. (2-tailed),Mean Difference,Lower,Upper
447 ABC,2.93,5,.03,1.00,.12,1.88
451 AT_SETUP([T-TEST /TESTVAL with per-analysis missing values])
452 AT_DATA([ref.sps], [dnl
453 data list list /id * x1 * x2.
463 t-test /testval=3.0 /var=x1 x2.
465 AT_DATA([expout], [dnl
466 Table: Reading free-form data from INLINE.
472 Table: One-Sample Statistics
473 ,N,Mean,Std. Deviation,S.E. Mean
475 x2,6,32.67,33.40,13.64
477 Table: One-Sample Test
478 ,Test Value = 3.000000,,,,,
479 ,,,,,95% Confidence Interval of the Difference,
480 ,t,df,Sig. (2-tailed),Mean Difference,Lower,Upper
481 x1,.00,5,1.00,.00,-.88,.88
482 x2,2.18,5,.08,29.67,-5.39,64.72
484 AT_CHECK([pspp -o ref.csv ref.sps])
485 AT_CHECK([cat ref.csv], [0], [expout])
486 AT_DATA([missing.sps], [dnl
487 data list list /id * x1 * x2.
498 t-test /missing=analysis /testval=3.0 /var=x1 x2.
500 AT_CHECK([pspp -o missing.csv missing.sps])
501 AT_CHECK([cat missing.csv], [0], [expout])
504 AT_SETUP([T-TEST /TESTVAL with listwise missing values])
505 AT_DATA([ref.sps], [dnl
506 data list list /id * x1 * x2.
515 t-test /testval=3.0 /var=x1 x2.
517 AT_DATA([expout], [dnl
518 Table: Reading free-form data from INLINE.
524 Table: One-Sample Statistics
525 ,N,Mean,Std. Deviation,S.E. Mean
527 x2,5,37.60,34.82,15.57
529 Table: One-Sample Test
530 ,Test Value = 3.000000,,,,,
531 ,,,,,95% Confidence Interval of the Difference,
532 ,t,df,Sig. (2-tailed),Mean Difference,Lower,Upper
533 x1,-.59,4,.59,-.20,-1.14,.74
534 x2,2.22,4,.09,34.60,-8.63,77.83
536 AT_CHECK([pspp -o ref.csv ref.sps])
537 AT_CHECK([cat ref.csv], [0], [expout])
538 AT_DATA([missing.sps], [dnl
539 data list list /id * x1 * x2.
549 MISSING VALUES x2(99).
551 t-test /missing=listwise /testval=3.0 /var=x1 x2.
553 AT_CHECK([pspp -o missing.csv missing.sps])
554 AT_CHECK([cat missing.csv], [0], [expout])
557 AT_SETUP([T-TEST wih TEMPORARY transformation])
558 AT_DATA([ref.sps], [dnl
559 data list list /ind * x * .
569 t-test /groups=ind(1,2) /var x.
571 AT_DATA([expout], [dnl
572 Table: Reading free-form data from INLINE.
577 Table: Group Statistics
578 ,ind,N,Mean,Std. Deviation,S.E. Mean
579 x,1.00,3,2.50,.87,.50
582 Table: Independent Samples Test
583 ,,Levene's Test for Equality of Variances,,t-test for Equality of Means,,,,,,
584 ,,,,,,,,,95% Confidence Interval of the Difference,
585 ,,F,Sig.,t,df,Sig. (2-tailed),Mean Difference,Std. Error Difference,Lower,Upper
586 x,Equal variances assumed,2.00,.23,-1.73,4.00,.16,-1.00,.58,-2.60,.60
587 ,Equal variances not assumed,,,-1.73,3.20,.18,-1.00,.58,-2.77,.77
589 AT_CHECK([pspp -o ref.csv ref.sps])
590 AT_CHECK([cat ref.csv], [0], [expout])
591 AT_DATA([temporary.sps], [dnl
592 data list list /ind * x * .
606 t-test /groups=ind(1,2) /var x.
608 AT_CHECK([pspp -o temporary.csv temporary.sps])
609 AT_CHECK([cat temporary.csv], [0], [expout])
612 dnl Tests for a bug which caused T-TEST to crash when given invalid syntax.
613 AT_SETUP([T-TEST invalid syntax])
614 AT_DATA([t-test.sps], [dnl
615 DATA LIST LIST NOTABLE /id * a * .
625 T-TEST /testval=2.0 .
626 T-TEST /groups=id(3) .
628 AT_CHECK([pspp -O format=csv t-test.sps], [1], [dnl
629 t-test.sps:11: error: T-TEST: One or more VARIABLES must be specified.
631 t-test.sps:12: error: T-TEST: One or more VARIABLES must be specified.
635 dnl Tests for bug #11227, exhibited when the independent variable is a string.
636 AT_SETUP([T-TEST string variable])
637 AT_DATA([t-test.sps], [dnl
638 data list list /ID * INDEP (a1) DEP1 * DEP2 *.
654 t-test /GROUPS=indep('a','b') /var=dep1 dep2.
656 AT_CHECK([pspp -o pspp.csv t-test.sps])
657 AT_CHECK([cat pspp.csv], [0], [dnl
658 Table: Reading free-form data from INLINE.
665 Table: Group Statistics
666 ,INDEP,N,Mean,Std. Deviation,S.E. Mean
667 DEP1,a,5,2.00,.71,.32
669 DEP2,a,5,4.00,.71,.32
672 Table: Independent Samples Test
673 ,,Levene's Test for Equality of Variances,,t-test for Equality of Means,,,,,,
674 ,,,,,,,,,95% Confidence Interval of the Difference,
675 ,,F,Sig.,t,df,Sig. (2-tailed),Mean Difference,Std. Error Difference,Lower,Upper
676 DEP1,Equal variances assumed,.00,1.00,-4.47,8.00,.00,-2.00,.45,-3.03,-.97
677 ,Equal variances not assumed,,,-4.47,8.00,.00,-2.00,.45,-3.03,-.97
678 DEP2,Equal variances assumed,.00,1.00,4.47,8.00,.00,2.00,.45,.97,3.03
679 ,Equal variances not assumed,,,4.47,8.00,.00,2.00,.45,.97,3.03
683 AT_SETUP([T-TEST string variable, only one value])
684 AT_DATA([t-test.sps], [dnl
685 data list list notable /id * indep (a1) dep1 * dep2 *.
701 t-test /GROUPS=indep('a') /var=dep1 dep2.
703 AT_CHECK([pspp -O format=csv t-test.sps], [1], [dnl
704 "t-test.sps:17: error: T-TEST: When applying GROUPS to a string variable, two values must be specified."
708 dnl Tests for a bug which didn't properly compare string values.
709 AT_SETUP([T-TEST string variable comparison bug])
710 AT_DATA([t-test.sps], [dnl
711 data list list /x * gv (a8).
723 t-test group=gv('One', 'Two')
726 AT_CHECK([pspp -o pspp.csv t-test.sps])
727 AT_CHECK([cat pspp.csv], [0], [dnl
728 Table: Reading free-form data from INLINE.
733 Table: Group Statistics
734 ,gv,N,Mean,Std. Deviation,S.E. Mean
735 x,One ,5,2.60,.55,.24
738 Table: Independent Samples Test
739 ,,Levene's Test for Equality of Variances,,t-test for Equality of Means,,,,,,
740 ,,,,,,,,,95% Confidence Interval of the Difference,
741 ,,F,Sig.,t,df,Sig. (2-tailed),Mean Difference,Std. Error Difference,Lower,Upper
742 x,Equal variances assumed,1.13,.33,-2.32,6.00,.06,-.90,.38,-1.83,.03
743 ,Equal variances not assumed,,,-2.38,4.70,.07,-.90,.38,-1.89,.09