Annotate some more results as p-values and update the tests accordingly
[pspp] / tests / language / stats / t-test.at
1 AT_BANNER([T-TEST])
2
3 AT_SETUP([T-TEST /PAIRS])
4 AT_DATA([t-test.sps], [dnl
5 data list list /ID * A * B *.
6 begin data.
7 1 2.0 3.0
8 2 1.0 2.0
9 3 2.0 4.5
10 4 2.0 4.5
11 5 3.0 6.0
12 end data.
13
14 t-test /PAIRS a with b (PAIRED).
15 ])
16
17 AT_CHECK([pspp -O format=csv t-test.sps], [0], [dnl
18 Table: Reading free-form data from INLINE.
19 Variable,Format
20 ID,F8.0
21 A,F8.0
22 B,F8.0
23
24 Table: Paired Sample Statistics
25 ,,Mean,N,Std. Deviation,S.E. Mean
26 Pair 1,A,2.00,5,.71,.32
27 ,B,4.00,5,1.54,.69
28
29 Table: Paired Samples Correlations
30 ,,N,Correlation,Sig.
31 Pair 1,A & B,5,.92,.028
32
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
38 ])
39
40 AT_CLEANUP
41
42
43 AT_SETUP([T-TEST /PAIRS with per-analysis missing values])
44
45 AT_DATA([ref.sps], [dnl
46 data list list /id * a * b * c * d *.
47 begin data.
48 1 2.0 3.0 4.0 4.0
49 2 1.0 2.0 5.1 3.9
50 3 2.0 4.5 5.2 3.8
51 4 2.0 4.5 5.3 3.7
52 56 3.0 6.0 5.9 3.6
53 end data.
54
55 t-test /PAIRS a c with b d (PAIRED). 
56 ])
57
58 AT_DATA([expout], [dnl
59 Table: Reading free-form data from INLINE.
60 Variable,Format
61 id,F8.0
62 a,F8.0
63 b,F8.0
64 c,F8.0
65 d,F8.0
66
67 Table: Paired Sample Statistics
68 ,,Mean,N,Std. Deviation,S.E. Mean
69 Pair 1,a,2.00,5,.71,.32
70 ,b,4.00,5,1.54,.69
71 Pair 2,c,5.10,5,.69,.31
72 ,d,3.80,5,.16,.07
73
74 Table: Paired Samples Correlations
75 ,,N,Correlation,Sig.
76 Pair 1,a & b,5,.92,.028
77 Pair 2,c & d,5,-.92,.028
78
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
85 ])
86
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 *.
91 begin data.
92 1 2.0 3.0 4.0 4.0 
93 2 1.0 2.0 5.1 3.9
94 3 2.0 4.5 5.2 3.8
95 4 2.0 4.5 5.3 3.7
96 5 3.0 6.0 5.9 .
97 6 3.0  .  5.9 3.6
98 end data.
99
100
101 t-test /MISSING=analysis /PAIRS a c with b d (PAIRED) /CRITERIA=CIN(0.95). 
102 ])
103
104 AT_CHECK([pspp -o missing.csv missing.sps])
105 AT_CHECK([cat missing.csv], [0], [expout])
106 AT_CLEANUP
107
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 *.
111 begin data.
112 1 2.0 3.0 4.0 4.0
113 2 1.0 2.0 5.1 3.9
114 3 2.0 4.5 5.2 3.8
115 4 2.0 4.5 5.3 3.7
116 5 3.0 6.0 5.9 3.6
117 end data.
118
119 t-test /PAIRS a b with c d (PAIRED). 
120 ])
121
122 AT_DATA([expout], [dnl
123 Table: Reading free-form data from INLINE.
124 Variable,Format
125 id,F8.0
126 a,F8.0
127 b,F8.0
128 c,F8.0
129 d,F8.0
130
131 Table: Paired Sample Statistics
132 ,,Mean,N,Std. Deviation,S.E. Mean
133 Pair 1,a,2.00,5,.71,.32
134 ,c,5.10,5,.69,.31
135 Pair 2,b,4.00,5,1.54,.69
136 ,d,3.80,5,.16,.07
137
138 Table: Paired Samples Correlations
139 ,,N,Correlation,Sig.
140 Pair 1,a & c,5,.41,.493
141 Pair 2,b & d,5,-.87,.054
142
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
149 ])
150
151 AT_CHECK([pspp -o ref.csv ref.sps])
152
153 AT_CHECK([cat ref.csv], [0], [expout])
154
155 AT_DATA([missing.sps], [dnl
156 data list list /id * a * b * c * d *.
157 begin data.
158 1 2.0 3.0 4.0 4.0 
159 2 1.0 2.0 5.1 3.9
160 3 2.0 4.5 5.2 3.8
161 4 2.0 4.5 5.3 3.7
162 5 3.0 6.0 5.9 3.6
163 6 3.0 6.0 5.9  .
164 end data.
165
166
167 t-test /MISSING=listwise /PAIRS a b with c d (PAIRED). 
168 ])
169 AT_CHECK([pspp -o missing.csv missing.sps])
170 AT_CHECK([cat missing.csv], [0], [expout])
171 AT_CLEANUP
172
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
177 set format f8.3.
178 data list list /A * B *.
179 begin data.
180 11 2
181 1  1
182 1  1
183 end data.
184
185 t-test pairs = a with b (paired).
186 ])
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.
190 Variable,Format
191 A,F8.0
192 B,F8.0
193
194 Table: Paired Sample Statistics
195 ,,Mean,N,Std. Deviation,S.E. Mean
196 Pair 1,A,4.333,3,5.774,3.333
197 ,B,1.333,3,.577,.333
198
199 Table: Paired Samples Correlations
200 ,,N,Correlation,Sig.
201 Pair 1,A & B,3,1.000,.000
202
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
208 ])
209 AT_CLEANUP
210
211 AT_SETUP([T-TEST /GROUPS])
212 AT_DATA([t-test.sps], [dnl
213 data list list /ID * INDEP * DEP1 * DEP2 *.
214 begin data.
215 1  1.1 1 3
216 2  1.1 2 4
217 3  1.1 2 4 
218 4  1.1 2 4 
219 5  1.1 3 5
220 6  2.1 3 1
221 7  2.1 4 2
222 8  2.1 4 2
223 9  2.1 4 2
224 10 2.1 5 3
225 11 3.1 2 2
226 end data.
227
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.
230
231 t-test /GROUPS=indep(1.1,2.1) /var=dep1 dep2.
232 ])
233
234 AT_CHECK([pspp -O format=csv t-test.sps], [0], [dnl
235 Table: Reading free-form data from INLINE.
236 Variable,Format
237 ID,F8.0
238 INDEP,F8.0
239 DEP1,F8.0
240 DEP2,F8.0
241
242 Table: Group Statistics
243 ,INDEP,N,Mean,Std. Deviation,S.E. Mean
244 DEP1,1.10,5,2.00,.71,.32
245 ,2.10,5,4.00,.71,.32
246 DEP2,1.10,5,4.00,.71,.32
247 ,2.10,5,2.00,.71,.32
248
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
257 ])
258
259 AT_CLEANUP
260
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 *.
264 begin data.
265        1        6
266        1        6
267        1        7
268        1        6
269        1       13
270        1        4
271        1        7
272        1        9
273        1        7
274        1       12
275        1       11
276        2       11
277        2        9
278        2        8
279        2        4
280        2       16
281        2        9
282        2        9
283        2        5
284        2        4
285        2       10
286        2       14
287 end data.
288 t-test /groups=indep(1.514) /var=dep.
289 ])
290
291 AT_CHECK([pspp -O format=csv t-test.sps], [0], [dnl
292 Table: Reading free-form data from INLINE.
293 Variable,Format
294 INDEP,F8.0
295 DEP,F8.0
296
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
301
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
308 ])
309 AT_CLEANUP
310
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 *.
314 begin data.
315 1  1.0 3.5 6
316 2  1.0 2.0 5
317 3  1.0 2.0 4
318 4  2.0 3.5 3
319 56 2.0 3.0 1
320 end data.
321
322 t-test /group=indep /var=dep1, dep2.
323 ])
324 AT_DATA([expout], [dnl
325 Table: Reading free-form data from INLINE.
326 Variable,Format
327 id,F8.0
328 indep,F8.0
329 dep1,F8.0
330 dep2,F8.0
331
332 Table: Group Statistics
333 ,indep,N,Mean,Std. Deviation,S.E. Mean
334 dep1,1.00,3,2.50,.87,.50
335 ,2.00,2,3.25,.35,.25
336 dep2,1.00,3,5.00,1.00,.58
337 ,2.00,2,2.00,1.41,1.00
338
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
347 ])
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.
352 begin data.
353 1 1.0 3.5 6
354 2 1.0 2.0 5
355 3 1.0 2.0 4
356 4 2.0 3.5 3
357 5 2.0 3.0 .
358 6 2.0 .   1
359 7  .  3.1 5
360 end data.
361
362 * Note that if the independent variable is missing, then it's implicitly 
363 * listwise missing.
364
365 t-test /missing=analysis /group=indep /var=dep1 dep2.
366 ])
367 AT_CHECK([pspp -o missing.csv missing.sps])
368 AT_CHECK([cat missing.csv], [0], [expout])
369 AT_CLEANUP
370
371 AT_SETUP([T-TEST /GROUPS with listwise missing values])
372 AT_DATA([ref.sps], [dnl
373 data list list /id * indep * dep1 * dep2.
374 begin data.
375 1 1.0 3.5 6
376 2 1.0 2.0 5
377 3 1.0 2.0 4
378 4 2.0 3.5 3
379 5 2.0 3.0 2
380 6 2.0 4.0 1
381 end data.
382
383 t-test /group=indep /var=dep1 dep2.
384 ])
385
386 AT_DATA([expout], [dnl
387 Table: Reading free-form data from INLINE.
388 Variable,Format
389 id,F8.0
390 indep,F8.0
391 dep1,F8.0
392 dep2,F8.0
393
394 Table: Group Statistics
395 ,indep,N,Mean,Std. Deviation,S.E. Mean
396 dep1,1.00,3,2.50,.87,.50
397 ,2.00,3,3.50,.50,.29
398 dep2,1.00,3,5.00,1.00,.58
399 ,2.00,3,2.00,1.00,.58
400
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
409 ])
410
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 *.
415 begin data.
416 1 1.0 3.5 6
417 2 1.0 2.0 5
418 3 1.0 2.0 4
419 4 2.0 3.5 3
420 5 2.0 3.0 2
421 6 2.0 4.0 1
422 7 2.0 .   0
423 end data.
424
425 t-test /missing=listwise,exclude /group=indep /var=dep1, dep2.
426 ])
427 AT_CHECK([pspp -o missing.csv missing.sps])
428 AT_CHECK([cat missing.csv], [0], [expout])
429 AT_CLEANUP
430
431 AT_SETUP([T-TEST /TESTVAL])
432 AT_DATA([t-test.sps], [dnl
433 data list list /ID * ABC *.
434 begin data.
435 1 3.5
436 2 2.0
437 3 2.0
438 4 3.5
439 5 3.0
440 6 4.0
441 end data.
442
443 t-test /testval=2.0 /var=abc.
444 ])
445 AT_CHECK([pspp -O format=csv t-test.sps], [0], [dnl
446 Table: Reading free-form data from INLINE.
447 Variable,Format
448 ID,F8.0
449 ABC,F8.0
450
451 Table: One-Sample Statistics
452 ,N,Mean,Std. Deviation,S.E. Mean
453 ABC,6,3.00,.84,.34
454
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
460 ])
461 AT_CLEANUP
462
463 AT_SETUP([T-TEST /TESTVAL with per-analysis missing values])
464 AT_DATA([ref.sps], [dnl
465 data list list /id * x1 * x2.
466 begin data.
467 1 3.5 34
468 2 2.0 10
469 3 2.0 23
470 4 3.5 98
471 5 3.0 23
472 67 4.0 8
473 end data.
474
475 t-test /testval=3.0 /var=x1 x2.
476 ])
477 AT_DATA([expout], [dnl
478 Table: Reading free-form data from INLINE.
479 Variable,Format
480 id,F8.0
481 x1,F8.0
482 x2,F8.0
483
484 Table: One-Sample Statistics
485 ,N,Mean,Std. Deviation,S.E. Mean
486 x1,6,3.00,.84,.34
487 x2,6,32.67,33.40,13.64
488
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
495 ])
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.
500 begin data.
501 1 3.5 34
502 2 2.0 10
503 3 2.0 23
504 4 3.5 98
505 5 3.0 23
506 6 4.0 .
507 7  .  8
508 end data.
509
510 t-test /missing=analysis /testval=3.0 /var=x1 x2.
511 ])
512 AT_CHECK([pspp -o missing.csv missing.sps])
513 AT_CHECK([cat missing.csv], [0], [expout])
514 AT_CLEANUP
515
516 AT_SETUP([T-TEST /TESTVAL with listwise missing values])
517 AT_DATA([ref.sps], [dnl
518 data list list /id * x1 * x2.
519 begin data.
520 1 3.5 34
521 2 2.0 10
522 3 2.0 23
523 4 3.5 98
524 5 3.0 23
525 end data.
526
527 t-test /testval=3.0 /var=x1 x2.
528 ])
529 AT_DATA([expout], [dnl
530 Table: Reading free-form data from INLINE.
531 Variable,Format
532 id,F8.0
533 x1,F8.0
534 x2,F8.0
535
536 Table: One-Sample Statistics
537 ,N,Mean,Std. Deviation,S.E. Mean
538 x1,5,2.80,.76,.34
539 x2,5,37.60,34.82,15.57
540
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
547 ])
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.
552 begin data.
553 1 3.5 34
554 2 2.0 10
555 3 2.0 23
556 4 3.5 98
557 5 3.0 23
558 6 4.0 99
559 end data.
560
561 MISSING VALUES x2(99).
562
563 t-test /missing=listwise /testval=3.0 /var=x1 x2.
564 ])
565 AT_CHECK([pspp -o missing.csv missing.sps])
566 AT_CHECK([cat missing.csv], [0], [expout])
567 AT_CLEANUP
568
569 AT_SETUP([T-TEST wih TEMPORARY transformation])
570 AT_DATA([ref.sps], [dnl
571 data list list /ind * x * .
572 begin data.
573 1 3.5
574 1 2.0
575 1 2.0
576 2 3.5
577 2 3.0
578 2 4.0
579 end data.
580
581 t-test /groups=ind(1,2) /var x.
582 ])
583 AT_DATA([expout], [dnl
584 Table: Reading free-form data from INLINE.
585 Variable,Format
586 ind,F8.0
587 x,F8.0
588
589 Table: Group Statistics
590 ,ind,N,Mean,Std. Deviation,S.E. Mean
591 x,1.00,3,2.50,.87,.50
592 ,2.00,3,3.50,.50,.29
593
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
600 ])
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 * .
605 begin data.
606 1 3.5
607 1 2.0
608 1 2.0
609 2 3.5
610 2 3.0
611 2 4.0
612 2 9.0
613 end data.
614
615 TEMPORARY.
616 SELECT IF x < 7.
617
618 t-test /groups=ind(1,2) /var x.
619 ])
620 AT_CHECK([pspp -o temporary.csv temporary.sps])
621 AT_CHECK([cat temporary.csv], [0], [expout])
622 AT_CLEANUP
623
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 * .
628 BEGIN DATA.
629 1 3.5
630 2 2.0
631 3 2.0
632 4 3.5
633 5 3.0
634 6 4.0
635 END DATA.
636
637 T-TEST /testval=2.0 .
638 T-TEST /groups=id(3) .
639 ])
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.
642
643 t-test.sps:12: error: T-TEST: Required subcommand VARIABLES was not specified.
644 ])
645 AT_CLEANUP
646
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 *.
651 begin data.
652 1  'a' 1 3
653 2  'a' 2 4
654 3  'a' 2 4 
655 4  'a' 2 4 
656 5  'a' 3 5
657 6  'b' 3 1
658 7  'b' 4 2
659 8  'b' 4 2
660 9  'b' 4 2
661 10 'b' 5 3
662 11 'c' 2 2
663 end data.
664
665
666 t-test /GROUPS=indep('a','b') /var=dep1 dep2.
667 ])
668
669 AT_CHECK([pspp -O format=csv t-test.sps], [0], [dnl
670 Table: Reading free-form data from INLINE.
671 Variable,Format
672 ID,F8.0
673 INDEP,A1
674 DEP1,F8.0
675 DEP2,F8.0
676
677 Table: Group Statistics
678 ,INDEP,N,Mean,Std. Deviation,S.E. Mean
679 DEP1,a,5,2.00,.71,.32
680 ,b,5,4.00,.71,.32
681 DEP2,a,5,4.00,.71,.32
682 ,b,5,2.00,.71,.32
683
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
692 ])
693 AT_CLEANUP
694
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 *.
698 begin data.
699 1  'a' 1 3
700 2  'a' 2 4
701 3  'a' 2 4 
702 4  'a' 2 4 
703 5  'a' 3 5
704 6  'b' 3 1
705 7  'b' 4 2
706 8  'b' 4 2
707 9  'b' 4 2
708 10 'b' 5 3
709 11 'c' 2 2
710 end data.
711
712
713 t-test /GROUPS=indep('a') /var=dep1 dep2.
714 ])
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."
717 ])
718 AT_CLEANUP
719
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).
724 begin data.
725 3   One
726 2   One
727 3   One
728 2   One
729 3   One
730 4   Two
731 3.5 Two
732 3.0 Two
733 end data.
734
735 t-test group=gv('One', 'Two')
736         /variables = x.
737 ])
738
739 AT_CHECK([pspp -O format=csv t-test.sps], [0], [dnl
740 Table: Reading free-form data from INLINE.
741 Variable,Format
742 x,F8.0
743 gv,A8
744
745 Table: Group Statistics
746 ,gv,N,Mean,Std. Deviation,S.E. Mean
747 x,One     ,5,2.60,.55,.24
748 ,Two     ,3,3.50,.50,.29
749
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
756 ])
757 AT_CLEANUP
758
759
760
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 *.
765 begin data.
766 1 2
767 2 2
768 3 2
769 4 2
770 5 2 
771 end data.
772
773 t-test /variables = x group=g(1,3).
774 ])
775
776 AT_CHECK([pspp t-test-crs.sps], [0],[ignore], [ignore])
777
778 AT_CLEANUP