eab403e3c91a396a6ad25836e44f0c7143c9118e
[pspp] / tests / language / stats / crosstabs.at
1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2017 Free Software Foundation, Inc.
3 dnl
4 dnl This program is free software: you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation, either version 3 of the License, or
7 dnl (at your option) any later version.
8 dnl
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 dnl GNU General Public License for more details.
13 dnl
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 dnl
17 AT_BANNER([CROSSTABS procedure])
18
19 AT_SETUP([CROSSTABS integer mode crash])
20 AT_DATA([crosstabs.sps],
21   [DATA LIST LIST /A * B * X * Y * .
22 BEGIN DATA.
23 2 3 4 5
24 END DATA.
25
26 CROSSTABS VARIABLES X (1,7) Y (1,7) /TABLES X BY Y.
27 ])
28 AT_CHECK([pspp -o pspp.csv -o pspp.txt crosstabs.sps])
29 AT_CHECK([cat pspp.csv], [0],
30   [[Table: Reading free-form data from INLINE.
31 Variable,Format
32 A,F8.0
33 B,F8.0
34 X,F8.0
35 Y,F8.0
36
37 Table: Summary
38 ,Cases,,,,,
39 ,Valid,,Missing,,Total,
40 ,N,Percent,N,Percent,N,Percent
41 X × Y,1,100.0%,0,.0%,1,100.0%
42
43 Table: X × Y
44 ,,,Y,,,,,,,Total
45 ,,,1.00,2.00,3.00,4.00,5.00,6.00,7.00,
46 X,1.00,Count,0,0,0,0,0,0,0,0
47 ,2.00,Count,0,0,0,0,0,0,0,0
48 ,3.00,Count,0,0,0,0,0,0,0,0
49 ,4.00,Count,0,0,0,0,1,0,0,1
50 ,5.00,Count,0,0,0,0,0,0,0,0
51 ,6.00,Count,0,0,0,0,0,0,0,0
52 ,7.00,Count,0,0,0,0,0,0,0,0
53 Total,,Count,0,0,0,0,1,0,0,1
54 ]])
55 AT_CLEANUP
56
57 # Bug #47600.
58 AT_SETUP([CROSSTABS integer mode crash 2])
59 AT_DATA([crosstabs.sps], [dnl
60 DATA LIST lIST /x y.
61 BEGIN DATA.
62 4 5
63 END DATA.
64
65 CROSSTABS
66         VARIABLES x (1,3) y (1,7)
67       /TABLES x BY y.
68 ])
69 AT_CHECK([pspp -O format=csv crosstabs.sps], [0],
70   [[Table: Reading free-form data from INLINE.
71 Variable,Format
72 x,F8.0
73 y,F8.0
74
75 Table: Summary
76 ,Cases,,,,,
77 ,Valid,,Missing,,Total,
78 ,N,Percent,N,Percent,N,Percent
79 x × y,0,.0%,1,100.0%,1,100.0%
80
81 Table: x × y
82 ,,,y,,,,,,,Total
83 ,,,1.00,2.00,3.00,4.00,5.00,6.00,7.00,
84 x,1.00,Count,,,,,,,,
85 ,2.00,Count,,,,,,,,
86 ,3.00,Count,,,,,,,,
87 Total,,Count,,,,,,,,
88 ]])
89 AT_CLEANUP
90
91 # Bug #22037.
92 AT_SETUP([CROSSTABS long string crash])
93 AT_DATA([crosstabs.sps],
94   [data list list /x * y (a18).
95
96 begin data.
97
98    1. 'zero none'
99
100 1 'one unity'
101 2 'two duality'
102 3 'three lots'
103 end data.
104
105 CROSSTABS /TABLES = x BY y.
106 ])
107 AT_CHECK([pspp -o - -O format=csv -o pspp.txt crosstabs.sps], [0],
108   [[Table: Reading free-form data from INLINE.
109 Variable,Format
110 x,F8.0
111 y,A18
112
113 "crosstabs.sps:4: warning: Missing value(s) for all variables from x onward.  These will be filled with the system-missing value or blanks, as appropriate."
114
115 "crosstabs.sps:6: warning: Missing value(s) for all variables from x onward.  These will be filled with the system-missing value or blanks, as appropriate."
116
117 Table: Summary
118 ,Cases,,,,,
119 ,Valid,,Missing,,Total,
120 ,N,Percent,N,Percent,N,Percent
121 x × y,4,66.7%,2,33.3%,6,100.0%
122
123 Table: x × y
124 ,,,y,,,,Total
125 ,,,one unity,three lots,two duality,zero none,
126 x,1.00,Count,1,0,0,1,2
127 ,2.00,Count,0,0,1,0,1
128 ,3.00,Count,0,1,0,0,1
129 Total,,Count,1,1,1,1,4
130 ]])
131 AT_CLEANUP
132
133 AT_SETUP([CROSSTABS crash])
134 AT_DATA([crosstabs.sps],
135   [[DATA LIST FIXED
136      / x   1-2
137        y   3
138        z   4.
139
140 BEGIN DATA.
141 0111
142 0222
143 0311
144 0412
145 0521
146 0612
147 0711
148 0811
149 0912
150 END DATA.
151
152 LIST.
153
154
155 CROSSTABS TABLES  y by z.
156 ]])
157 AT_CHECK([pspp -o - -O format=csv -o pspp.txt crosstabs.sps], [0],
158   [Table: Reading 1 record from INLINE.
159 Variable,Record,Columns,Format
160 x,1,1-2,F2.0
161 y,1,3-3,F1.0
162 z,1,4-4,F1.0
163
164 Table: Data List
165 x,y,z
166 1,1,1
167 2,2,2
168 3,1,1
169 4,1,2
170 5,2,1
171 6,1,2
172 7,1,1
173 8,1,1
174 9,1,2
175
176 Table: Summary
177 ,Cases,,,,,
178 ,Valid,,Missing,,Total,
179 ,N,Percent,N,Percent,N,Percent
180 y × z,9,100.0%,0,.0%,9,100.0%
181
182 Table: y × z
183 ,,,z,,Total
184 ,,,1,2,
185 y,1,Count,4,3,7
186 ,2,Count,1,1,2
187 Total,,Count,5,4,9
188 ])
189 AT_CLEANUP
190
191 # Bug #26739, which caused CROSSTABS to crash or to fail to output
192 # chi-square results.
193 AT_SETUP([CROSSTABS chi-square crash])
194 AT_DATA([crosstabs.sps],
195   [[DATA LIST LIST /x * y *.
196 BEGIN DATA.
197 2 2
198 3 1
199 4 2
200 4 1
201 END DATA.
202
203 CROSSTABS
204         /TABLES= x BY y
205         /STATISTICS=CHISQ.
206 ]])
207 AT_CHECK([pspp -O format=csv crosstabs.sps], [0],
208   [[Table: Reading free-form data from INLINE.
209 Variable,Format
210 x,F8.0
211 y,F8.0
212
213 Table: Summary
214 ,Cases,,,,,
215 ,Valid,,Missing,,Total,
216 ,N,Percent,N,Percent,N,Percent
217 x × y,4,100.0%,0,.0%,4,100.0%
218
219 Table: x × y
220 ,,,y,,Total
221 ,,,1.00,2.00,
222 x,2.00,Count,0,1,1
223 ,3.00,Count,1,0,1
224 ,4.00,Count,1,1,2
225 Total,,Count,2,2,4
226
227 Table: Chi-Square Tests
228 ,Value,df,Asymptotic Sig. (2-tailed)
229 Pearson Chi-Square,2.00,2,.368
230 Likelihood Ratio,2.77,2,.250
231 Linear-by-Linear Association,.27,1,.602
232 N of Valid Cases,4,,
233 ]])
234 AT_CLEANUP
235
236 # Bug #27883.
237 AT_SETUP([CROSSTABS crash with SPLIT FILE])
238 AT_DATA([crosstabs.sps],
239   [data list notable / v0 to v2 1-6 (A)
240 begin data.
241 a c e
242 a c e
243 a c e
244 a d e
245 a d f
246 b d f
247 b d f
248 b c f
249 b d e
250 a c f
251 end data.
252 SORT CASES BY v0.
253 SPLIT FILE SEPARATE BY v0.
254
255 CROSSTABS
256     /TABLES= v1 BY v2
257     /FORMAT=AVALUE TABLES
258     /STATISTICS=CHISQ
259     /CELLS=COUNT ROW COLUMN TOTAL.
260 ])
261
262 AT_CHECK([pspp -o pspp.csv -o pspp.txt crosstabs.sps])
263 AT_CHECK([cat pspp.csv], [0], [dnl
264 Table: Split Values
265 Variable,Value
266 v0,a
267
268 Table: Summary
269 ,Cases,,,,,
270 ,Valid,,Missing,,Total,
271 ,N,Percent,N,Percent,N,Percent
272 v1 × v2,6,100.0%,0,.0%,6,100.0%
273
274 Table: v1 × v2
275 ,,,v2,,Total
276 ,,,e,f,
277 v1,c,Count,3,1,4
278 ,,Row %,75.0%,25.0%,100.0%
279 ,,Column %,75.0%,50.0%,66.7%
280 ,,Total %,50.0%,16.7%,66.7%
281 ,d,Count,1,1,2
282 ,,Row %,50.0%,50.0%,100.0%
283 ,,Column %,25.0%,50.0%,33.3%
284 ,,Total %,16.7%,16.7%,33.3%
285 Total,,Count,4,2,6
286 ,,Row %,66.7%,33.3%,100.0%
287 ,,Column %,100.0%,100.0%,100.0%
288 ,,Total %,66.7%,33.3%,100.0%
289
290 Table: Chi-Square Tests
291 ,Value,df,Asymptotic Sig. (2-tailed),Exact Sig. (2-tailed),Exact Sig. (1-tailed)
292 Pearson Chi-Square,.38,1,.540,,
293 Likelihood Ratio,.37,1,.545,,
294 Fisher's Exact Test,,,,1.000,.600
295 Continuity Correction,.00,1,1.000,,
296 N of Valid Cases,6,,,,
297
298 Table: Split Values
299 Variable,Value
300 v0,b
301
302 Table: Summary
303 ,Cases,,,,,
304 ,Valid,,Missing,,Total,
305 ,N,Percent,N,Percent,N,Percent
306 v1 × v2,4,100.0%,0,.0%,4,100.0%
307
308 Table: v1 × v2
309 ,,,v2,,Total
310 ,,,e,f,
311 v1,c,Count,0,1,1
312 ,,Row %,.0%,100.0%,100.0%
313 ,,Column %,.0%,33.3%,25.0%
314 ,,Total %,.0%,25.0%,25.0%
315 ,d,Count,1,2,3
316 ,,Row %,33.3%,66.7%,100.0%
317 ,,Column %,100.0%,66.7%,75.0%
318 ,,Total %,25.0%,50.0%,75.0%
319 Total,,Count,1,3,4
320 ,,Row %,25.0%,75.0%,100.0%
321 ,,Column %,100.0%,100.0%,100.0%
322 ,,Total %,25.0%,75.0%,100.0%
323
324 Table: Chi-Square Tests
325 ,Value,df,Asymptotic Sig. (2-tailed),Exact Sig. (2-tailed),Exact Sig. (1-tailed)
326 Pearson Chi-Square,.44,1,.505,,
327 Likelihood Ratio,.68,1,.410,,
328 Fisher's Exact Test,,,,1.000,.750
329 Continuity Correction,.00,1,1.000,,
330 N of Valid Cases,4,,,,
331 ])
332 AT_CLEANUP
333
334 # Bug #24752.
335 AT_SETUP([3-way CROSSTABS])
336 AT_DATA([crosstabs.sps],
337   [[DATA LIST FIXED
338      / x   1-2
339        y   3
340        z   4.
341
342 BEGIN DATA.
343 0111
344 0222
345 0311
346 0412
347 0521
348 0612
349 0711
350 0811
351 0912
352 END DATA.
353
354 LIST.
355
356
357 CROSSTABS TABLES  x BY y BY z/STATISTICS=ALL.
358 ]])
359 AT_CHECK([pspp -o - -O format=csv -o pspp.csv -o pspp.txt crosstabs.sps], [0],
360   [Table: Reading 1 record from INLINE.
361 Variable,Record,Columns,Format
362 x,1,1-2,F2.0
363 y,1,3-3,F1.0
364 z,1,4-4,F1.0
365
366 Table: Data List
367 x,y,z
368 1,1,1
369 2,2,2
370 3,1,1
371 4,1,2
372 5,2,1
373 6,1,2
374 7,1,1
375 8,1,1
376 9,1,2
377
378 Table: Summary
379 ,Cases,,,,,
380 ,Valid,,Missing,,Total,
381 ,N,Percent,N,Percent,N,Percent
382 x × y × z,9,100.0%,0,.0%,9,100.0%
383
384 Table: x × y × z
385 ,,,,,y,,Total
386 ,,,,,1,2,
387 z,1,x,1,Count,1,0,1
388 ,,,3,Count,0,0,1
389 ,,,5,Count,1,0,1
390 ,,,7,Count,0,0,1
391 ,,,8,Count,0,1,1
392 ,,Total,,Count,4,1,5
393 ,2,x,2,Count,0,0,1
394 ,,,4,Count,0,1,1
395 ,,,6,Count,0,0,1
396 ,,,9,Count,1,0,1
397 ,,Total,,Count,3,1,4
398
399 Table: Chi-Square Tests
400 ,,,Value,df,Asymptotic Sig. (2-tailed)
401 z,1,Pearson Chi-Square,5.00,4,.287
402 ,,Likelihood Ratio,5.00,4,.287
403 ,,Linear-by-Linear Association,.01,1,.938
404 ,,N of Valid Cases,5,,
405 ,2,Pearson Chi-Square,4.00,3,.261
406 ,,Likelihood Ratio,4.50,3,.212
407 ,,Linear-by-Linear Association,1.58,1,.209
408 ,,N of Valid Cases,4,,
409
410 Table: Symmetric Measures
411 ,,,,Value,Asymp. Std. Error,Approx. T
412 z,1,Nominal by Nominal,Phi,1.00,,
413 ,,,Cramer's V,1.00,,
414 ,,,Contingency Coefficient,.71,,
415 ,,Ordinal by Ordinal,Kendall's tau-b,.00,.32,.00
416 ,,,Kendall's tau-c,.00,.32,.00
417 ,,,Gamma,.00,.50,.00
418 ,,,Spearman Correlation,.00,.22,.00
419 ,,Interval by Interval,Pearson's R,.04,.22,.07
420 ,,N of Valid Cases,,5,,
421 ,2,Nominal by Nominal,Phi,1.00,,
422 ,,,Cramer's V,1.00,,
423 ,,,Contingency Coefficient,.71,,
424 ,,Ordinal by Ordinal,Kendall's tau-b,-.71,.20,-1.73
425 ,,,Kendall's tau-c,-.75,.43,-1.73
426 ,,,Gamma,-1.00,.00,-1.73
427 ,,,Spearman Correlation,-.77,.17,-1.73
428 ,,Interval by Interval,Pearson's R,-.73,.18,-1.49
429 ,,N of Valid Cases,,4,,
430
431 Table: Directional Measures
432 ,,,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
433 z,1,Nominal by Nominal,Lambda,Symmetric,.40,.28,1.12,.264
434 ,,,,x Dependent,.25,.22,1.12,.264
435 ,,,,y Dependent,1.00,.00,1.12,.264
436 ,,,Goodman and Kruskal tau,x Dependent,.25,,,
437 ,,,,y Dependent,1.00,,,
438 ,,,Uncertainty Coefficient,Symmetric,.47,.18,,
439 ,,,,x Dependent,.31,.15,2.02,
440 ,,,,y Dependent,1.00,.00,2.02,
441 ,,Ordinal by Ordinal,Somers' d,Symmetric,.00,,.00,1.000
442 ,,,,x Dependent,.00,.50,.00,1.000
443 ,,,,y Dependent,.00,.20,.00,1.000
444 ,,Nominal by Interval,Eta,x Dependent,.04,,,
445 ,,,,y Dependent,1.00,,,
446 ,2,Nominal by Nominal,Lambda,Symmetric,.50,.25,2.00,.046
447 ,,,,x Dependent,.33,.27,1.15,.248
448 ,,,,y Dependent,1.00,.00,1.15,.248
449 ,,,Goodman and Kruskal tau,x Dependent,.33,,,
450 ,,,,y Dependent,1.00,,,
451 ,,,Uncertainty Coefficient,Symmetric,.58,.17,,
452 ,,,,x Dependent,.41,.17,2.36,
453 ,,,,y Dependent,1.00,.00,2.36,
454 ,,Ordinal by Ordinal,Somers' d,Symmetric,-.67,,-1.73,.083
455 ,,,,x Dependent,-1.00,.00,-1.73,.083
456 ,,,,y Dependent,-.50,.29,-1.73,.083
457 ,,Nominal by Interval,Eta,x Dependent,.73,,,
458 ,,,,y Dependent,1.00,,,
459 ])
460 AT_CLEANUP
461
462 AT_SETUP([CROSSTABS rounding weights with COUNT])
463 AT_DATA([crosstabs.sps],
464   [[DATA LIST NOTABLE LIST /x y w.
465 BEGIN DATA.
466 1 1 1.4
467 1 1 1.4
468 1 2 1.6
469 1 2 1.6
470 2 1 1
471 2 2 2
472 END DATA.
473 WEIGHT BY w.
474
475 * These should have the same effect (no rounding).
476 CROSSTABS /TABLES x BY y.
477 CROSSTABS /TABLES x BY y /COUNT ASIS.
478
479 * Round input weights.
480 CROSSTABS /TABLES x BY y /COUNT CASE ROUND.
481 CROSSTABS /TABLES x BY y /COUNT CASE TRUNCATE.
482
483 * Round cell weights.
484 CROSSTABS /TABLES x BY y /COUNT.
485 CROSSTABS /TABLES x BY y /COUNT TRUNCATE.
486 ]])
487
488 AT_CHECK([pspp -o pspp.csv -o pspp.txt crosstabs.sps])
489 AT_CHECK([cat pspp.csv], [0],
490   [Table: Summary
491 ,Cases,,,,,
492 ,Valid,,Missing,,Total,
493 ,N,Percent,N,Percent,N,Percent
494 x × y,9.00,100.0%,.00,.0%,9.00,100.0%
495
496 Table: x × y
497 ,,,y,,Total
498 ,,,1.00,2.00,
499 x,1.00,Count,2.80,3.20,6.00
500 ,2.00,Count,1.00,2.00,3.00
501 Total,,Count,3.80,5.20,9.00
502
503 Table: Summary
504 ,Cases,,,,,
505 ,Valid,,Missing,,Total,
506 ,N,Percent,N,Percent,N,Percent
507 x × y,9.00,100.0%,.00,.0%,9.00,100.0%
508
509 Table: x × y
510 ,,,y,,Total
511 ,,,1.00,2.00,
512 x,1.00,Count,2.80,3.20,6.00
513 ,2.00,Count,1.00,2.00,3.00
514 Total,,Count,3.80,5.20,9.00
515
516 Table: Summary
517 ,Cases,,,,,
518 ,Valid,,Missing,,Total,
519 ,N,Percent,N,Percent,N,Percent
520 x × y,9.00,100.0%,.00,.0%,9.00,100.0%
521
522 Table: x × y
523 ,,,y,,Total
524 ,,,1.00,2.00,
525 x,1.00,Count,2.00,4.00,6.00
526 ,2.00,Count,1.00,2.00,3.00
527 Total,,Count,3.00,6.00,9.00
528
529 Table: Summary
530 ,Cases,,,,,
531 ,Valid,,Missing,,Total,
532 ,N,Percent,N,Percent,N,Percent
533 x × y,7.00,100.0%,.00,.0%,7.00,100.0%
534
535 Table: x × y
536 ,,,y,,Total
537 ,,,1.00,2.00,
538 x,1.00,Count,2.00,2.00,4.00
539 ,2.00,Count,1.00,2.00,3.00
540 Total,,Count,3.00,4.00,7.00
541
542 Table: Summary
543 ,Cases,,,,,
544 ,Valid,,Missing,,Total,
545 ,N,Percent,N,Percent,N,Percent
546 x × y,9.00,100.0%,.00,.0%,9.00,100.0%
547
548 Table: x × y
549 ,,,y,,Total
550 ,,,1.00,2.00,
551 x,1.00,Count,3.00,3.00,6.00
552 ,2.00,Count,1.00,2.00,3.00
553 Total,,Count,4.00,5.00,9.00
554
555 Table: Summary
556 ,Cases,,,,,
557 ,Valid,,Missing,,Total,
558 ,N,Percent,N,Percent,N,Percent
559 x × y,8.00,100.0%,.00,.0%,8.00,100.0%
560
561 Table: x × y
562 ,,,y,,Total
563 ,,,1.00,2.00,
564 x,1.00,Count,2.00,3.00,5.00
565 ,2.00,Count,1.00,2.00,3.00
566 Total,,Count,3.00,5.00,8.00
567 ])
568 AT_CLEANUP
569
570 AT_SETUP([CROSSTABS descending sort order])
571 AT_DATA([crosstabs-descending.sps],
572   [[DATA LIST NOTABLE LIST /x * y *.
573 BEGIN DATA.
574 2 2
575 2 2
576 3 1
577 4 1
578 3 2
579 3 2
580 END DATA.
581
582 CROSSTABS
583         /TABLES= x BY y
584         /FORMAT = DVALUE.
585 ]])
586
587 AT_CHECK([pspp -o pspp.csv -o pspp.txt crosstabs-descending.sps])
588 AT_CHECK([cat pspp.csv], [0],
589   [Table: Summary
590 ,Cases,,,,,
591 ,Valid,,Missing,,Total,
592 ,N,Percent,N,Percent,N,Percent
593 x × y,6,100.0%,0,.0%,6,100.0%
594
595 Table: x × y
596 ,,,y,,Total
597 ,,,2.00,1.00,
598 x,4.00,Count,0,1,1
599 ,3.00,Count,2,1,3
600 ,2.00,Count,2,0,2
601 Total,,Count,4,2,6
602 ])
603 AT_CLEANUP
604
605 # Bug #31260.
606 AT_SETUP([CROSSTABS crash when all cases missing])
607 AT_DATA([crosstabs.sps], [dnl
608 DATA LIST LIST NOTABLE /X1 X2.
609 BEGIN DATA.
610 1 1
611 END DATA.
612
613 MISSING VALUES x2 (1).
614
615 CROSSTABS /TABLES= X1 by X2.
616 ])
617 AT_CHECK([pspp -O format=csv crosstabs.sps], [0], [dnl
618 Table: Summary
619 ,Cases,,,,,
620 ,Valid,,Missing,,Total,
621 ,N,Percent,N,Percent,N,Percent
622 X1 × X2,0,.0%,1,100.0%,1,100.0%
623
624 crosstabs.sps:8: warning: CROSSTABS: Crosstabulation X1 × X2 contained no non-missing cases.
625 ])
626 AT_CLEANUP
627
628
629
630 dnl This example comes from http://www.ats.ucla.edu/stat/spss/whatstat/whatstat.htm#chisq
631 AT_SETUP([CROSSTABS Fisher Exact Test])
632
633 AT_DATA([fisher-exact.sps], [dnl
634 SET FORMAT F12.3.
635 SET DECIMAL DOT.
636
637 DATA LIST notable LIST  /schtyp (F9.2) female (F9.2) ses (F9.2) .
638 begin data.
639       1.00       .00      1.00
640       1.00      1.00      2.00
641       1.00       .00      3.00
642       1.00       .00      3.00
643       1.00       .00      2.00
644       1.00       .00      2.00
645       1.00       .00      2.00
646       1.00       .00      2.00
647       1.00       .00      2.00
648       1.00       .00      2.00
649       1.00       .00      2.00
650       1.00       .00      2.00
651       1.00       .00      3.00
652       1.00       .00      3.00
653       1.00       .00      1.00
654       1.00       .00      1.00
655       1.00       .00      3.00
656       2.00       .00      2.00
657       1.00       .00      3.00
658       1.00       .00      2.00
659       1.00       .00      2.00
660       1.00       .00      2.00
661       1.00       .00      2.00
662       1.00       .00      3.00
663       1.00       .00      2.00
664       1.00       .00      2.00
665       1.00       .00      3.00
666       2.00       .00      2.00
667       2.00       .00      3.00
668       1.00       .00      1.00
669       1.00       .00      2.00
670       1.00       .00      3.00
671       2.00       .00      3.00
672       1.00       .00      2.00
673       2.00       .00      3.00
674       1.00       .00      3.00
675       2.00       .00      2.00
676       1.00       .00      3.00
677       1.00       .00      1.00
678       1.00       .00      2.00
679       2.00       .00      2.00
680       2.00       .00      2.00
681       1.00       .00      2.00
682       1.00       .00      1.00
683       1.00       .00      3.00
684       1.00       .00      1.00
685       1.00       .00      3.00
686       1.00       .00      2.00
687       2.00       .00      2.00
688       1.00       .00      2.00
689       1.00       .00      2.00
690       1.00       .00      3.00
691       1.00       .00      2.00
692       2.00       .00      2.00
693       1.00       .00      2.00
694       1.00       .00      3.00
695       1.00       .00      1.00
696       1.00       .00      2.00
697       2.00       .00      2.00
698       1.00       .00      2.00
699       2.00       .00      2.00
700       1.00       .00      3.00
701       1.00       .00      1.00
702       1.00       .00      2.00
703       2.00       .00      3.00
704       1.00       .00      2.00
705       1.00       .00      2.00
706       1.00       .00      1.00
707       1.00       .00      1.00
708       1.00       .00      2.00
709       1.00       .00      2.00
710       1.00       .00      3.00
711       1.00       .00      2.00
712       1.00       .00      2.00
713       1.00       .00      2.00
714       1.00       .00      1.00
715       1.00       .00      3.00
716       1.00       .00      3.00
717       1.00       .00      2.00
718       1.00       .00      3.00
719       1.00       .00      3.00
720       1.00       .00      1.00
721       2.00       .00      2.00
722       1.00       .00      1.00
723       1.00       .00      2.00
724       1.00       .00      3.00
725       1.00       .00      3.00
726       1.00       .00      3.00
727       1.00       .00      2.00
728       1.00       .00      3.00
729       1.00       .00      2.00
730       1.00       .00      1.00
731       1.00      1.00      3.00
732       1.00      1.00      1.00
733       1.00      1.00      1.00
734       1.00      1.00      1.00
735       1.00      1.00      2.00
736       1.00      1.00      3.00
737       1.00      1.00      1.00
738       2.00      1.00      3.00
739       1.00      1.00      3.00
740       1.00      1.00      3.00
741       1.00      1.00      1.00
742       1.00      1.00      3.00
743       1.00      1.00      2.00
744       1.00      1.00      2.00
745       1.00      1.00      3.00
746       1.00      1.00      1.00
747       2.00      1.00      1.00
748       2.00      1.00      3.00
749       1.00      1.00      2.00
750       1.00      1.00      1.00
751       1.00      1.00      3.00
752       1.00      1.00      1.00
753       2.00      1.00      3.00
754       1.00      1.00      2.00
755       1.00      1.00      3.00
756       1.00      1.00      3.00
757       1.00      1.00      1.00
758       1.00      1.00      1.00
759       2.00      1.00      1.00
760       1.00      1.00      2.00
761       1.00      1.00      2.00
762       1.00      1.00      2.00
763       1.00      1.00      1.00
764       1.00      1.00      3.00
765       1.00      1.00      2.00
766       1.00      1.00      2.00
767       1.00      1.00      3.00
768       1.00      1.00      1.00
769       1.00      1.00      2.00
770       1.00      1.00      1.00
771       1.00      1.00      2.00
772       1.00      1.00      2.00
773       1.00      1.00      1.00
774       1.00      1.00      3.00
775       2.00      1.00      2.00
776       1.00      1.00      2.00
777       1.00      1.00      2.00
778       2.00      1.00      2.00
779       1.00      1.00      1.00
780       1.00      1.00      3.00
781       1.00      1.00      2.00
782       1.00      1.00      2.00
783       1.00      1.00      2.00
784       2.00      1.00      3.00
785       1.00      1.00      2.00
786       2.00      1.00      2.00
787       1.00      1.00      1.00
788       1.00      1.00      1.00
789       1.00      1.00      1.00
790       1.00      1.00      3.00
791       1.00      1.00      2.00
792       1.00      1.00      2.00
793       1.00      1.00      2.00
794       1.00      1.00      2.00
795       1.00      1.00      2.00
796       1.00      1.00      2.00
797       1.00      1.00      2.00
798       1.00      1.00      3.00
799       1.00      1.00      1.00
800       1.00      1.00      2.00
801       2.00      1.00      3.00
802       1.00      1.00      1.00
803       1.00      1.00      2.00
804       1.00      1.00      1.00
805       1.00      1.00      2.00
806       1.00      1.00      1.00
807       2.00      1.00      2.00
808       1.00      1.00      1.00
809       1.00      1.00      1.00
810       1.00      1.00      2.00
811       1.00      1.00      3.00
812       1.00      1.00      3.00
813       1.00      1.00      1.00
814       1.00      1.00      1.00
815       1.00      1.00      2.00
816       1.00      1.00      2.00
817       1.00      1.00      3.00
818       1.00      1.00      1.00
819       1.00      1.00      2.00
820       2.00      1.00      2.00
821       1.00      1.00      3.00
822       1.00      1.00      2.00
823       1.00      1.00      3.00
824       1.00      1.00      1.00
825       1.00      1.00      2.00
826       1.00      1.00      2.00
827       2.00      1.00      3.00
828       1.00      1.00      1.00
829       1.00      1.00      1.00
830       2.00      1.00      3.00
831       2.00      1.00      2.00
832       1.00      1.00      3.00
833       2.00      1.00      2.00
834       2.00      1.00      2.00
835       1.00      1.00      2.00
836       2.00      1.00      2.00
837       1.00      1.00      2.00
838       1.00      1.00      3.00
839 end data.
840
841 VARIABLE LABEL schtyp 'type of school'.
842 ADD VALUE LABELS female 0 male 1 female.
843 ADD VALUE LABELS ses 1 low 2 middle 3 high.
844 ADD VALUE LABELS schtyp 1 public 2 private.
845
846 crosstabs /tables = schtyp by female /statistic = chisq.
847 crosstabs /tables = female by ses  /statistic = chisq.
848 ])
849
850 AT_CHECK([pspp -o pspp.csv -o pspp.txt fisher-exact.sps])
851 AT_CHECK([cat pspp.csv], [0], [Table: Summary
852 ,Cases,,,,,
853 ,Valid,,Missing,,Total,
854 ,N,Percent,N,Percent,N,Percent
855 type of school × female,200,100.0%,0,.0%,200,100.0%
856
857 Table: type of school × female
858 ,,,female,,Total
859 ,,,male,female,
860 type of school,public,Count,77,91,168
861 ,private,Count,14,18,32
862 Total,,Count,91,109,200
863
864 Table: Chi-Square Tests
865 ,Value,df,Asymptotic Sig. (2-tailed),Exact Sig. (2-tailed),Exact Sig. (1-tailed)
866 Pearson Chi-Square,.047,1,.828,,
867 Likelihood Ratio,.047,1,.828,,
868 Fisher's Exact Test,,,,.849,.492
869 Continuity Correction,.001,1,.981,,
870 Linear-by-Linear Association,.047,1,.829,,
871 N of Valid Cases,200,,,,
872
873 Table: Summary
874 ,Cases,,,,,
875 ,Valid,,Missing,,Total,
876 ,N,Percent,N,Percent,N,Percent
877 female × ses,200,100.0%,0,.0%,200,100.0%
878
879 Table: female × ses
880 ,,,ses,,,Total
881 ,,,low,middle,high,
882 female,male,Count,15,47,29,91
883 ,female,Count,32,48,29,109
884 Total,,Count,47,95,58,200
885
886 Table: Chi-Square Tests
887 ,Value,df,Asymptotic Sig. (2-tailed)
888 Pearson Chi-Square,4.577,2,.101
889 Likelihood Ratio,4.679,2,.096
890 Linear-by-Linear Association,3.110,1,.078
891 N of Valid Cases,200,,
892 ])
893
894 AT_CLEANUP
895
896 AT_SETUP([CROSSTABS Pearson's R - 1])
897 AT_DATA([pearson.sps], [dnl
898 SET FORMAT F8.3.
899
900 * From http://www.statisticslectures.com/topics/pearsonr/.
901 DATA LIST FREE/x y.
902 BEGIN DATA.
903 1 4
904 3 6
905 5 10
906 5 12
907 6 13
908 END DATA.
909 CROSSTABS x BY y/STATISTICS=CORR.
910 ])
911 AT_CHECK([pspp -o pspp.csv -o pspp.txt pearson.sps])
912 AT_CHECK([cat pspp.csv], [0], [dnl
913 Table: Summary
914 ,Cases,,,,,
915 ,Valid,,Missing,,Total,
916 ,N,Percent,N,Percent,N,Percent
917 x × y,5,100.0%,0,.0%,5,100.0%
918
919 Table: x × y
920 ,,,y,,,,,Total
921 ,,,4.000,6.000,10.000,12.000,13.000,
922 x,1.000,Count,1,0,0,0,0,1
923 ,3.000,Count,0,1,0,0,0,1
924 ,5.000,Count,0,0,1,1,0,2
925 ,6.000,Count,0,0,0,0,1,1
926 Total,,Count,1,1,1,1,1,5
927
928 Table: Symmetric Measures
929 ,,Value,Asymp. Std. Error,Approx. T
930 Ordinal by Ordinal,Spearman Correlation,.975,.022,7.550
931 Interval by Interval,Pearson's R,.968,.017,6.708
932 N of Valid Cases,,5,,
933 ])
934 AT_CLEANUP
935
936 AT_SETUP([CROSSTABS Pearson's R - 2])
937 AT_DATA([pearson2.sps], [dnl
938 SET FORMAT F8.3.
939
940 * Checked with http://www.socscistatistics.com/tests/pearson/Default2.aspx.
941 DATA LIST FREE/x y.
942 BEGIN DATA.
943 1 1.5
944 2 1.5
945 3 4
946 4 6
947 5 5
948 6 7
949 7 6.5
950 8 9
951 9 10.5
952 10 11
953 END DATA.
954 CROSSTABS x BY y/STATISTICS=CORR.
955 ])
956 AT_CHECK([pspp -o pspp.csv -o pspp.txt pearson2.sps])
957 AT_CHECK([cat pspp.csv], [0], [dnl
958 Table: Summary
959 ,Cases,,,,,
960 ,Valid,,Missing,,Total,
961 ,N,Percent,N,Percent,N,Percent
962 x × y,10,100.0%,0,.0%,10,100.0%
963
964 Table: x × y
965 ,,,y,,,,,,,,,Total
966 ,,,1.500,4.000,5.000,6.000,6.500,7.000,9.000,10.500,11.000,
967 x,1.000,Count,1,0,0,0,0,0,0,0,0,1
968 ,2.000,Count,1,0,0,0,0,0,0,0,0,1
969 ,3.000,Count,0,1,0,0,0,0,0,0,0,1
970 ,4.000,Count,0,0,0,1,0,0,0,0,0,1
971 ,5.000,Count,0,0,1,0,0,0,0,0,0,1
972 ,6.000,Count,0,0,0,0,0,1,0,0,0,1
973 ,7.000,Count,0,0,0,0,1,0,0,0,0,1
974 ,8.000,Count,0,0,0,0,0,0,1,0,0,1
975 ,9.000,Count,0,0,0,0,0,0,0,1,0,1
976 ,10.000,Count,0,0,0,0,0,0,0,0,1,1
977 Total,,Count,2,1,1,1,1,1,1,1,1,10
978
979 Table: Symmetric Measures
980 ,,Value,Asymp. Std. Error,Approx. T
981 Ordinal by Ordinal,Spearman Correlation,.973,.015,11.844
982 Interval by Interval,Pearson's R,.971,.017,11.580
983 N of Valid Cases,,10,,
984 ])
985 AT_CLEANUP
986
987 AT_SETUP([CROSSTABS Pearson's R - 3])
988 AT_DATA([pearson3.sps], [dnl
989 SET FORMAT F8.3.
990
991 * From http://learntech.uwe.ac.uk/da/Default.aspx?pageid=1442.
992 DATA LIST FREE/x y.
993 BEGIN DATA.
994 56 87
995 56 91
996 65 85
997 65 91
998 50 75
999 25 28
1000 87 122
1001 44 66
1002 35 58
1003 END DATA.
1004 CROSSTABS x BY y/STATISTICS=CORR.
1005 ])
1006 AT_CHECK([pspp -o pspp.csv -o pspp.txt pearson3.sps])
1007 AT_CHECK([cat pspp.csv], [0], [dnl
1008 Table: Summary
1009 ,Cases,,,,,
1010 ,Valid,,Missing,,Total,
1011 ,N,Percent,N,Percent,N,Percent
1012 x × y,9,100.0%,0,.0%,9,100.0%
1013
1014 Table: x × y
1015 ,,,y,,,,,,,,Total
1016 ,,,28.000,58.000,66.000,75.000,85.000,87.000,91.000,122.000,
1017 x,25.000,Count,1,0,0,0,0,0,0,0,1
1018 ,35.000,Count,0,1,0,0,0,0,0,0,1
1019 ,44.000,Count,0,0,1,0,0,0,0,0,1
1020 ,50.000,Count,0,0,0,1,0,0,0,0,1
1021 ,56.000,Count,0,0,0,0,0,1,1,0,2
1022 ,65.000,Count,0,0,0,0,1,0,1,0,2
1023 ,87.000,Count,0,0,0,0,0,0,0,1,1
1024 Total,,Count,1,1,1,1,1,1,2,1,9
1025
1026 Table: Symmetric Measures
1027 ,,Value,Asymp. Std. Error,Approx. T
1028 Ordinal by Ordinal,Spearman Correlation,.911,.068,5.860
1029 Interval by Interval,Pearson's R,.966,.017,9.915
1030 N of Valid Cases,,9,,
1031 ])
1032 AT_CLEANUP
1033
1034 AT_SETUP([CROSSTABS Pearson's R - 4])
1035 AT_DATA([pearson4.sps], [dnl
1036 SET FORMAT F8.3.
1037
1038 * From http://psychology.ucdavis.edu/faculty_sites/sommerb/sommerdemo/correlation/hand/pearson_hand.htm.
1039 DATA LIST FREE/x y.
1040 BEGIN DATA.
1041 5 5
1042 10 20
1043 6 4
1044 8 15
1045 4 11
1046 4 9
1047 3 12
1048 10 18
1049 2 7
1050 6 2
1051 7 14
1052 9 17
1053 END DATA.
1054 CROSSTABS x BY y/STATISTICS=CORR.
1055 ])
1056 AT_CHECK([pspp -o pspp.csv -o pspp.txt pearson4.sps])
1057 AT_CHECK([cat pspp.csv], [0], [dnl
1058 Table: Summary
1059 ,Cases,,,,,
1060 ,Valid,,Missing,,Total,
1061 ,N,Percent,N,Percent,N,Percent
1062 x × y,12,100.0%,0,.0%,12,100.0%
1063
1064 Table: x × y
1065 ,,,y,,,,,,,,,,,,Total
1066 ,,,2.000,4.000,5.000,7.000,9.000,11.000,12.000,14.000,15.000,17.000,18.000,20.000,
1067 x,2.000,Count,0,0,0,1,0,0,0,0,0,0,0,0,1
1068 ,3.000,Count,0,0,0,0,0,0,1,0,0,0,0,0,1
1069 ,4.000,Count,0,0,0,0,1,1,0,0,0,0,0,0,2
1070 ,5.000,Count,0,0,1,0,0,0,0,0,0,0,0,0,1
1071 ,6.000,Count,1,1,0,0,0,0,0,0,0,0,0,0,2
1072 ,7.000,Count,0,0,0,0,0,0,0,1,0,0,0,0,1
1073 ,8.000,Count,0,0,0,0,0,0,0,0,1,0,0,0,1
1074 ,9.000,Count,0,0,0,0,0,0,0,0,0,1,0,0,1
1075 ,10.000,Count,0,0,0,0,0,0,0,0,0,0,1,1,2
1076 Total,,Count,1,1,1,1,1,1,1,1,1,1,1,1,12
1077
1078 Table: Symmetric Measures
1079 ,,Value,Asymp. Std. Error,Approx. T
1080 Ordinal by Ordinal,Spearman Correlation,.657,.140,2.758
1081 Interval by Interval,Pearson's R,.667,.132,2.830
1082 N of Valid Cases,,12,,
1083 ])
1084 AT_CLEANUP
1085
1086 AT_SETUP([CROSSTABS Pearson's R - 5])
1087 AT_DATA([pearson5.sps], [dnl
1088 SET FORMAT F8.3.
1089
1090 * From http://www.statisticslectures.com/topics/pearsonr/.
1091 DATA LIST FREE/x y.
1092 BEGIN DATA.
1093 18 15000
1094 25 29000
1095 57 68000
1096 45 52000
1097 26 32000
1098 64 80000
1099 37 41000
1100 40 45000
1101 24 26000
1102 33 33000
1103 END DATA.
1104 CROSSTABS x BY y/STATISTICS=CORR.
1105 ])
1106 AT_CHECK([pspp -o pspp.csv -o pspp.txt pearson5.sps])
1107 AT_CHECK([cat pspp.csv], [0], [dnl
1108 Table: Summary
1109 ,Cases,,,,,
1110 ,Valid,,Missing,,Total,
1111 ,N,Percent,N,Percent,N,Percent
1112 x × y,10,100.0%,0,.0%,10,100.0%
1113
1114 Table: x × y
1115 ,,,y,,,,,,,,,,Total
1116 ,,,15000.00,26000.00,29000.00,32000.00,33000.00,41000.00,45000.00,52000.00,68000.00,80000.00,
1117 x,18.000,Count,1,0,0,0,0,0,0,0,0,0,1
1118 ,24.000,Count,0,1,0,0,0,0,0,0,0,0,1
1119 ,25.000,Count,0,0,1,0,0,0,0,0,0,0,1
1120 ,26.000,Count,0,0,0,1,0,0,0,0,0,0,1
1121 ,33.000,Count,0,0,0,0,1,0,0,0,0,0,1
1122 ,37.000,Count,0,0,0,0,0,1,0,0,0,0,1
1123 ,40.000,Count,0,0,0,0,0,0,1,0,0,0,1
1124 ,45.000,Count,0,0,0,0,0,0,0,1,0,0,1
1125 ,57.000,Count,0,0,0,0,0,0,0,0,1,0,1
1126 ,64.000,Count,0,0,0,0,0,0,0,0,0,1,1
1127 Total,,Count,1,1,1,1,1,1,1,1,1,1,10
1128
1129 Table: Symmetric Measures
1130 ,,Value,Asymp. Std. Error,Approx. T
1131 Ordinal by Ordinal,Spearman Correlation,1.000,.000,+Infinit
1132 Interval by Interval,Pearson's R,.992,.004,22.638
1133 N of Valid Cases,,10,,
1134 ])
1135 AT_CLEANUP
1136
1137 AT_SETUP([CROSSTABS Goodman and Kruskal's lambda - 1])
1138 AT_DATA([lambda.sps], [dnl
1139 SET FORMAT F8.3.
1140
1141 * From http://www.csupomona.edu/~jlkorey/POWERMUTT/Topics/contingency_tables.html.
1142 DATA LIST LIST NOTABLE/x y w.
1143 WEIGHT BY w.
1144 BEGIN DATA.
1145 1 1 424
1146 1 2 213
1147 1 3 59
1148 3 1 55
1149 3 2 188
1150 3 3 357
1151 END DATA.
1152
1153 CROSSTABS x BY y/CELLS=NONE/STATISTICS=LAMBDA.
1154 ])
1155 AT_CHECK([pspp -o pspp.csv -o pspp.txt lambda.sps])
1156 AT_CHECK([cat pspp.csv], [0], [dnl
1157 Table: Summary
1158 ,Cases,,,,,
1159 ,Valid,,Missing,,Total,
1160 ,N,Percent,N,Percent,N,Percent
1161 x × y,1296.000,100.0%,.000,.0%,1296.000,100.0%
1162
1163 Table: Directional Measures
1164 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1165 Nominal by Nominal,Lambda,Symmetric,.423,.021,16.875,.000
1166 ,,x Dependent,.497,.024,15.986,.000
1167 ,,y Dependent,.370,.020,16.339,.000
1168 ,Goodman and Kruskal tau,x Dependent,.382,,,
1169 ,,y Dependent,.198,,,
1170 ])
1171 AT_CLEANUP
1172
1173 AT_SETUP([CROSSTABS Goodman and Kruskal's lambda - 2])
1174 AT_DATA([lambda.sps], [dnl
1175 SET FORMAT F8.3.
1176
1177 * From http://vassarstats.net.
1178 DATA LIST LIST NOTABLE/x y w.
1179 WEIGHT BY w.
1180 BEGIN DATA.
1181 1 1 19
1182 1 2 26
1183 1 3 8
1184 2 1 21
1185 2 2 13
1186 2 3 5
1187 3 1 6
1188 3 2 12
1189 3 3 27
1190 END DATA.
1191
1192 CROSSTABS x BY y/CELLS=NONE/STATISTICS=LAMBDA.
1193 ])
1194 AT_CHECK([pspp -o pspp.csv -o pspp.txt lambda.sps])
1195 AT_CHECK([cat pspp.csv], [0], [dnl
1196 Table: Summary
1197 ,Cases,,,,,
1198 ,Valid,,Missing,,Total,
1199 ,N,Percent,N,Percent,N,Percent
1200 x × y,137.000,100.0%,.000,.0%,137.000,100.0%
1201
1202 Table: Directional Measures
1203 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1204 Nominal by Nominal,Lambda,Symmetric,.259,.081,2.902,.004
1205 ,,x Dependent,.250,.089,2.479,.013
1206 ,,y Dependent,.267,.085,2.766,.006
1207 ,Goodman and Kruskal tau,x Dependent,.129,,,
1208 ,,y Dependent,.123,,,
1209 ])
1210 AT_CLEANUP
1211
1212 AT_SETUP([CROSSTABS Goodman and Kruskal's lambda - 3])
1213 AT_DATA([lambda.sps], [dnl
1214 SET FORMAT F8.3.
1215
1216 * From Goodman, L.A., Kruskal, W.H. (1954) "Measures of association for
1217   cross classifications". Part I. Journal of the American Statistical
1218   Association, 49, 732-764.
1219 DATA LIST LIST NOTABLE/x y w.
1220 WEIGHT BY w.
1221 BEGIN DATA.
1222 1 1 1768
1223 1 2 807
1224 1 3 189
1225 1 4 47
1226 2 1 946
1227 2 2 1387
1228 2 3 746
1229 2 4 53
1230 3 1 115
1231 3 2 438
1232 3 3 288
1233 3 4 16
1234 END DATA.
1235 CROSSTABS x BY y/CELLS=NONE/STATISTICS=LAMBDA.
1236 ])
1237 AT_CHECK([pspp -o pspp.csv -o pspp.txt lambda.sps])
1238 AT_CHECK([cat pspp.csv], [0], [dnl
1239 Table: Summary
1240 ,Cases,,,,,
1241 ,Valid,,Missing,,Total,
1242 ,N,Percent,N,Percent,N,Percent
1243 x × y,6800.000,100.0%,.000,.0%,6800.000,100.0%
1244
1245 Table: Directional Measures
1246 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1247 Nominal by Nominal,Lambda,Symmetric,.208,.010,18.793,.000
1248 ,,x Dependent,.224,.013,16.076,.000
1249 ,,y Dependent,.192,.012,14.438,.000
1250 ,Goodman and Kruskal tau,x Dependent,.089,,,
1251 ,,y Dependent,.081,,,
1252 ])
1253 AT_CLEANUP
1254
1255 AT_SETUP([CROSSTABS Goodman and Kruskal's lambda - treatment of ties])
1256 AT_DATA([lambda.sps], [dnl
1257 SET FORMAT F8.3.
1258
1259 * From Douglas Bonett.
1260 DATA LIST LIST NOTABLE/x y w.
1261 WEIGHT BY w.
1262 BEGIN DATA.
1263 1 1 225
1264 1 2 43
1265 1 3 216
1266 2 1 3
1267 2 2 1
1268 2 3 12
1269 END DATA.
1270
1271 CROSSTABS x BY y/CELLS=NONE/STATISTICS=LAMBDA.
1272 ])
1273 AT_CHECK([pspp -o pspp.csv -o pspp.txt lambda.sps])
1274 AT_CHECK([cat pspp.csv], [0], [dnl
1275 Table: Summary
1276 ,Cases,,,,,
1277 ,Valid,,Missing,,Total,
1278 ,N,Percent,N,Percent,N,Percent
1279 x × y,500.000,100.0%,.000,.0%,500.000,100.0%
1280
1281 Table: Directional Measures
1282 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1283 Nominal by Nominal,Lambda,Symmetric,.031,.013,2.336,.019
1284 ,,x Dependent,.000,.000,NaN,NaN
1285 ,,y Dependent,.033,.014,2.336,.019
1286 ,Goodman and Kruskal tau,x Dependent,.012,,,
1287 ,,y Dependent,.009,,,
1288 ])
1289 AT_CLEANUP
1290
1291 AT_SETUP([CROSSTABS Somers' D, Tau-B, Tau-C, Gamma - 1])
1292 AT_DATA([somersd.sps], [dnl
1293 SET FORMAT F8.3.
1294
1295 * From http://stats.stackexchange.com/questions/72203/problem-with-calculating-asymptotic-standard-error-for-somers-d.
1296 DATA LIST LIST NOTABLE/x y * w (F10.6).
1297 WEIGHT BY w.
1298 BEGIN DATA.
1299 1 1 0.000025
1300 1 2 0.0001
1301 1 3 0.001
1302 1 4 0.0025
1303 1 5 0.004
1304 1 6 0.0075
1305 1 7 0.0125
1306 2 1 0.049975
1307 2 2 0.0999
1308 2 3 0.199
1309 2 4 0.2475
1310 2 5 0.196
1311 2 6 0.1425
1312 2 7 0.0375
1313 END DATA.
1314 CROSSTABS x BY y/STATISTICS=D/CELLS=NONE.
1315 ])
1316 AT_CHECK([pspp -o pspp.csv -o pspp.txt somersd.sps])
1317 AT_CHECK([cat pspp.csv], [0], [dnl
1318 Table: Summary
1319 ,Cases,,,,,
1320 ,Valid,,Missing,,Total,
1321 ,N,Percent,N,Percent,N,Percent
1322 x × y,1.000000,100.0%,.000000,.0%,1.000000,100.0%
1323
1324 Table: Directional Measures
1325 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1326 Ordinal by Ordinal,Somers' d,Symmetric,-.084,,-.149,.882
1327 ,,x Dependent,-.045,.300,-.149,.882
1328 ,,y Dependent,-.684,2.378,-.149,.882
1329 ])
1330 AT_CLEANUP
1331
1332 AT_SETUP([CROSSTABS Somers' D, Tau-B, Tau-C, Gamma - 2])
1333 AT_DATA([somersd.sps], [dnl
1334 SET FORMAT F8.3.
1335
1336 * From http://uregina.ca/~gingrich/gamma.pdf.
1337 DATA LIST LIST NOTABLE/x y w.
1338 WEIGHT BY w.
1339 BEGIN DATA.
1340 1 1 34
1341 1 2 24
1342 1 3 15
1343 2 1 42
1344 2 2 74
1345 2 3 67
1346 3 1 28
1347 3 2 111
1348 3 3 292
1349 END DATA.
1350 CROSSTABS x BY y/STATISTICS=BTAU CTAU GAMMA D/CELLS=NONE.
1351 ])
1352 AT_CHECK([pspp -o pspp.csv -o pspp.txt somersd.sps])
1353 AT_CHECK([cat pspp.csv], [0], [dnl
1354 Table: Summary
1355 ,Cases,,,,,
1356 ,Valid,,Missing,,Total,
1357 ,N,Percent,N,Percent,N,Percent
1358 x × y,687.000,100.0%,.000,.0%,687.000,100.0%
1359
1360 Table: Symmetric Measures
1361 ,,Value,Asymp. Std. Error,Approx. T
1362 Ordinal by Ordinal,Kendall's tau-b,.372,.033,10.669
1363 ,Kendall's tau-c,.310,.029,10.669
1364 ,Gamma,.591,.043,10.669
1365 N of Valid Cases,,687.000,,
1366
1367 Table: Directional Measures
1368 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1369 Ordinal by Ordinal,Somers' d,Symmetric,.371,,10.669,.000
1370 ,,x Dependent,.351,.032,10.669,.000
1371 ,,y Dependent,.394,.035,10.669,.000
1372 ])
1373 AT_CLEANUP
1374
1375 AT_SETUP([CROSSTABS Somers' D, Tau-B, Tau-C, Gamma - 3])
1376 AT_DATA([ordinal.sps], [dnl
1377 SET FORMAT F8.3.
1378
1379 * From https://www.iup.edu/WorkArea/DownloadAsset.aspx?id=9829, "Case 1".
1380 DATA LIST LIST NOTABLE /x y w.
1381 WEIGHT BY w.
1382 BEGIN DATA.
1383 1 2 40
1384 2 3 80
1385 3 4 30
1386 END DATA.
1387 CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
1388
1389 * Same site, case 2.
1390 DATA LIST LIST NOTABLE /x y w.
1391 WEIGHT BY w.
1392 BEGIN DATA.
1393 1 1 40
1394 2 3 80
1395 3 4 30
1396 END DATA.
1397 CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
1398
1399 * Same site, case 3.
1400 DATA LIST LIST NOTABLE /x y w.
1401 WEIGHT BY w.
1402 BEGIN DATA.
1403 1 4 40
1404 2 3 80
1405 3 2 30
1406 END DATA.
1407 CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
1408
1409 * Same site, case 4.
1410 DATA LIST LIST NOTABLE /x y w.
1411 WEIGHT BY w.
1412 BEGIN DATA.
1413 1 1 20
1414 1 2 20
1415 2 3 80
1416 3 4 30
1417 END DATA.
1418 CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
1419
1420 * Same site, case 5.
1421 DATA LIST LIST NOTABLE /x y w.
1422 WEIGHT BY w.
1423 BEGIN DATA.
1424 1 2 40
1425 2 2 80
1426 3 2 29
1427 3 3 1
1428 END DATA.
1429 CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
1430
1431 * Same site, case 6.
1432 DATA LIST LIST NOTABLE /x y w.
1433 WEIGHT BY w.
1434 BEGIN DATA.
1435 1 1 3
1436 1 2 6
1437 1 3 28
1438 1 4 61
1439 2 1 4
1440 2 2 5
1441 2 3 21
1442 2 4 20
1443 END DATA.
1444 CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
1445
1446 * Same site, case 7.
1447 DATA LIST LIST NOTABLE /x y w.
1448 WEIGHT BY w.
1449 BEGIN DATA.
1450 1 1 38
1451 1 2 6
1452 1 3 3
1453 1 4 51
1454 2 1 4
1455 2 2 20
1456 2 3 21
1457 2 4 5
1458 END DATA.
1459 CROSSTABS x BY y/STATISTICS=LAMBDA D PHI GAMMA/CELLS=NONE.
1460
1461 * Same site, case 8.
1462 DATA LIST LIST NOTABLE /x y w.
1463 WEIGHT BY w.
1464 BEGIN DATA.
1465 1 1 2
1466 1 2 3
1467 1 3 5
1468 1 4 1
1469 2 1 2
1470 2 2 16
1471 2 3 3
1472 2 4 6
1473 3 1 3
1474 3 2 10
1475 3 3 35
1476 3 4 27
1477 4 1 6
1478 4 2 15
1479 4 3 33
1480 4 4 45
1481 END DATA.
1482 CROSSTABS x BY y/STATISTICS=LAMBDA D PHI BTAU/CELLS=NONE.
1483 ])
1484 AT_CHECK([pspp -o pspp.csv -o pspp.txt ordinal.sps])
1485 AT_CHECK([cat pspp.csv], [0], [dnl
1486 Table: Summary
1487 ,Cases,,,,,
1488 ,Valid,,Missing,,Total,
1489 ,N,Percent,N,Percent,N,Percent
1490 x × y,150.000,100.0%,.000,.0%,150.000,100.0%
1491
1492 Table: Symmetric Measures
1493 ,,Value,Asymp. Std. Error,Approx. T
1494 Ordinal by Ordinal,Kendall's tau-b,1.000,.000,24.841
1495 ,Gamma,1.000,.000,24.841
1496 N of Valid Cases,,150.000,,
1497
1498 Table: Directional Measures
1499 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1500 Ordinal by Ordinal,Somers' d,Symmetric,1.000,,24.841,.000
1501 ,,x Dependent,1.000,.000,24.841,.000
1502 ,,y Dependent,1.000,.000,24.841,.000
1503
1504 Table: Summary
1505 ,Cases,,,,,
1506 ,Valid,,Missing,,Total,
1507 ,N,Percent,N,Percent,N,Percent
1508 x × y,150.000,100.0%,.000,.0%,150.000,100.0%
1509
1510 Table: Symmetric Measures
1511 ,,Value,Asymp. Std. Error,Approx. T
1512 Ordinal by Ordinal,Kendall's tau-b,1.000,.000,24.841
1513 ,Gamma,1.000,.000,24.841
1514 N of Valid Cases,,150.000,,
1515
1516 Table: Directional Measures
1517 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1518 Ordinal by Ordinal,Somers' d,Symmetric,1.000,,24.841,.000
1519 ,,x Dependent,1.000,.000,24.841,.000
1520 ,,y Dependent,1.000,.000,24.841,.000
1521
1522 Table: Summary
1523 ,Cases,,,,,
1524 ,Valid,,Missing,,Total,
1525 ,N,Percent,N,Percent,N,Percent
1526 x × y,150.000,100.0%,.000,.0%,150.000,100.0%
1527
1528 Table: Symmetric Measures
1529 ,,Value,Asymp. Std. Error,Approx. T
1530 Ordinal by Ordinal,Kendall's tau-b,-1.000,.000,-24.841
1531 ,Gamma,-1.000,.000,-24.841
1532 N of Valid Cases,,150.000,,
1533
1534 Table: Directional Measures
1535 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1536 Ordinal by Ordinal,Somers' d,Symmetric,-1.000,,-24.841,.000
1537 ,,x Dependent,-1.000,.000,-24.841,.000
1538 ,,y Dependent,-1.000,.000,-24.841,.000
1539
1540 Table: Summary
1541 ,Cases,,,,,
1542 ,Valid,,Missing,,Total,
1543 ,N,Percent,N,Percent,N,Percent
1544 x × y,150.000,100.0%,.000,.0%,150.000,100.0%
1545
1546 Table: Symmetric Measures
1547 ,,Value,Asymp. Std. Error,Approx. T
1548 Ordinal by Ordinal,Kendall's tau-b,.972,.007,24.841
1549 ,Gamma,1.000,.000,24.841
1550 N of Valid Cases,,150.000,,
1551
1552 Table: Directional Measures
1553 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1554 Ordinal by Ordinal,Somers' d,Symmetric,.971,,24.841,.000
1555 ,,x Dependent,.944,.013,24.841,.000
1556 ,,y Dependent,1.000,.000,24.841,.000
1557
1558 Table: Summary
1559 ,Cases,,,,,
1560 ,Valid,,Missing,,Total,
1561 ,N,Percent,N,Percent,N,Percent
1562 x × y,150.000,100.0%,.000,.0%,150.000,100.0%
1563
1564 Table: Symmetric Measures
1565 ,,Value,Asymp. Std. Error,Approx. T
1566 Ordinal by Ordinal,Kendall's tau-b,.119,.059,1.009
1567 ,Gamma,1.000,.000,1.009
1568 N of Valid Cases,,150.000,,
1569
1570 Table: Directional Measures
1571 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1572 Ordinal by Ordinal,Somers' d,Symmetric,.035,,1.009,.313
1573 ,,x Dependent,.805,.032,1.009,.313
1574 ,,y Dependent,.018,.017,1.009,.313
1575
1576 Table: Summary
1577 ,Cases,,,,,
1578 ,Valid,,Missing,,Total,
1579 ,N,Percent,N,Percent,N,Percent
1580 x × y,148.000,100.0%,.000,.0%,148.000,100.0%
1581
1582 Table: Symmetric Measures
1583 ,,Value,Asymp. Std. Error,Approx. T
1584 Ordinal by Ordinal,Kendall's tau-b,-.208,.078,-2.641
1585 ,Gamma,-.381,.130,-2.641
1586 N of Valid Cases,,148.000,,
1587
1588 Table: Directional Measures
1589 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1590 Ordinal by Ordinal,Somers' d,Symmetric,-.206,,-2.641,.008
1591 ,,x Dependent,-.182,.069,-2.641,.008
1592 ,,y Dependent,-.237,.089,-2.641,.008
1593
1594 Table: Summary
1595 ,Cases,,,,,
1596 ,Valid,,Missing,,Total,
1597 ,N,Percent,N,Percent,N,Percent
1598 x × y,148.000,100.0%,.000,.0%,148.000,100.0%
1599
1600 Table: Symmetric Measures
1601 ,,Value,Asymp. Std. Error,Approx. T
1602 Nominal by Nominal,Phi,.731,,
1603 ,Cramer's V,.731,,
1604 Ordinal by Ordinal,Gamma,-.110,.107,-1.022
1605 N of Valid Cases,,148.000,,
1606
1607 Table: Directional Measures
1608 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1609 Nominal by Nominal,Lambda,Symmetric,.338,.059,4.743,.000
1610 ,,x Dependent,.640,.085,4.875,.000
1611 ,,y Dependent,.174,.050,3.248,.001
1612 ,Goodman and Kruskal tau,x Dependent,.534,,,
1613 ,,y Dependent,.167,,,
1614 Ordinal by Ordinal,Somers' d,Symmetric,-.074,,-1.022,.307
1615 ,,x Dependent,-.060,.059,-1.022,.307
1616 ,,y Dependent,-.096,.094,-1.022,.307
1617
1618 Table: Summary
1619 ,Cases,,,,,
1620 ,Valid,,Missing,,Total,
1621 ,N,Percent,N,Percent,N,Percent
1622 x × y,212.000,100.0%,.000,.0%,212.000,100.0%
1623
1624 Table: Symmetric Measures
1625 ,,Value,Asymp. Std. Error,Approx. T
1626 Nominal by Nominal,Phi,.432,,
1627 ,Cramer's V,.249,,
1628 Ordinal by Ordinal,Kendall's tau-b,.209,.062,3.338
1629 N of Valid Cases,,212.000,,
1630
1631 Table: Directional Measures
1632 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1633 Nominal by Nominal,Lambda,Symmetric,.102,.067,1.473,.141
1634 ,,x Dependent,.027,.087,.302,.763
1635 ,,y Dependent,.165,.065,2.349,.019
1636 ,Goodman and Kruskal tau,x Dependent,.051,,,
1637 ,,y Dependent,.068,,,
1638 Ordinal by Ordinal,Somers' d,Symmetric,.209,,3.338,.001
1639 ,,x Dependent,.202,.060,3.338,.001
1640 ,,y Dependent,.217,.064,3.338,.001
1641 ])
1642 AT_CLEANUP
1643
1644 AT_SETUP([CROSSTABS Cohens Kappa])
1645
1646 dnl Example from Wood J. M.
1647 dnl "Understanding and Computing Cohen's Kappa: A Tutorial"
1648 dnl WebPsychEmpiricist. Oct 3 2007
1649 AT_DATA([kappa.sps], [dnl
1650 SET FORMAT=F8.3.
1651
1652 data list notable list /p1 * p2 * w *.
1653 begin data.
1654 0 0 18
1655 1 0 1
1656 0 1 1
1657 end data.
1658
1659 weight by w.
1660
1661 crosstabs /table = p1 by p2
1662         /statistics = kappa
1663         .
1664 ])
1665
1666 AT_CHECK([pspp -o pspp.csv -o pspp.txt kappa.sps])
1667 AT_CHECK([cat pspp.csv], [0], [dnl
1668 Table: Summary
1669 ,Cases,,,,,
1670 ,Valid,,Missing,,Total,
1671 ,N,Percent,N,Percent,N,Percent
1672 p1 × p2,20.000,100.0%,.000,.0%,20.000,100.0%
1673
1674 Table: p1 × p2
1675 ,,,p2,,Total
1676 ,,,.000,1.000,
1677 p1,.000,Count,18.000,1.000,19.000
1678 ,1.000,Count,1.000,.000,1.000
1679 Total,,Count,19.000,1.000,20.000
1680
1681 Table: Symmetric Measures
1682 ,,Value,Asymp. Std. Error,Approx. T
1683 Measure of Agreement,Kappa,-.053,.037,-.235
1684 N of Valid Cases,,20.000,,
1685 ])
1686
1687 AT_CLEANUP
1688
1689
1690 AT_SETUP([CROSSTABS many statistics])
1691 AT_DATA([crosstabs.sps], [dnl
1692 SET FORMAT=F8.4.
1693
1694 * From http://www4.stat.ncsu.edu/~dzhang2/st744/table3.9.lst.txt.
1695 DATA LIST LIST NOTABLE/x y w.
1696 WEIGHT BY w.
1697 BEGIN DATA.
1698 1 1 25
1699 1 2 25
1700 1 3 12
1701 2 2 1
1702 2 3 3
1703 END DATA.
1704 CROSSTABS x BY y/STATISTICS=CHISQ PHI CC LAMBDA UC BTAU CTAU GAMMA D CORR/CELLS=NONE.
1705 ])
1706 AT_CHECK([pspp -o pspp.csv -o pspp.txt crosstabs.sps])
1707 AT_CHECK([cat pspp.csv], [0], [dnl
1708 Table: Summary
1709 ,Cases,,,,,
1710 ,Valid,,Missing,,Total,
1711 ,N,Percent,N,Percent,N,Percent
1712 x × y,66.0000,100.0%,.0000,.0%,66.0000,100.0%
1713
1714 Table: Chi-Square Tests
1715 ,Value,df,Asymptotic Sig. (2-tailed)
1716 Pearson Chi-Square,6.9562,2.0000,.031
1717 Likelihood Ratio,6.6901,2.0000,.035
1718 Linear-by-Linear Association,5.8450,1.0000,.016
1719 N of Valid Cases,66.0000,,
1720
1721 Table: Symmetric Measures
1722 ,,Value,Asymp. Std. Error,Approx. T
1723 Nominal by Nominal,Phi,.3246,,
1724 ,Cramer's V,.3246,,
1725 ,Contingency Coefficient,.3088,,
1726 Ordinal by Ordinal,Kendall's tau-b,.2752,.0856,1.9920
1727 ,Kendall's tau-c,.1497,.0751,1.9920
1728 ,Gamma,.8717,.1250,1.9920
1729 ,Spearman Correlation,.2908,.0906,2.4311
1730 Interval by Interval,Pearson's R,.2999,.0973,2.5147
1731 N of Valid Cases,,66.0000,,
1732
1733 Table: Directional Measures
1734 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1735 Nominal by Nominal,Lambda,Symmetric,.0455,.1629,.2723,.785
1736 ,,x Dependent,.0000,.0000,NaN,NaN
1737 ,,y Dependent,.0500,.1791,.2723,.785
1738 ,Goodman and Kruskal tau,x Dependent,.1054,,,
1739 ,,y Dependent,.0434,,,
1740 ,Uncertainty Coefficient,Symmetric,.0780,.0474,,
1741 ,,x Dependent,.2217,.1062,1.5373,
1742 ,,y Dependent,.0473,.0306,1.5373,
1743 Ordinal by Ordinal,Somers' d,Symmetric,.1960,,1.9920,.046
1744 ,,x Dependent,.1152,.0572,1.9920,.046
1745 ,,y Dependent,.6573,.1417,1.9920,.046
1746 ])
1747 AT_CLEANUP
1748
1749 AT_SETUP([CROSSTABS uncertainy coefficient])
1750 AT_DATA([uc.sps], [dnl
1751 * From http://groups.chass.utoronto.ca/pol242/5bMeasuringAssociation.htm.
1752 SET FORMAT=F8.3.
1753
1754 DATA LIST LIST NOTABLE/x y w.
1755 WEIGHT BY w.
1756 BEGIN DATA.
1757 1 1 416
1758 1 2 121
1759 2 1 335
1760 2 2 2
1761 3 1 112
1762 3 2 1
1763 END DATA.
1764 CROSSTABS x BY y/STATISTICS=LAMBDA UC/CELLS=NONE.
1765 ])
1766 AT_CHECK([pspp -o pspp.csv -o pspp.txt uc.sps])
1767 AT_CHECK([cat pspp.csv], [0], [dnl
1768 Table: Summary
1769 ,Cases,,,,,
1770 ,Valid,,Missing,,Total,
1771 ,N,Percent,N,Percent,N,Percent
1772 x × y,987.000,100.0%,.000,.0%,987.000,100.0%
1773
1774 Table: Directional Measures
1775 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1776 Nominal by Nominal,Lambda,Symmetric,.000,.000,NaN,NaN
1777 ,,x Dependent,.000,.000,NaN,NaN
1778 ,,y Dependent,.000,.000,NaN,NaN
1779 ,Goodman and Kruskal tau,x Dependent,.076,,,
1780 ,,y Dependent,.108,,,
1781 ,Uncertainty Coefficient,Symmetric,.105,.012,,
1782 ,,x Dependent,.073,.009,7.890,
1783 ,,y Dependent,.184,.019,7.890,
1784 ])
1785 AT_CLEANUP
1786
1787 AT_SETUP([CROSSTABS estimated risk])
1788 dnl Example data and expected output from
1789 dnl http://www.psychology.nottingham.ac.uk/staff/ddc/c8cxpa/further/Project_resources/SPSSCrosstabW.pdf
1790 AT_DATA([risk.sps], [dnl
1791 DATA LIST LIST /factor disease count (F8.0).
1792 WEIGHT BY count.
1793 VALUE LABELS /factor 0 'Placebo' 1 'Aspirin'
1794              /disease 1 'No' 0 'Yes'.
1795 BEGIN DATA.
1796 0 1 80
1797 0 0 20
1798 1 1 135
1799 1 0 15
1800 END DATA.
1801 CROSSTABS factor BY disease/STATISTICS=RISK CHISQ.
1802 ])
1803 AT_CHECK([pspp -o pspp.csv -o pspp.txt risk.sps])
1804 AT_CHECK([cat pspp.csv], [0], [dnl
1805 Table: Reading free-form data from INLINE.
1806 Variable,Format
1807 factor,F8.0
1808 disease,F8.0
1809 count,F8.0
1810
1811 Table: Summary
1812 ,Cases,,,,,
1813 ,Valid,,Missing,,Total,
1814 ,N,Percent,N,Percent,N,Percent
1815 factor × disease,250,100.0%,0,.0%,250,100.0%
1816
1817 Table: factor × disease
1818 ,,,disease,,Total
1819 ,,,Yes,No,
1820 factor,Placebo,Count,20,80,100
1821 ,Aspirin,Count,15,135,150
1822 Total,,Count,35,215,250
1823
1824 Table: Chi-Square Tests
1825 ,Value,df,Asymptotic Sig. (2-tailed),Exact Sig. (2-tailed),Exact Sig. (1-tailed)
1826 Pearson Chi-Square,4.98,1,.026,,
1827 Likelihood Ratio,4.88,1,.027,,
1828 Fisher's Exact Test,,,,.039,.021
1829 Continuity Correction,4.19,1,.041,,
1830 Linear-by-Linear Association,4.96,1,.026,,
1831 N of Valid Cases,250,,,,
1832
1833 Table: Risk Estimate
1834 ,Value,95% Confidence Interval,
1835 ,,Lower,Upper
1836 Odds Ratio for factor (Placebo / Aspirin),2.25,2.25,2.25
1837 For cohort disease = Yes,1.08,1.08,1.08
1838 For cohort disease = No,.99,.99,.99
1839 N of Valid Cases,250.00,,
1840 ])
1841 AT_CLEANUP
1842
1843 AT_SETUP([CROSSTABS barchart])
1844 AT_DATA([bc.sps], [dnl
1845 SET FORMAT=F8.3.
1846
1847 DATA LIST LIST NOTABLE /x (a20) y (f8) z (f8) w (f8) .
1848 BEGIN DATA.
1849 This  1  0 416
1850 That  2  0 121
1851 Other 2  0 335
1852 This  2  0 231
1853 That  3  0 112
1854 Other 4  0 130
1855 This  1  1 160
1856 That  2  1 211
1857 Other 2  1 352
1858 This  2  1 212
1859 That  3  1 121
1860 Other 4  1 101
1861 END DATA.
1862
1863 WEIGHT BY w.
1864
1865 CROSSTABS
1866           /table x BY y BY z
1867           /table x BY y
1868           /barchart.
1869 ])
1870
1871 AT_CHECK([pspp -O format=txt -o xxx bc.sps], [0], [ignore])
1872
1873 AT_CHECK([test -e xxx-1.png], [0], [ignore])
1874 AT_CHECK([test -e xxx-2.png], [0], [ignore])
1875
1876 AT_CHECK([diff xxx-1.png xxx-2.png], [0], [ignore])
1877
1878 AT_CLEANUP