q2c: T_RPAREN should be T_LPAREN for matching a left parenthesis.
[pspp-builds.git] / 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 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.
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 0,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 0,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 0,A - B,-2.00,.94,.42,-3.16,-.84,-4.78,4,.01
38 ])
39 AT_CLEANUP
40
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 *.
44 begin data.
45 1 2.0 3.0 4.0 4.0
46 2 1.0 2.0 5.1 3.9
47 3 2.0 4.5 5.2 3.8
48 4 2.0 4.5 5.3 3.7
49 56 3.0 6.0 5.9 3.6
50 end data.
51
52 t-test /PAIRS a c with b d (PAIRED). 
53 ])
54 AT_DATA([expout], [dnl
55 Table: Reading free-form data from INLINE.
56 Variable,Format
57 id,F8.0
58 a,F8.0
59 b,F8.0
60 c,F8.0
61 d,F8.0
62
63 Table: Paired Sample Statistics
64 ,,Mean,N,Std. Deviation,S.E. Mean
65 Pair 0,a,2.00,5,.71,.32
66 ,b,4.00,5,1.54,.69
67 Pair 1,c,5.10,5,.69,.31
68 ,d,3.80,5,.16,.07
69
70 Table: Paired Samples Correlations
71 ,,N,Correlation,Sig.
72 Pair 0,a & b,5,.92,.03
73 Pair 1,c & d,5,-.92,.03
74
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
81 ])
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 *.
86 begin data.
87 1 2.0 3.0 4.0 4.0 
88 2 1.0 2.0 5.1 3.9
89 3 2.0 4.5 5.2 3.8
90 4 2.0 4.5 5.3 3.7
91 5 3.0 6.0 5.9 .
92 6 3.0  .  5.9 3.6
93 end data.
94
95
96 t-test /MISSING=analysis /PAIRS a c with b d (PAIRED) /CRITERIA=CIN(0.95). 
97 ])
98 AT_CHECK([pspp -o missing.csv missing.sps])
99 AT_CHECK([cat missing.csv], [0], [expout])
100 AT_CLEANUP
101
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 *.
105 begin data.
106 1 2.0 3.0 4.0 4.0
107 2 1.0 2.0 5.1 3.9
108 3 2.0 4.5 5.2 3.8
109 4 2.0 4.5 5.3 3.7
110 5 3.0 6.0 5.9 3.6
111 end data.
112
113 t-test /PAIRS a b with c d (PAIRED). 
114 ])
115 AT_DATA([expout], [dnl
116 Table: Reading free-form data from INLINE.
117 Variable,Format
118 id,F8.0
119 a,F8.0
120 b,F8.0
121 c,F8.0
122 d,F8.0
123
124 Table: Paired Sample Statistics
125 ,,Mean,N,Std. Deviation,S.E. Mean
126 Pair 0,a,2.00,5,.71,.32
127 ,c,5.10,5,.69,.31
128 Pair 1,b,4.00,5,1.54,.69
129 ,d,3.80,5,.16,.07
130
131 Table: Paired Samples Correlations
132 ,,N,Correlation,Sig.
133 Pair 0,a & c,5,.41,.49
134 Pair 1,b & d,5,-.87,.05
135
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
142 ])
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 *.
147 begin data.
148 1 2.0 3.0 4.0 4.0 
149 2 1.0 2.0 5.1 3.9
150 3 2.0 4.5 5.2 3.8
151 4 2.0 4.5 5.3 3.7
152 5 3.0 6.0 5.9 3.6
153 6 3.0 6.0 5.9  .
154 end data.
155
156
157 t-test /MISSING=listwise /PAIRS a b with c d (PAIRED). 
158 ])
159 AT_CHECK([pspp -o missing.csv missing.sps])
160 AT_CHECK([cat missing.csv], [0], [expout])
161 AT_CLEANUP
162
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
167 set format f8.3.
168 data list list /A * B *.
169 begin data.
170 11 2
171 1  1
172 1  1
173 end data.
174
175 t-test pairs = a with b (paired).
176 ])
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.
180 Variable,Format
181 A,F8.0
182 B,F8.0
183
184 Table: Paired Sample Statistics
185 ,,Mean,N,Std. Deviation,S.E. Mean
186 Pair 0,A,4.333,3,5.774,3.333
187 ,B,1.333,3,.577,.333
188
189 Table: Paired Samples Correlations
190 ,,N,Correlation,Sig.
191 Pair 0,A & B,3,1.000,.000
192
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
198 ])
199 AT_CLEANUP
200
201 AT_SETUP([T-TEST /GROUPS])
202 AT_DATA([t-test.sps], [dnl
203 data list list /ID * INDEP * DEP1 * DEP2 *.
204 begin data.
205 1  1.1 1 3
206 2  1.1 2 4
207 3  1.1 2 4 
208 4  1.1 2 4 
209 5  1.1 3 5
210 6  2.1 3 1
211 7  2.1 4 2
212 8  2.1 4 2
213 9  2.1 4 2
214 10 2.1 5 3
215 11 3.1 2 2
216 end data.
217
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.
220
221 t-test /GROUPS=indep(1.1,2.1) /var=dep1 dep2.
222 ])
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.
226 Variable,Format
227 ID,F8.0
228 INDEP,F8.0
229 DEP1,F8.0
230 DEP2,F8.0
231
232 Table: Group Statistics
233 ,INDEP,N,Mean,Std. Deviation,S.E. Mean
234 DEP1,1.1,5,2.00,.71,.32
235 ,2.1,5,4.00,.71,.32
236 DEP2,1.1,5,4.00,.71,.32
237 ,2.1,5,2.00,.71,.32
238
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
247 ])
248 AT_CLEANUP
249
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 *.
253 begin data.
254        1        6
255        1        6
256        1        7
257        1        6
258        1       13
259        1        4
260        1        7
261        1        9
262        1        7
263        1       12
264        1       11
265        2       11
266        2        9
267        2        8
268        2        4
269        2       16
270        2        9
271        2        9
272        2        5
273        2        4
274        2       10
275        2       14
276 end data.
277 t-test /groups=indep(1.514) /var=dep.
278 ])
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.
282 Variable,Format
283 INDEP,F8.0
284 DEP,F8.0
285
286 Table: Group Statistics
287 ,INDEP,N,Mean,Std. Deviation,S.E. Mean
288 DEP,>=1.514,11,9.00,3.82,1.15
289 ,<1.514,11,8.00,2.86,.86
290
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,-4.00,2.00
296 ,Equal variances not assumed,,,-.69,18.54,.50,-1.00,1.44,-4.02,2.02
297 ])
298 AT_CLEANUP
299
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 *.
303 begin data.
304 1  1.0 3.5 6
305 2  1.0 2.0 5
306 3  1.0 2.0 4
307 4  2.0 3.5 3
308 56 2.0 3.0 1
309 end data.
310
311 t-test /group=indep /var=dep1, dep2.
312 ])
313 AT_DATA([expout], [dnl
314 Table: Reading free-form data from INLINE.
315 Variable,Format
316 id,F8.0
317 indep,F8.0
318 dep1,F8.0
319 dep2,F8.0
320
321 Table: Group Statistics
322 ,indep,N,Mean,Std. Deviation,S.E. Mean
323 dep1,1,3,2.50,.87,.50
324 ,2,2,3.25,.35,.25
325 dep2,1,3,5.00,1.00,.58
326 ,2,2,2.00,1.41,1.00
327
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
336 ])
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.
341 begin data.
342 1 1.0 3.5 6
343 2 1.0 2.0 5
344 3 1.0 2.0 4
345 4 2.0 3.5 3
346 5 2.0 3.0 .
347 6 2.0 .   1
348 7  .  3.1 5
349 end data.
350
351 * Note that if the independent variable is missing, then it's implicitly 
352 * listwise missing.
353
354 t-test /missing=analysis /group=indep /var=dep1 dep2.
355 ])
356 AT_CHECK([pspp -o missing.csv missing.sps])
357 AT_CHECK([cat missing.csv], [0], [expout])
358 AT_CLEANUP
359
360 AT_SETUP([T-TEST /GROUPS with listwise missing values])
361 AT_DATA([ref.sps], [dnl
362 data list list /id * indep * dep1 * dep2.
363 begin data.
364 1 1.0 3.5 6
365 2 1.0 2.0 5
366 3 1.0 2.0 4
367 4 2.0 3.5 3
368 5 2.0 3.0 2
369 6 2.0 4.0 1
370 end data.
371
372 t-test /group=indep /var=dep1 dep2.
373 ])
374 AT_DATA([expout], [dnl
375 Table: Reading free-form data from INLINE.
376 Variable,Format
377 id,F8.0
378 indep,F8.0
379 dep1,F8.0
380 dep2,F8.0
381
382 Table: Group Statistics
383 ,indep,N,Mean,Std. Deviation,S.E. Mean
384 dep1,1,3,2.50,.87,.50
385 ,2,3,3.50,.50,.29
386 dep2,1,3,5.00,1.00,.58
387 ,2,3,2.00,1.00,.58
388
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
397 ])
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 *.
402 begin data.
403 1 1.0 3.5 6
404 2 1.0 2.0 5
405 3 1.0 2.0 4
406 4 2.0 3.5 3
407 5 2.0 3.0 2
408 6 2.0 4.0 1
409 7 2.0 .   0
410 end data.
411
412 t-test /missing=listwise,exclude /group=indep /var=dep1, dep2.
413 ])
414 AT_CHECK([pspp -o missing.csv missing.sps])
415 AT_CHECK([cat missing.csv], [0], [expout])
416 AT_CLEANUP
417
418 AT_SETUP([T-TEST /TESTVAL])
419 AT_DATA([t-test.sps], [dnl
420 data list list /ID * ABC *.
421 begin data.
422 1 3.5
423 2 2.0
424 3 2.0
425 4 3.5
426 5 3.0
427 6 4.0
428 end data.
429
430 t-test /testval=2.0 /var=abc.
431 ])
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.
435 Variable,Format
436 ID,F8.0
437 ABC,F8.0
438
439 Table: One-Sample Statistics
440 ,N,Mean,Std. Deviation,S.E. Mean
441 ABC,6,3.00,.84,.34
442
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
448 ])
449 AT_CLEANUP
450
451 AT_SETUP([T-TEST /TESTVAL with per-analysis missing values])
452 AT_DATA([ref.sps], [dnl
453 data list list /id * x1 * x2.
454 begin data.
455 1 3.5 34
456 2 2.0 10
457 3 2.0 23
458 4 3.5 98
459 5 3.0 23
460 67 4.0 8
461 end data.
462
463 t-test /testval=3.0 /var=x1 x2.
464 ])
465 AT_DATA([expout], [dnl
466 Table: Reading free-form data from INLINE.
467 Variable,Format
468 id,F8.0
469 x1,F8.0
470 x2,F8.0
471
472 Table: One-Sample Statistics
473 ,N,Mean,Std. Deviation,S.E. Mean
474 x1,6,3.00,.84,.34
475 x2,6,32.67,33.40,13.64
476
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
483 ])
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.
488 begin data.
489 1 3.5 34
490 2 2.0 10
491 3 2.0 23
492 4 3.5 98
493 5 3.0 23
494 6 4.0 .
495 7  .  8
496 end data.
497
498 t-test /missing=analysis /testval=3.0 /var=x1 x2.
499 ])
500 AT_CHECK([pspp -o missing.csv missing.sps])
501 AT_CHECK([cat missing.csv], [0], [expout])
502 AT_CLEANUP
503
504 AT_SETUP([T-TEST /TESTVAL with listwise missing values])
505 AT_DATA([ref.sps], [dnl
506 data list list /id * x1 * x2.
507 begin data.
508 1 3.5 34
509 2 2.0 10
510 3 2.0 23
511 4 3.5 98
512 5 3.0 23
513 end data.
514
515 t-test /testval=3.0 /var=x1 x2.
516 ])
517 AT_DATA([expout], [dnl
518 Table: Reading free-form data from INLINE.
519 Variable,Format
520 id,F8.0
521 x1,F8.0
522 x2,F8.0
523
524 Table: One-Sample Statistics
525 ,N,Mean,Std. Deviation,S.E. Mean
526 x1,5,2.80,.76,.34
527 x2,5,37.60,34.82,15.57
528
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
535 ])
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.
540 begin data.
541 1 3.5 34
542 2 2.0 10
543 3 2.0 23
544 4 3.5 98
545 5 3.0 23
546 6 4.0 99
547 end data.
548
549 MISSING VALUES x2(99).
550
551 t-test /missing=listwise /testval=3.0 /var=x1 x2.
552 ])
553 AT_CHECK([pspp -o missing.csv missing.sps])
554 AT_CHECK([cat missing.csv], [0], [expout])
555 AT_CLEANUP
556
557 AT_SETUP([T-TEST wih TEMPORARY transformation])
558 AT_DATA([ref.sps], [dnl
559 data list list /ind * x * .
560 begin data.
561 1 3.5
562 1 2.0
563 1 2.0
564 2 3.5
565 2 3.0
566 2 4.0
567 end data.
568
569 t-test /groups=ind(1,2) /var x.
570 ])
571 AT_DATA([expout], [dnl
572 Table: Reading free-form data from INLINE.
573 Variable,Format
574 ind,F8.0
575 x,F8.0
576
577 Table: Group Statistics
578 ,ind,N,Mean,Std. Deviation,S.E. Mean
579 x,1,3,2.50,.87,.50
580 ,2,3,3.50,.50,.29
581
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
588 ])
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 * .
593 begin data.
594 1 3.5
595 1 2.0
596 1 2.0
597 2 3.5
598 2 3.0
599 2 4.0
600 2 9.0
601 end data.
602
603 TEMPORARY.
604 SELECT IF x < 7.
605
606 t-test /groups=ind(1,2) /var x.
607 ])
608 AT_CHECK([pspp -o temporary.csv temporary.sps])
609 AT_CHECK([cat temporary.csv], [0], [expout])
610 AT_CLEANUP
611
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 * .
616 BEGIN DATA.
617 1 3.5
618 2 2.0
619 3 2.0
620 4 3.5
621 5 3.0
622 6 4.0
623 END DATA.
624
625 T-TEST /testval=2.0 .
626 T-TEST /groups=id(3) .
627 ])
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.
630
631 t-test.sps:12: error: T-TEST: One or more VARIABLES must be specified.
632 ])
633 AT_CLEANUP
634
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 *.
639 begin data.
640 1  'a' 1 3
641 2  'a' 2 4
642 3  'a' 2 4 
643 4  'a' 2 4 
644 5  'a' 3 5
645 6  'b' 3 1
646 7  'b' 4 2
647 8  'b' 4 2
648 9  'b' 4 2
649 10 'b' 5 3
650 11 'c' 2 2
651 end data.
652
653
654 t-test /GROUPS=indep('a','b') /var=dep1 dep2.
655 ])
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.
659 Variable,Format
660 ID,F8.0
661 INDEP,A1
662 DEP1,F8.0
663 DEP2,F8.0
664
665 Table: Group Statistics
666 ,INDEP,N,Mean,Std. Deviation,S.E. Mean
667 DEP1,a,5,2.00,.71,.32
668 ,b,5,4.00,.71,.32
669 DEP2,a,5,4.00,.71,.32
670 ,b,5,2.00,.71,.32
671
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
680 ])
681 AT_CLEANUP
682
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 *.
686 begin data.
687 1  'a' 1 3
688 2  'a' 2 4
689 3  'a' 2 4 
690 4  'a' 2 4 
691 5  'a' 3 5
692 6  'b' 3 1
693 7  'b' 4 2
694 8  'b' 4 2
695 9  'b' 4 2
696 10 'b' 5 3
697 11 'c' 2 2
698 end data.
699
700
701 t-test /GROUPS=indep('a') /var=dep1 dep2.
702 ])
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."
705 ])
706 AT_CLEANUP
707
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).
712 begin data.
713 3   One
714 2   One
715 3   One
716 2   One
717 3   One
718 4   Two
719 3.5 Two
720 3.0 Two
721 end data.
722
723 t-test group=gv('One', 'Two')
724         /variables = x.
725 ])
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.
729 Variable,Format
730 x,F8.0
731 gv,A8
732
733 Table: Group Statistics
734 ,gv,N,Mean,Std. Deviation,S.E. Mean
735 x,One     ,5,2.60,.55,.24
736 ,Two     ,3,3.50,.50,.29
737
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
744 ])
745 AT_CLEANUP
746