24b00f23093c9a65ce109a210430f7079767ecae
[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,.03
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,.03
77 Pair 2,c & d,5,-.92,.03
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 AT_DATA([expout], [dnl
122 Table: Reading free-form data from INLINE.
123 Variable,Format
124 id,F8.0
125 a,F8.0
126 b,F8.0
127 c,F8.0
128 d,F8.0
129
130 Table: Paired Sample Statistics
131 ,,Mean,N,Std. Deviation,S.E. Mean
132 Pair 1,a,2.00,5,.71,.32
133 ,c,5.10,5,.69,.31
134 Pair 2,b,4.00,5,1.54,.69
135 ,d,3.80,5,.16,.07
136
137 Table: Paired Samples Correlations
138 ,,N,Correlation,Sig.
139 Pair 1,a & c,5,.41,.49
140 Pair 2,b & d,5,-.87,.05
141
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
148 ])
149
150 AT_CHECK([pspp -o ref.csv ref.sps])
151
152 AT_CHECK([cat ref.csv], [0], [expout])
153
154 AT_DATA([missing.sps], [dnl
155 data list list /id * a * b * c * d *.
156 begin data.
157 1 2.0 3.0 4.0 4.0 
158 2 1.0 2.0 5.1 3.9
159 3 2.0 4.5 5.2 3.8
160 4 2.0 4.5 5.3 3.7
161 5 3.0 6.0 5.9 3.6
162 6 3.0 6.0 5.9  .
163 end data.
164
165
166 t-test /MISSING=listwise /PAIRS a b with c d (PAIRED). 
167 ])
168 AT_CHECK([pspp -o missing.csv missing.sps])
169 AT_CHECK([cat missing.csv], [0], [expout])
170 AT_CLEANUP
171
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
176 set format f8.3.
177 data list list /A * B *.
178 begin data.
179 11 2
180 1  1
181 1  1
182 end data.
183
184 t-test pairs = a with b (paired).
185 ])
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.
189 Variable,Format
190 A,F8.0
191 B,F8.0
192
193 Table: Paired Sample Statistics
194 ,,Mean,N,Std. Deviation,S.E. Mean
195 Pair 1,A,4.333,3,5.774,3.333
196 ,B,1.333,3,.577,.333
197
198 Table: Paired Samples Correlations
199 ,,N,Correlation,Sig.
200 Pair 1,A & B,3,1.000,.000
201
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
207 ])
208 AT_CLEANUP
209
210 AT_SETUP([T-TEST /GROUPS])
211 AT_DATA([t-test.sps], [dnl
212 data list list /ID * INDEP * DEP1 * DEP2 *.
213 begin data.
214 1  1.1 1 3
215 2  1.1 2 4
216 3  1.1 2 4 
217 4  1.1 2 4 
218 5  1.1 3 5
219 6  2.1 3 1
220 7  2.1 4 2
221 8  2.1 4 2
222 9  2.1 4 2
223 10 2.1 5 3
224 11 3.1 2 2
225 end data.
226
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.
229
230 t-test /GROUPS=indep(1.1,2.1) /var=dep1 dep2.
231 ])
232
233 AT_CHECK([pspp -O format=csv t-test.sps], [0], [dnl
234 Table: Reading free-form data from INLINE.
235 Variable,Format
236 ID,F8.0
237 INDEP,F8.0
238 DEP1,F8.0
239 DEP2,F8.0
240
241 Table: Group Statistics
242 ,INDEP,N,Mean,Std. Deviation,S.E. Mean
243 DEP1,1.10,5,2.00,.71,.32
244 ,2.10,5,4.00,.71,.32
245 DEP2,1.10,5,4.00,.71,.32
246 ,2.10,5,2.00,.71,.32
247
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
256 ])
257
258 AT_CLEANUP
259
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 *.
263 begin data.
264        1        6
265        1        6
266        1        7
267        1        6
268        1       13
269        1        4
270        1        7
271        1        9
272        1        7
273        1       12
274        1       11
275        2       11
276        2        9
277        2        8
278        2        4
279        2       16
280        2        9
281        2        9
282        2        5
283        2        4
284        2       10
285        2       14
286 end data.
287 t-test /groups=indep(1.514) /var=dep.
288 ])
289 AT_CHECK([pspp -O format=csv t-test.sps], [0], [dnl
290 Table: Reading free-form data from INLINE.
291 Variable,Format
292 INDEP,F8.0
293 DEP,F8.0
294
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
299
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
306 ])
307 AT_CLEANUP
308
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 *.
312 begin data.
313 1  1.0 3.5 6
314 2  1.0 2.0 5
315 3  1.0 2.0 4
316 4  2.0 3.5 3
317 56 2.0 3.0 1
318 end data.
319
320 t-test /group=indep /var=dep1, dep2.
321 ])
322 AT_DATA([expout], [dnl
323 Table: Reading free-form data from INLINE.
324 Variable,Format
325 id,F8.0
326 indep,F8.0
327 dep1,F8.0
328 dep2,F8.0
329
330 Table: Group Statistics
331 ,indep,N,Mean,Std. Deviation,S.E. Mean
332 dep1,1.00,3,2.50,.87,.50
333 ,2.00,2,3.25,.35,.25
334 dep2,1.00,3,5.00,1.00,.58
335 ,2.00,2,2.00,1.41,1.00
336
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
345 ])
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.
350 begin data.
351 1 1.0 3.5 6
352 2 1.0 2.0 5
353 3 1.0 2.0 4
354 4 2.0 3.5 3
355 5 2.0 3.0 .
356 6 2.0 .   1
357 7  .  3.1 5
358 end data.
359
360 * Note that if the independent variable is missing, then it's implicitly 
361 * listwise missing.
362
363 t-test /missing=analysis /group=indep /var=dep1 dep2.
364 ])
365 AT_CHECK([pspp -o missing.csv missing.sps])
366 AT_CHECK([cat missing.csv], [0], [expout])
367 AT_CLEANUP
368
369 AT_SETUP([T-TEST /GROUPS with listwise missing values])
370 AT_DATA([ref.sps], [dnl
371 data list list /id * indep * dep1 * dep2.
372 begin data.
373 1 1.0 3.5 6
374 2 1.0 2.0 5
375 3 1.0 2.0 4
376 4 2.0 3.5 3
377 5 2.0 3.0 2
378 6 2.0 4.0 1
379 end data.
380
381 t-test /group=indep /var=dep1 dep2.
382 ])
383
384 AT_DATA([expout], [dnl
385 Table: Reading free-form data from INLINE.
386 Variable,Format
387 id,F8.0
388 indep,F8.0
389 dep1,F8.0
390 dep2,F8.0
391
392 Table: Group Statistics
393 ,indep,N,Mean,Std. Deviation,S.E. Mean
394 dep1,1.00,3,2.50,.87,.50
395 ,2.00,3,3.50,.50,.29
396 dep2,1.00,3,5.00,1.00,.58
397 ,2.00,3,2.00,1.00,.58
398
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
407 ])
408
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 *.
413 begin data.
414 1 1.0 3.5 6
415 2 1.0 2.0 5
416 3 1.0 2.0 4
417 4 2.0 3.5 3
418 5 2.0 3.0 2
419 6 2.0 4.0 1
420 7 2.0 .   0
421 end data.
422
423 t-test /missing=listwise,exclude /group=indep /var=dep1, dep2.
424 ])
425 AT_CHECK([pspp -o missing.csv missing.sps])
426 AT_CHECK([cat missing.csv], [0], [expout])
427 AT_CLEANUP
428
429 AT_SETUP([T-TEST /TESTVAL])
430 AT_DATA([t-test.sps], [dnl
431 data list list /ID * ABC *.
432 begin data.
433 1 3.5
434 2 2.0
435 3 2.0
436 4 3.5
437 5 3.0
438 6 4.0
439 end data.
440
441 t-test /testval=2.0 /var=abc.
442 ])
443 AT_CHECK([pspp -O format=csv t-test.sps], [0], [dnl
444 Table: Reading free-form data from INLINE.
445 Variable,Format
446 ID,F8.0
447 ABC,F8.0
448
449 Table: One-Sample Statistics
450 ,N,Mean,Std. Deviation,S.E. Mean
451 ABC,6,3.00,.84,.34
452
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
458 ])
459 AT_CLEANUP
460
461 AT_SETUP([T-TEST /TESTVAL with per-analysis missing values])
462 AT_DATA([ref.sps], [dnl
463 data list list /id * x1 * x2.
464 begin data.
465 1 3.5 34
466 2 2.0 10
467 3 2.0 23
468 4 3.5 98
469 5 3.0 23
470 67 4.0 8
471 end data.
472
473 t-test /testval=3.0 /var=x1 x2.
474 ])
475 AT_DATA([expout], [dnl
476 Table: Reading free-form data from INLINE.
477 Variable,Format
478 id,F8.0
479 x1,F8.0
480 x2,F8.0
481
482 Table: One-Sample Statistics
483 ,N,Mean,Std. Deviation,S.E. Mean
484 x1,6,3.00,.84,.34
485 x2,6,32.67,33.40,13.64
486
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
493 ])
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.
498 begin data.
499 1 3.5 34
500 2 2.0 10
501 3 2.0 23
502 4 3.5 98
503 5 3.0 23
504 6 4.0 .
505 7  .  8
506 end data.
507
508 t-test /missing=analysis /testval=3.0 /var=x1 x2.
509 ])
510 AT_CHECK([pspp -o missing.csv missing.sps])
511 AT_CHECK([cat missing.csv], [0], [expout])
512 AT_CLEANUP
513
514 AT_SETUP([T-TEST /TESTVAL with listwise missing values])
515 AT_DATA([ref.sps], [dnl
516 data list list /id * x1 * x2.
517 begin data.
518 1 3.5 34
519 2 2.0 10
520 3 2.0 23
521 4 3.5 98
522 5 3.0 23
523 end data.
524
525 t-test /testval=3.0 /var=x1 x2.
526 ])
527 AT_DATA([expout], [dnl
528 Table: Reading free-form data from INLINE.
529 Variable,Format
530 id,F8.0
531 x1,F8.0
532 x2,F8.0
533
534 Table: One-Sample Statistics
535 ,N,Mean,Std. Deviation,S.E. Mean
536 x1,5,2.80,.76,.34
537 x2,5,37.60,34.82,15.57
538
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
545 ])
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.
550 begin data.
551 1 3.5 34
552 2 2.0 10
553 3 2.0 23
554 4 3.5 98
555 5 3.0 23
556 6 4.0 99
557 end data.
558
559 MISSING VALUES x2(99).
560
561 t-test /missing=listwise /testval=3.0 /var=x1 x2.
562 ])
563 AT_CHECK([pspp -o missing.csv missing.sps])
564 AT_CHECK([cat missing.csv], [0], [expout])
565 AT_CLEANUP
566
567 AT_SETUP([T-TEST wih TEMPORARY transformation])
568 AT_DATA([ref.sps], [dnl
569 data list list /ind * x * .
570 begin data.
571 1 3.5
572 1 2.0
573 1 2.0
574 2 3.5
575 2 3.0
576 2 4.0
577 end data.
578
579 t-test /groups=ind(1,2) /var x.
580 ])
581 AT_DATA([expout], [dnl
582 Table: Reading free-form data from INLINE.
583 Variable,Format
584 ind,F8.0
585 x,F8.0
586
587 Table: Group Statistics
588 ,ind,N,Mean,Std. Deviation,S.E. Mean
589 x,1.00,3,2.50,.87,.50
590 ,2.00,3,3.50,.50,.29
591
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
598 ])
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 * .
603 begin data.
604 1 3.5
605 1 2.0
606 1 2.0
607 2 3.5
608 2 3.0
609 2 4.0
610 2 9.0
611 end data.
612
613 TEMPORARY.
614 SELECT IF x < 7.
615
616 t-test /groups=ind(1,2) /var x.
617 ])
618 AT_CHECK([pspp -o temporary.csv temporary.sps])
619 AT_CHECK([cat temporary.csv], [0], [expout])
620 AT_CLEANUP
621
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 * .
626 BEGIN DATA.
627 1 3.5
628 2 2.0
629 3 2.0
630 4 3.5
631 5 3.0
632 6 4.0
633 END DATA.
634
635 T-TEST /testval=2.0 .
636 T-TEST /groups=id(3) .
637 ])
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.
640
641 t-test.sps:12: error: T-TEST: Required subcommand VARIABLES was not specified.
642 ])
643 AT_CLEANUP
644
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 *.
649 begin data.
650 1  'a' 1 3
651 2  'a' 2 4
652 3  'a' 2 4 
653 4  'a' 2 4 
654 5  'a' 3 5
655 6  'b' 3 1
656 7  'b' 4 2
657 8  'b' 4 2
658 9  'b' 4 2
659 10 'b' 5 3
660 11 'c' 2 2
661 end data.
662
663
664 t-test /GROUPS=indep('a','b') /var=dep1 dep2.
665 ])
666
667 AT_CHECK([pspp -O format=csv t-test.sps], [0], [dnl
668 Table: Reading free-form data from INLINE.
669 Variable,Format
670 ID,F8.0
671 INDEP,A1
672 DEP1,F8.0
673 DEP2,F8.0
674
675 Table: Group Statistics
676 ,INDEP,N,Mean,Std. Deviation,S.E. Mean
677 DEP1,a,5,2.00,.71,.32
678 ,b,5,4.00,.71,.32
679 DEP2,a,5,4.00,.71,.32
680 ,b,5,2.00,.71,.32
681
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
690 ])
691 AT_CLEANUP
692
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 *.
696 begin data.
697 1  'a' 1 3
698 2  'a' 2 4
699 3  'a' 2 4 
700 4  'a' 2 4 
701 5  'a' 3 5
702 6  'b' 3 1
703 7  'b' 4 2
704 8  'b' 4 2
705 9  'b' 4 2
706 10 'b' 5 3
707 11 'c' 2 2
708 end data.
709
710
711 t-test /GROUPS=indep('a') /var=dep1 dep2.
712 ])
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."
715 ])
716 AT_CLEANUP
717
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).
722 begin data.
723 3   One
724 2   One
725 3   One
726 2   One
727 3   One
728 4   Two
729 3.5 Two
730 3.0 Two
731 end data.
732
733 t-test group=gv('One', 'Two')
734         /variables = x.
735 ])
736 AT_CHECK([pspp -O format=csv t-test.sps], [0], [dnl
737 Table: Reading free-form data from INLINE.
738 Variable,Format
739 x,F8.0
740 gv,A8
741
742 Table: Group Statistics
743 ,gv,N,Mean,Std. Deviation,S.E. Mean
744 x,One     ,5,2.60,.55,.24
745 ,Two     ,3,3.50,.50,.29
746
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
753 ])
754 AT_CLEANUP
755
756
757
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 *.
762 begin data.
763 1 2
764 2 2
765 3 2
766 4 2
767 5 2 
768 end data.
769
770 t-test /variables = x group=g(1,3).
771 ])
772
773 AT_CHECK([pspp t-test-crs.sps], [0],[ignore], [ignore])
774
775 AT_CLEANUP