1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2017 Free Software Foundation, Inc.
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.
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.
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/>.
17 AT_BANNER([CROSSTABS procedure])
19 dnl Based on bug #60982.
20 AT_SETUP([CROSSTABS residuals])
21 AT_DATA([crosstabs.sps],
23 DATA LIST LIST NOTABLE/ r c n.
35 CROSSTABS r by c /STATISTICS=CHISQ
36 /CELLS=COUNT EXPECTED RESID SRESID ASRESID.
38 AT_CHECK([pspp -O format=csv crosstabs.sps], [0],
41 ,Valid,,Missing,,Total,
42 ,N,Percent,N,Percent,N,Percent
43 r × c,161.00,100.0%,.00,.0%,161.00,100.0%
48 r,1.00,Count,26.00,31.00,57.00
49 ,,Expected,25.84,31.16,.35
51 ,,Std. Residual,.03,-.03,
52 ,,Adjusted Residual,.05,-.05,
53 ,2.00,Count,12.00,32.00,44.00
54 ,,Expected,19.95,24.05,.27
55 ,,Residual,-7.95,7.95,
56 ,,Std. Residual,-1.78,1.62,
57 ,,Adjusted Residual,-2.82,2.82,
58 ,3.00,Count,27.00,18.00,45.00
59 ,,Expected,20.40,24.60,.28
60 ,,Residual,6.60,-6.60,
61 ,,Std. Residual,1.46,-1.33,
62 ,,Adjusted Residual,2.33,-2.33,
63 ,4.00,Count,8.00,7.00,15.00
64 ,,Expected,6.80,8.20,.09
65 ,,Residual,1.20,-1.20,
66 ,,Std. Residual,.46,-.42,
67 ,,Adjusted Residual,.65,-.65,
68 Total,,Count,73.00,88.00,161.00
69 ,,Expected,.45,.55,1.00
71 Table: Chi-Square Tests
72 ,Value,df,Asymptotic Sig. (2-tailed)
73 Pearson Chi-Square,10.09,3.00,.018
74 Likelihood Ratio,10.35,3.00,.016
75 Linear-by-Linear Association,1.96,1.00,.162
76 N of Valid Cases,161.00,,
80 AT_SETUP([CROSSTABS integer mode crash])
81 AT_DATA([crosstabs.sps],
82 [DATA LIST LIST /A * B * X * Y * .
87 CROSSTABS VARIABLES X (1,7) Y (1,7) /TABLES X BY Y.
89 AT_CHECK([pspp -o pspp.csv -o pspp.txt crosstabs.sps])
90 AT_CHECK([cat pspp.csv], [0],
91 [[Table: Reading free-form data from INLINE.
100 ,Valid,,Missing,,Total,
101 ,N,Percent,N,Percent,N,Percent
102 X × Y,1,100.0%,0,.0%,1,100.0%
105 ,,,Y,,,,,,,Total
106 ,,,1.00,2.00,3.00,4.00,5.00,6.00,7.00,
107 X,1.00,Count,0,0,0,0,0,0,0,0
108 ,2.00,Count,0,0,0,0,0,0,0,0
109 ,3.00,Count,0,0,0,0,0,0,0,0
110 ,4.00,Count,0,0,0,0,1,0,0,1
111 ,5.00,Count,0,0,0,0,0,0,0,0
112 ,6.00,Count,0,0,0,0,0,0,0,0
113 ,7.00,Count,0,0,0,0,0,0,0,0
114 Total,,Count,0,0,0,0,1,0,0,1
119 AT_SETUP([CROSSTABS integer mode crash 2])
120 AT_DATA([crosstabs.sps], [dnl
127 VARIABLES x (1,3) y (1,7)
130 AT_CHECK([pspp -O format=csv crosstabs.sps], [0],
131 [[Table: Reading free-form data from INLINE.
138 ,Valid,,Missing,,Total,
139 ,N,Percent,N,Percent,N,Percent
140 x × y,0,.0%,1,100.0%,1,100.0%
143 ,,,y,,,,,,,Total
144 ,,,1.00,2.00,3.00,4.00,5.00,6.00,7.00,
145 x,1.00,Count,,,,,,,,
146 ,2.00,Count,,,,,,,,
147 ,3.00,Count,,,,,,,,
148 Total,,Count,,,,,,,,
153 AT_SETUP([CROSSTABS long string crash])
154 AT_DATA([crosstabs.sps],
155 [data list list /x * y (a18).
166 CROSSTABS /TABLES = x BY y.
168 AT_CHECK([pspp -o - -O format=csv -o pspp.txt crosstabs.sps], [0],
169 [[Table: Reading free-form data from INLINE.
174 "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."
176 "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."
180 ,Valid,,Missing,,Total,
181 ,N,Percent,N,Percent,N,Percent
182 x × y,4,66.7%,2,33.3%,6,100.0%
186 ,,,one unity,three lots,two duality,zero none,
187 x,1.00,Count,1,0,0,1,2
188 ,2.00,Count,0,0,1,0,1
189 ,3.00,Count,0,1,0,0,1
190 Total,,Count,1,1,1,1,4
194 AT_SETUP([CROSSTABS crash])
195 AT_DATA([crosstabs.sps],
216 CROSSTABS TABLES y by z.
218 AT_CHECK([pspp -o - -O format=csv -o pspp.txt crosstabs.sps], [0],
219 [Table: Reading 1 record from INLINE.
220 Variable,Record,Columns,Format
239 ,Valid,,Missing,,Total,
240 ,N,Percent,N,Percent,N,Percent
241 y × z,9,100.0%,0,.0%,9,100.0%
252 # Bug #26739, which caused CROSSTABS to crash or to fail to output
253 # chi-square results.
254 AT_SETUP([CROSSTABS chi-square crash])
255 AT_DATA([crosstabs.sps],
256 [[DATA LIST LIST /x * y *.
268 AT_CHECK([pspp -O format=csv crosstabs.sps], [0],
269 [[Table: Reading free-form data from INLINE.
276 ,Valid,,Missing,,Total,
277 ,N,Percent,N,Percent,N,Percent
278 x × y,4,100.0%,0,.0%,4,100.0%
288 Table: Chi-Square Tests
289 ,Value,df,Asymptotic Sig. (2-tailed)
290 Pearson Chi-Square,2.00,2,.368
291 Likelihood Ratio,2.77,2,.250
292 Linear-by-Linear Association,.27,1,.602
298 AT_SETUP([CROSSTABS crash with SPLIT FILE])
299 AT_DATA([crosstabs.sps],
300 [data list notable / v0 to v2 1-6 (A)
314 SPLIT FILE SEPARATE BY v0.
318 /FORMAT=AVALUE TABLES
320 /CELLS=COUNT ROW COLUMN TOTAL.
323 AT_CHECK([pspp -o pspp.csv -o pspp.txt crosstabs.sps])
324 AT_CHECK([cat pspp.csv], [0], [dnl
331 ,Valid,,Missing,,Total,
332 ,N,Percent,N,Percent,N,Percent
333 v1 × v2,6,100.0%,0,.0%,6,100.0%
339 ,,Row %,75.0%,25.0%,100.0%
340 ,,Column %,75.0%,50.0%,66.7%
341 ,,Total %,50.0%,16.7%,66.7%
343 ,,Row %,50.0%,50.0%,100.0%
344 ,,Column %,25.0%,50.0%,33.3%
345 ,,Total %,16.7%,16.7%,33.3%
347 ,,Row %,66.7%,33.3%,100.0%
348 ,,Column %,100.0%,100.0%,100.0%
349 ,,Total %,66.7%,33.3%,100.0%
351 Table: Chi-Square Tests
352 ,Value,df,Asymptotic Sig. (2-tailed),Exact Sig. (2-tailed),Exact Sig. (1-tailed)
353 Pearson Chi-Square,.38,1,.540,,
354 Likelihood Ratio,.37,1,.545,,
355 Fisher's Exact Test,,,,1.000,.600
356 Continuity Correction,.00,1,1.000,,
357 N of Valid Cases,6,,,,
365 ,Valid,,Missing,,Total,
366 ,N,Percent,N,Percent,N,Percent
367 v1 × v2,4,100.0%,0,.0%,4,100.0%
373 ,,Row %,.0%,100.0%,100.0%
374 ,,Column %,.0%,33.3%,25.0%
375 ,,Total %,.0%,25.0%,25.0%
377 ,,Row %,33.3%,66.7%,100.0%
378 ,,Column %,100.0%,66.7%,75.0%
379 ,,Total %,25.0%,50.0%,75.0%
381 ,,Row %,25.0%,75.0%,100.0%
382 ,,Column %,100.0%,100.0%,100.0%
383 ,,Total %,25.0%,75.0%,100.0%
385 Table: Chi-Square Tests
386 ,Value,df,Asymptotic Sig. (2-tailed),Exact Sig. (2-tailed),Exact Sig. (1-tailed)
387 Pearson Chi-Square,.44,1,.505,,
388 Likelihood Ratio,.68,1,.410,,
389 Fisher's Exact Test,,,,1.000,.750
390 Continuity Correction,.00,1,1.000,,
391 N of Valid Cases,4,,,,
396 AT_SETUP([3-way CROSSTABS])
397 AT_DATA([crosstabs.sps],
418 CROSSTABS TABLES x BY y BY z/STATISTICS=ALL.
420 AT_CHECK([pspp -o - -O format=csv -o pspp.csv -o pspp.txt crosstabs.sps], [0],
421 [Table: Reading 1 record from INLINE.
422 Variable,Record,Columns,Format
441 ,Valid,,Missing,,Total,
442 ,N,Percent,N,Percent,N,Percent
443 x × y × z,9,100.0%,0,.0%,9,100.0%
460 Table: Chi-Square Tests
461 ,,,Value,df,Asymptotic Sig. (2-tailed)
462 z,1,Pearson Chi-Square,5.00,4,.287
463 ,,Likelihood Ratio,5.00,4,.287
464 ,,Linear-by-Linear Association,.01,1,.938
465 ,,N of Valid Cases,5,,
466 ,2,Pearson Chi-Square,4.00,3,.261
467 ,,Likelihood Ratio,4.50,3,.212
468 ,,Linear-by-Linear Association,1.58,1,.209
469 ,,N of Valid Cases,4,,
471 Table: Symmetric Measures
472 ,,,,Value,Asymp. Std. Error,Approx. T
473 z,1,Nominal by Nominal,Phi,1.00,,
475 ,,,Contingency Coefficient,.71,,
476 ,,Ordinal by Ordinal,Kendall's tau-b,.00,.32,.00
477 ,,,Kendall's tau-c,.00,.32,.00
479 ,,,Spearman Correlation,.00,.22,.00
480 ,,Interval by Interval,Pearson's R,.04,.22,.07
481 ,,N of Valid Cases,,5,,
482 ,2,Nominal by Nominal,Phi,1.00,,
484 ,,,Contingency Coefficient,.71,,
485 ,,Ordinal by Ordinal,Kendall's tau-b,-.71,.20,-1.73
486 ,,,Kendall's tau-c,-.75,.43,-1.73
487 ,,,Gamma,-1.00,.00,-1.73
488 ,,,Spearman Correlation,-.77,.17,-1.73
489 ,,Interval by Interval,Pearson's R,-.73,.18,-1.49
490 ,,N of Valid Cases,,4,,
492 Table: Directional Measures
493 ,,,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
494 z,1,Nominal by Nominal,Lambda,Symmetric,.40,.28,1.12,.264
495 ,,,,x Dependent,.25,.22,1.12,.264
496 ,,,,y Dependent,1.00,.00,1.12,.264
497 ,,,Goodman and Kruskal tau,x Dependent,.25,,,
498 ,,,,y Dependent,1.00,,,
499 ,,,Uncertainty Coefficient,Symmetric,.47,.18,,
500 ,,,,x Dependent,.31,.15,2.02,
501 ,,,,y Dependent,1.00,.00,2.02,
502 ,,Ordinal by Ordinal,Somers' d,Symmetric,.00,,.00,1.000
503 ,,,,x Dependent,.00,.50,.00,1.000
504 ,,,,y Dependent,.00,.20,.00,1.000
505 ,,Nominal by Interval,Eta,x Dependent,.04,,,
506 ,,,,y Dependent,1.00,,,
507 ,2,Nominal by Nominal,Lambda,Symmetric,.50,.25,2.00,.046
508 ,,,,x Dependent,.33,.27,1.15,.248
509 ,,,,y Dependent,1.00,.00,1.15,.248
510 ,,,Goodman and Kruskal tau,x Dependent,.33,,,
511 ,,,,y Dependent,1.00,,,
512 ,,,Uncertainty Coefficient,Symmetric,.58,.17,,
513 ,,,,x Dependent,.41,.17,2.36,
514 ,,,,y Dependent,1.00,.00,2.36,
515 ,,Ordinal by Ordinal,Somers' d,Symmetric,-.67,,-1.73,.083
516 ,,,,x Dependent,-1.00,.00,-1.73,.083
517 ,,,,y Dependent,-.50,.29,-1.73,.083
518 ,,Nominal by Interval,Eta,x Dependent,.73,,,
519 ,,,,y Dependent,1.00,,,
523 AT_SETUP([CROSSTABS rounding weights with COUNT])
524 AT_DATA([crosstabs.sps],
525 [[DATA LIST NOTABLE LIST /x y w.
536 * These should have the same effect (no rounding).
537 CROSSTABS /TABLES x BY y.
538 CROSSTABS /TABLES x BY y /COUNT ASIS.
540 * Round input weights.
541 CROSSTABS /TABLES x BY y /COUNT CASE ROUND.
542 CROSSTABS /TABLES x BY y /COUNT CASE TRUNCATE.
544 * Round cell weights.
545 CROSSTABS /TABLES x BY y /COUNT.
546 CROSSTABS /TABLES x BY y /COUNT TRUNCATE.
549 AT_CHECK([pspp -o pspp.csv -o pspp.txt crosstabs.sps])
550 AT_CHECK([cat pspp.csv], [0],
553 ,Valid,,Missing,,Total,
554 ,N,Percent,N,Percent,N,Percent
555 x × y,9.00,100.0%,.00,.0%,9.00,100.0%
560 x,1.00,Count,2.80,3.20,6.00
561 ,2.00,Count,1.00,2.00,3.00
562 Total,,Count,3.80,5.20,9.00
566 ,Valid,,Missing,,Total,
567 ,N,Percent,N,Percent,N,Percent
568 x × y,9.00,100.0%,.00,.0%,9.00,100.0%
573 x,1.00,Count,2.80,3.20,6.00
574 ,2.00,Count,1.00,2.00,3.00
575 Total,,Count,3.80,5.20,9.00
579 ,Valid,,Missing,,Total,
580 ,N,Percent,N,Percent,N,Percent
581 x × y,9.00,100.0%,.00,.0%,9.00,100.0%
586 x,1.00,Count,2.00,4.00,6.00
587 ,2.00,Count,1.00,2.00,3.00
588 Total,,Count,3.00,6.00,9.00
592 ,Valid,,Missing,,Total,
593 ,N,Percent,N,Percent,N,Percent
594 x × y,7.00,100.0%,.00,.0%,7.00,100.0%
599 x,1.00,Count,2.00,2.00,4.00
600 ,2.00,Count,1.00,2.00,3.00
601 Total,,Count,3.00,4.00,7.00
605 ,Valid,,Missing,,Total,
606 ,N,Percent,N,Percent,N,Percent
607 x × y,9.00,100.0%,.00,.0%,9.00,100.0%
612 x,1.00,Count,3.00,3.00,6.00
613 ,2.00,Count,1.00,2.00,3.00
614 Total,,Count,4.00,5.00,9.00
618 ,Valid,,Missing,,Total,
619 ,N,Percent,N,Percent,N,Percent
620 x × y,8.00,100.0%,.00,.0%,8.00,100.0%
625 x,1.00,Count,2.00,3.00,5.00
626 ,2.00,Count,1.00,2.00,3.00
627 Total,,Count,3.00,5.00,8.00
631 AT_SETUP([CROSSTABS descending sort order])
632 AT_DATA([crosstabs-descending.sps],
633 [[DATA LIST NOTABLE LIST /x * y *.
648 AT_CHECK([pspp -o pspp.csv -o pspp.txt crosstabs-descending.sps])
649 AT_CHECK([cat pspp.csv], [0],
652 ,Valid,,Missing,,Total,
653 ,N,Percent,N,Percent,N,Percent
654 x × y,6,100.0%,0,.0%,6,100.0%
667 AT_SETUP([CROSSTABS crash when all cases missing])
668 AT_DATA([crosstabs.sps], [dnl
669 DATA LIST LIST NOTABLE /X1 X2.
674 MISSING VALUES x2 (1).
676 CROSSTABS /TABLES= X1 by X2.
678 AT_CHECK([pspp -O format=csv crosstabs.sps], [0], [dnl
681 ,Valid,,Missing,,Total,
682 ,N,Percent,N,Percent,N,Percent
683 X1 × X2,0,.0%,1,100.0%,1,100.0%
685 crosstabs.sps:8: warning: CROSSTABS: Crosstabulation X1 × X2 contained no non-missing cases.
691 dnl This example comes from http://www.ats.ucla.edu/stat/spss/whatstat/whatstat.htm#chisq
692 AT_SETUP([CROSSTABS Fisher Exact Test])
694 AT_DATA([fisher-exact.sps], [dnl
698 DATA LIST notable LIST /schtyp (F9.2) female (F9.2) ses (F9.2) .
902 VARIABLE LABEL schtyp 'type of school'.
903 ADD VALUE LABELS female 0 male 1 female.
904 ADD VALUE LABELS ses 1 low 2 middle 3 high.
905 ADD VALUE LABELS schtyp 1 public 2 private.
907 crosstabs /tables = schtyp by female /statistic = chisq.
908 crosstabs /tables = female by ses /statistic = chisq.
911 AT_CHECK([pspp -o pspp.csv -o pspp.txt fisher-exact.sps])
912 AT_CHECK([cat pspp.csv], [0], [Table: Summary
914 ,Valid,,Missing,,Total,
915 ,N,Percent,N,Percent,N,Percent
916 type of school × female,200,100.0%,0,.0%,200,100.0%
918 Table: type of school × female
921 type of school,public,Count,77,91,168
922 ,private,Count,14,18,32
923 Total,,Count,91,109,200
925 Table: Chi-Square Tests
926 ,Value,df,Asymptotic Sig. (2-tailed),Exact Sig. (2-tailed),Exact Sig. (1-tailed)
927 Pearson Chi-Square,.047,1,.828,,
928 Likelihood Ratio,.047,1,.828,,
929 Fisher's Exact Test,,,,.849,.492
930 Continuity Correction,.001,1,.981,,
931 Linear-by-Linear Association,.047,1,.829,,
932 N of Valid Cases,200,,,,
936 ,Valid,,Missing,,Total,
937 ,N,Percent,N,Percent,N,Percent
938 female × ses,200,100.0%,0,.0%,200,100.0%
943 female,male,Count,15,47,29,91
944 ,female,Count,32,48,29,109
945 Total,,Count,47,95,58,200
947 Table: Chi-Square Tests
948 ,Value,df,Asymptotic Sig. (2-tailed)
949 Pearson Chi-Square,4.577,2,.101
950 Likelihood Ratio,4.679,2,.096
951 Linear-by-Linear Association,3.110,1,.078
952 N of Valid Cases,200,,
957 AT_SETUP([CROSSTABS Pearson's R - 1])
958 AT_DATA([pearson.sps], [dnl
961 * From http://www.statisticslectures.com/topics/pearsonr/.
970 CROSSTABS x BY y/STATISTICS=CORR.
972 AT_CHECK([pspp -o pspp.csv -o pspp.txt pearson.sps])
973 AT_CHECK([cat pspp.csv], [0], [dnl
976 ,Valid,,Missing,,Total,
977 ,N,Percent,N,Percent,N,Percent
978 x × y,5,100.0%,0,.0%,5,100.0%
982 ,,,4.000,6.000,10.000,12.000,13.000,
983 x,1.000,Count,1,0,0,0,0,1
984 ,3.000,Count,0,1,0,0,0,1
985 ,5.000,Count,0,0,1,1,0,2
986 ,6.000,Count,0,0,0,0,1,1
987 Total,,Count,1,1,1,1,1,5
989 Table: Symmetric Measures
990 ,,Value,Asymp. Std. Error,Approx. T
991 Ordinal by Ordinal,Spearman Correlation,.975,.022,7.550
992 Interval by Interval,Pearson's R,.968,.017,6.708
993 N of Valid Cases,,5,,
997 AT_SETUP([CROSSTABS Pearson's R - 2])
998 AT_DATA([pearson2.sps], [dnl
1001 * Checked with http://www.socscistatistics.com/tests/pearson/Default2.aspx.
1015 CROSSTABS x BY y/STATISTICS=CORR.
1017 AT_CHECK([pspp -o pspp.csv -o pspp.txt pearson2.sps])
1018 AT_CHECK([cat pspp.csv], [0], [dnl
1021 ,Valid,,Missing,,Total,
1022 ,N,Percent,N,Percent,N,Percent
1023 x × y,10,100.0%,0,.0%,10,100.0%
1026 ,,,y,,,,,,,,,Total
1027 ,,,1.500,4.000,5.000,6.000,6.500,7.000,9.000,10.500,11.000,
1028 x,1.000,Count,1,0,0,0,0,0,0,0,0,1
1029 ,2.000,Count,1,0,0,0,0,0,0,0,0,1
1030 ,3.000,Count,0,1,0,0,0,0,0,0,0,1
1031 ,4.000,Count,0,0,0,1,0,0,0,0,0,1
1032 ,5.000,Count,0,0,1,0,0,0,0,0,0,1
1033 ,6.000,Count,0,0,0,0,0,1,0,0,0,1
1034 ,7.000,Count,0,0,0,0,1,0,0,0,0,1
1035 ,8.000,Count,0,0,0,0,0,0,1,0,0,1
1036 ,9.000,Count,0,0,0,0,0,0,0,1,0,1
1037 ,10.000,Count,0,0,0,0,0,0,0,0,1,1
1038 Total,,Count,2,1,1,1,1,1,1,1,1,10
1040 Table: Symmetric Measures
1041 ,,Value,Asymp. Std. Error,Approx. T
1042 Ordinal by Ordinal,Spearman Correlation,.973,.015,11.844
1043 Interval by Interval,Pearson's R,.971,.017,11.580
1044 N of Valid Cases,,10,,
1048 AT_SETUP([CROSSTABS Pearson's R - 3])
1049 AT_DATA([pearson3.sps], [dnl
1052 * From http://learntech.uwe.ac.uk/da/Default.aspx?pageid=1442.
1065 CROSSTABS x BY y/STATISTICS=CORR.
1067 AT_CHECK([pspp -o pspp.csv -o pspp.txt pearson3.sps])
1068 AT_CHECK([cat pspp.csv], [0], [dnl
1071 ,Valid,,Missing,,Total,
1072 ,N,Percent,N,Percent,N,Percent
1073 x × y,9,100.0%,0,.0%,9,100.0%
1076 ,,,y,,,,,,,,Total
1077 ,,,28.000,58.000,66.000,75.000,85.000,87.000,91.000,122.000,
1078 x,25.000,Count,1,0,0,0,0,0,0,0,1
1079 ,35.000,Count,0,1,0,0,0,0,0,0,1
1080 ,44.000,Count,0,0,1,0,0,0,0,0,1
1081 ,50.000,Count,0,0,0,1,0,0,0,0,1
1082 ,56.000,Count,0,0,0,0,0,1,1,0,2
1083 ,65.000,Count,0,0,0,0,1,0,1,0,2
1084 ,87.000,Count,0,0,0,0,0,0,0,1,1
1085 Total,,Count,1,1,1,1,1,1,2,1,9
1087 Table: Symmetric Measures
1088 ,,Value,Asymp. Std. Error,Approx. T
1089 Ordinal by Ordinal,Spearman Correlation,.911,.068,5.860
1090 Interval by Interval,Pearson's R,.966,.017,9.915
1091 N of Valid Cases,,9,,
1095 AT_SETUP([CROSSTABS Pearson's R - 4])
1096 AT_DATA([pearson4.sps], [dnl
1099 * From http://psychology.ucdavis.edu/faculty_sites/sommerb/sommerdemo/correlation/hand/pearson_hand.htm.
1115 CROSSTABS x BY y/STATISTICS=CORR.
1117 AT_CHECK([pspp -o pspp.csv -o pspp.txt pearson4.sps])
1118 AT_CHECK([cat pspp.csv], [0], [dnl
1121 ,Valid,,Missing,,Total,
1122 ,N,Percent,N,Percent,N,Percent
1123 x × y,12,100.0%,0,.0%,12,100.0%
1126 ,,,y,,,,,,,,,,,,Total
1127 ,,,2.000,4.000,5.000,7.000,9.000,11.000,12.000,14.000,15.000,17.000,18.000,20.000,
1128 x,2.000,Count,0,0,0,1,0,0,0,0,0,0,0,0,1
1129 ,3.000,Count,0,0,0,0,0,0,1,0,0,0,0,0,1
1130 ,4.000,Count,0,0,0,0,1,1,0,0,0,0,0,0,2
1131 ,5.000,Count,0,0,1,0,0,0,0,0,0,0,0,0,1
1132 ,6.000,Count,1,1,0,0,0,0,0,0,0,0,0,0,2
1133 ,7.000,Count,0,0,0,0,0,0,0,1,0,0,0,0,1
1134 ,8.000,Count,0,0,0,0,0,0,0,0,1,0,0,0,1
1135 ,9.000,Count,0,0,0,0,0,0,0,0,0,1,0,0,1
1136 ,10.000,Count,0,0,0,0,0,0,0,0,0,0,1,1,2
1137 Total,,Count,1,1,1,1,1,1,1,1,1,1,1,1,12
1139 Table: Symmetric Measures
1140 ,,Value,Asymp. Std. Error,Approx. T
1141 Ordinal by Ordinal,Spearman Correlation,.657,.140,2.758
1142 Interval by Interval,Pearson's R,.667,.132,2.830
1143 N of Valid Cases,,12,,
1147 AT_SETUP([CROSSTABS Pearson's R - 5])
1148 AT_DATA([pearson5.sps], [dnl
1151 * From http://www.statisticslectures.com/topics/pearsonr/.
1165 CROSSTABS x BY y/STATISTICS=CORR.
1167 AT_CHECK([pspp -o pspp.csv -o pspp.txt pearson5.sps])
1168 AT_CHECK([cat pspp.csv], [0], [dnl
1171 ,Valid,,Missing,,Total,
1172 ,N,Percent,N,Percent,N,Percent
1173 x × y,10,100.0%,0,.0%,10,100.0%
1176 ,,,y,,,,,,,,,,Total
1177 ,,,15000.00,26000.00,29000.00,32000.00,33000.00,41000.00,45000.00,52000.00,68000.00,80000.00,
1178 x,18.000,Count,1,0,0,0,0,0,0,0,0,0,1
1179 ,24.000,Count,0,1,0,0,0,0,0,0,0,0,1
1180 ,25.000,Count,0,0,1,0,0,0,0,0,0,0,1
1181 ,26.000,Count,0,0,0,1,0,0,0,0,0,0,1
1182 ,33.000,Count,0,0,0,0,1,0,0,0,0,0,1
1183 ,37.000,Count,0,0,0,0,0,1,0,0,0,0,1
1184 ,40.000,Count,0,0,0,0,0,0,1,0,0,0,1
1185 ,45.000,Count,0,0,0,0,0,0,0,1,0,0,1
1186 ,57.000,Count,0,0,0,0,0,0,0,0,1,0,1
1187 ,64.000,Count,0,0,0,0,0,0,0,0,0,1,1
1188 Total,,Count,1,1,1,1,1,1,1,1,1,1,10
1190 Table: Symmetric Measures
1191 ,,Value,Asymp. Std. Error,Approx. T
1192 Ordinal by Ordinal,Spearman Correlation,1.000,.000,+Infinit
1193 Interval by Interval,Pearson's R,.992,.004,22.638
1194 N of Valid Cases,,10,,
1198 AT_SETUP([CROSSTABS Goodman and Kruskal's lambda - 1])
1199 AT_DATA([lambda.sps], [dnl
1202 * From http://www.csupomona.edu/~jlkorey/POWERMUTT/Topics/contingency_tables.html.
1203 DATA LIST LIST NOTABLE/x y w.
1214 CROSSTABS x BY y/CELLS=NONE/STATISTICS=LAMBDA.
1216 AT_CHECK([pspp -o pspp.csv -o pspp.txt lambda.sps])
1217 AT_CHECK([cat pspp.csv], [0], [dnl
1220 ,Valid,,Missing,,Total,
1221 ,N,Percent,N,Percent,N,Percent
1222 x × y,1296.000,100.0%,.000,.0%,1296.000,100.0%
1224 Table: Directional Measures
1225 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1226 Nominal by Nominal,Lambda,Symmetric,.423,.021,16.875,.000
1227 ,,x Dependent,.497,.024,15.986,.000
1228 ,,y Dependent,.370,.020,16.339,.000
1229 ,Goodman and Kruskal tau,x Dependent,.382,,,
1230 ,,y Dependent,.198,,,
1234 AT_SETUP([CROSSTABS Goodman and Kruskal's lambda - 2])
1235 AT_DATA([lambda.sps], [dnl
1238 * From http://vassarstats.net.
1239 DATA LIST LIST NOTABLE/x y w.
1253 CROSSTABS x BY y/CELLS=NONE/STATISTICS=LAMBDA.
1255 AT_CHECK([pspp -o pspp.csv -o pspp.txt lambda.sps])
1256 AT_CHECK([cat pspp.csv], [0], [dnl
1259 ,Valid,,Missing,,Total,
1260 ,N,Percent,N,Percent,N,Percent
1261 x × y,137.000,100.0%,.000,.0%,137.000,100.0%
1263 Table: Directional Measures
1264 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1265 Nominal by Nominal,Lambda,Symmetric,.259,.081,2.902,.004
1266 ,,x Dependent,.250,.089,2.479,.013
1267 ,,y Dependent,.267,.085,2.766,.006
1268 ,Goodman and Kruskal tau,x Dependent,.129,,,
1269 ,,y Dependent,.123,,,
1273 AT_SETUP([CROSSTABS Goodman and Kruskal's lambda - 3])
1274 AT_DATA([lambda.sps], [dnl
1277 * From Goodman, L.A., Kruskal, W.H. (1954) "Measures of association for
1278 cross classifications". Part I. Journal of the American Statistical
1279 Association, 49, 732-764.
1280 DATA LIST LIST NOTABLE/x y w.
1296 CROSSTABS x BY y/CELLS=NONE/STATISTICS=LAMBDA.
1298 AT_CHECK([pspp -o pspp.csv -o pspp.txt lambda.sps])
1299 AT_CHECK([cat pspp.csv], [0], [dnl
1302 ,Valid,,Missing,,Total,
1303 ,N,Percent,N,Percent,N,Percent
1304 x × y,6800.000,100.0%,.000,.0%,6800.000,100.0%
1306 Table: Directional Measures
1307 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1308 Nominal by Nominal,Lambda,Symmetric,.208,.010,18.793,.000
1309 ,,x Dependent,.224,.013,16.076,.000
1310 ,,y Dependent,.192,.012,14.438,.000
1311 ,Goodman and Kruskal tau,x Dependent,.089,,,
1312 ,,y Dependent,.081,,,
1316 AT_SETUP([CROSSTABS Goodman and Kruskal's lambda - treatment of ties])
1317 AT_DATA([lambda.sps], [dnl
1320 * From Douglas Bonett.
1321 DATA LIST LIST NOTABLE/x y w.
1332 CROSSTABS x BY y/CELLS=NONE/STATISTICS=LAMBDA.
1334 AT_CHECK([pspp -o pspp.csv -o pspp.txt lambda.sps])
1335 AT_CHECK([cat pspp.csv], [0], [dnl
1338 ,Valid,,Missing,,Total,
1339 ,N,Percent,N,Percent,N,Percent
1340 x × y,500.000,100.0%,.000,.0%,500.000,100.0%
1342 Table: Directional Measures
1343 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1344 Nominal by Nominal,Lambda,Symmetric,.031,.013,2.336,.019
1345 ,,x Dependent,.000,.000,NaN,NaN
1346 ,,y Dependent,.033,.014,2.336,.019
1347 ,Goodman and Kruskal tau,x Dependent,.012,,,
1348 ,,y Dependent,.009,,,
1352 AT_SETUP([CROSSTABS Somers' D, Tau-B, Tau-C, Gamma - 1])
1353 AT_DATA([somersd.sps], [dnl
1356 * From http://stats.stackexchange.com/questions/72203/problem-with-calculating-asymptotic-standard-error-for-somers-d.
1357 DATA LIST LIST NOTABLE/x y * w (F10.6).
1375 CROSSTABS x BY y/STATISTICS=D/CELLS=NONE.
1377 AT_CHECK([pspp -o pspp.csv -o pspp.txt somersd.sps])
1378 AT_CHECK([cat pspp.csv], [0], [dnl
1381 ,Valid,,Missing,,Total,
1382 ,N,Percent,N,Percent,N,Percent
1383 x × y,1.000000,100.0%,.000000,.0%,1.000000,100.0%
1385 Table: Directional Measures
1386 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1387 Ordinal by Ordinal,Somers' d,Symmetric,-.084,,-.149,.882
1388 ,,x Dependent,-.045,.300,-.149,.882
1389 ,,y Dependent,-.684,2.378,-.149,.882
1393 AT_SETUP([CROSSTABS Somers' D, Tau-B, Tau-C, Gamma - 2])
1394 AT_DATA([somersd.sps], [dnl
1397 * From http://uregina.ca/~gingrich/gamma.pdf.
1398 DATA LIST LIST NOTABLE/x y w.
1411 CROSSTABS x BY y/STATISTICS=BTAU CTAU GAMMA D/CELLS=NONE.
1413 AT_CHECK([pspp -o pspp.csv -o pspp.txt somersd.sps])
1414 AT_CHECK([cat pspp.csv], [0], [dnl
1417 ,Valid,,Missing,,Total,
1418 ,N,Percent,N,Percent,N,Percent
1419 x × y,687.000,100.0%,.000,.0%,687.000,100.0%
1421 Table: Symmetric Measures
1422 ,,Value,Asymp. Std. Error,Approx. T
1423 Ordinal by Ordinal,Kendall's tau-b,.372,.033,10.669
1424 ,Kendall's tau-c,.310,.029,10.669
1425 ,Gamma,.591,.043,10.669
1426 N of Valid Cases,,687.000,,
1428 Table: Directional Measures
1429 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1430 Ordinal by Ordinal,Somers' d,Symmetric,.371,,10.669,.000
1431 ,,x Dependent,.351,.032,10.669,.000
1432 ,,y Dependent,.394,.035,10.669,.000
1436 AT_SETUP([CROSSTABS Somers' D, Tau-B, Tau-C, Gamma - 3])
1437 AT_DATA([ordinal.sps], [dnl
1440 * From https://www.iup.edu/WorkArea/DownloadAsset.aspx?id=9829, "Case 1".
1441 DATA LIST LIST NOTABLE /x y w.
1448 CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
1450 * Same site, case 2.
1451 DATA LIST LIST NOTABLE /x y w.
1458 CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
1460 * Same site, case 3.
1461 DATA LIST LIST NOTABLE /x y w.
1468 CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
1470 * Same site, case 4.
1471 DATA LIST LIST NOTABLE /x y w.
1479 CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
1481 * Same site, case 5.
1482 DATA LIST LIST NOTABLE /x y w.
1490 CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
1492 * Same site, case 6.
1493 DATA LIST LIST NOTABLE /x y w.
1505 CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
1507 * Same site, case 7.
1508 DATA LIST LIST NOTABLE /x y w.
1520 CROSSTABS x BY y/STATISTICS=LAMBDA D PHI GAMMA/CELLS=NONE.
1522 * Same site, case 8.
1523 DATA LIST LIST NOTABLE /x y w.
1543 CROSSTABS x BY y/STATISTICS=LAMBDA D PHI BTAU/CELLS=NONE.
1545 AT_CHECK([pspp -o pspp.csv -o pspp.txt ordinal.sps])
1546 AT_CHECK([cat pspp.csv], [0], [dnl
1549 ,Valid,,Missing,,Total,
1550 ,N,Percent,N,Percent,N,Percent
1551 x × y,150.000,100.0%,.000,.0%,150.000,100.0%
1553 Table: Symmetric Measures
1554 ,,Value,Asymp. Std. Error,Approx. T
1555 Ordinal by Ordinal,Kendall's tau-b,1.000,.000,24.841
1556 ,Gamma,1.000,.000,24.841
1557 N of Valid Cases,,150.000,,
1559 Table: Directional Measures
1560 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1561 Ordinal by Ordinal,Somers' d,Symmetric,1.000,,24.841,.000
1562 ,,x Dependent,1.000,.000,24.841,.000
1563 ,,y Dependent,1.000,.000,24.841,.000
1567 ,Valid,,Missing,,Total,
1568 ,N,Percent,N,Percent,N,Percent
1569 x × y,150.000,100.0%,.000,.0%,150.000,100.0%
1571 Table: Symmetric Measures
1572 ,,Value,Asymp. Std. Error,Approx. T
1573 Ordinal by Ordinal,Kendall's tau-b,1.000,.000,24.841
1574 ,Gamma,1.000,.000,24.841
1575 N of Valid Cases,,150.000,,
1577 Table: Directional Measures
1578 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1579 Ordinal by Ordinal,Somers' d,Symmetric,1.000,,24.841,.000
1580 ,,x Dependent,1.000,.000,24.841,.000
1581 ,,y Dependent,1.000,.000,24.841,.000
1585 ,Valid,,Missing,,Total,
1586 ,N,Percent,N,Percent,N,Percent
1587 x × y,150.000,100.0%,.000,.0%,150.000,100.0%
1589 Table: Symmetric Measures
1590 ,,Value,Asymp. Std. Error,Approx. T
1591 Ordinal by Ordinal,Kendall's tau-b,-1.000,.000,-24.841
1592 ,Gamma,-1.000,.000,-24.841
1593 N of Valid Cases,,150.000,,
1595 Table: Directional Measures
1596 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1597 Ordinal by Ordinal,Somers' d,Symmetric,-1.000,,-24.841,.000
1598 ,,x Dependent,-1.000,.000,-24.841,.000
1599 ,,y Dependent,-1.000,.000,-24.841,.000
1603 ,Valid,,Missing,,Total,
1604 ,N,Percent,N,Percent,N,Percent
1605 x × y,150.000,100.0%,.000,.0%,150.000,100.0%
1607 Table: Symmetric Measures
1608 ,,Value,Asymp. Std. Error,Approx. T
1609 Ordinal by Ordinal,Kendall's tau-b,.972,.007,24.841
1610 ,Gamma,1.000,.000,24.841
1611 N of Valid Cases,,150.000,,
1613 Table: Directional Measures
1614 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1615 Ordinal by Ordinal,Somers' d,Symmetric,.971,,24.841,.000
1616 ,,x Dependent,.944,.013,24.841,.000
1617 ,,y Dependent,1.000,.000,24.841,.000
1621 ,Valid,,Missing,,Total,
1622 ,N,Percent,N,Percent,N,Percent
1623 x × y,150.000,100.0%,.000,.0%,150.000,100.0%
1625 Table: Symmetric Measures
1626 ,,Value,Asymp. Std. Error,Approx. T
1627 Ordinal by Ordinal,Kendall's tau-b,.119,.059,1.009
1628 ,Gamma,1.000,.000,1.009
1629 N of Valid Cases,,150.000,,
1631 Table: Directional Measures
1632 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1633 Ordinal by Ordinal,Somers' d,Symmetric,.035,,1.009,.313
1634 ,,x Dependent,.805,.032,1.009,.313
1635 ,,y Dependent,.018,.017,1.009,.313
1639 ,Valid,,Missing,,Total,
1640 ,N,Percent,N,Percent,N,Percent
1641 x × y,148.000,100.0%,.000,.0%,148.000,100.0%
1643 Table: Symmetric Measures
1644 ,,Value,Asymp. Std. Error,Approx. T
1645 Ordinal by Ordinal,Kendall's tau-b,-.208,.078,-2.641
1646 ,Gamma,-.381,.130,-2.641
1647 N of Valid Cases,,148.000,,
1649 Table: Directional Measures
1650 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1651 Ordinal by Ordinal,Somers' d,Symmetric,-.206,,-2.641,.008
1652 ,,x Dependent,-.182,.069,-2.641,.008
1653 ,,y Dependent,-.237,.089,-2.641,.008
1657 ,Valid,,Missing,,Total,
1658 ,N,Percent,N,Percent,N,Percent
1659 x × y,148.000,100.0%,.000,.0%,148.000,100.0%
1661 Table: Symmetric Measures
1662 ,,Value,Asymp. Std. Error,Approx. T
1663 Nominal by Nominal,Phi,.731,,
1665 Ordinal by Ordinal,Gamma,-.110,.107,-1.022
1666 N of Valid Cases,,148.000,,
1668 Table: Directional Measures
1669 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1670 Nominal by Nominal,Lambda,Symmetric,.338,.059,4.743,.000
1671 ,,x Dependent,.640,.085,4.875,.000
1672 ,,y Dependent,.174,.050,3.248,.001
1673 ,Goodman and Kruskal tau,x Dependent,.534,,,
1674 ,,y Dependent,.167,,,
1675 Ordinal by Ordinal,Somers' d,Symmetric,-.074,,-1.022,.307
1676 ,,x Dependent,-.060,.059,-1.022,.307
1677 ,,y Dependent,-.096,.094,-1.022,.307
1681 ,Valid,,Missing,,Total,
1682 ,N,Percent,N,Percent,N,Percent
1683 x × y,212.000,100.0%,.000,.0%,212.000,100.0%
1685 Table: Symmetric Measures
1686 ,,Value,Asymp. Std. Error,Approx. T
1687 Nominal by Nominal,Phi,.432,,
1689 Ordinal by Ordinal,Kendall's tau-b,.209,.062,3.338
1690 N of Valid Cases,,212.000,,
1692 Table: Directional Measures
1693 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1694 Nominal by Nominal,Lambda,Symmetric,.102,.067,1.473,.141
1695 ,,x Dependent,.027,.087,.302,.763
1696 ,,y Dependent,.165,.065,2.349,.019
1697 ,Goodman and Kruskal tau,x Dependent,.051,,,
1698 ,,y Dependent,.068,,,
1699 Ordinal by Ordinal,Somers' d,Symmetric,.209,,3.338,.001
1700 ,,x Dependent,.202,.060,3.338,.001
1701 ,,y Dependent,.217,.064,3.338,.001
1705 AT_SETUP([CROSSTABS Cohens Kappa])
1707 dnl Example from Wood J. M.
1708 dnl "Understanding and Computing Cohen's Kappa: A Tutorial"
1709 dnl WebPsychEmpiricist. Oct 3 2007
1710 AT_DATA([kappa.sps], [dnl
1713 data list notable list /p1 * p2 * w *.
1722 crosstabs /table = p1 by p2
1727 AT_CHECK([pspp -o pspp.csv -o pspp.txt kappa.sps])
1728 AT_CHECK([cat pspp.csv], [0], [dnl
1731 ,Valid,,Missing,,Total,
1732 ,N,Percent,N,Percent,N,Percent
1733 p1 × p2,20.000,100.0%,.000,.0%,20.000,100.0%
1738 p1,.000,Count,18.000,1.000,19.000
1739 ,1.000,Count,1.000,.000,1.000
1740 Total,,Count,19.000,1.000,20.000
1742 Table: Symmetric Measures
1743 ,,Value,Asymp. Std. Error,Approx. T
1744 Measure of Agreement,Kappa,-.053,.037,-.235
1745 N of Valid Cases,,20.000,,
1751 AT_SETUP([CROSSTABS many statistics])
1752 AT_DATA([crosstabs.sps], [dnl
1755 * From http://www4.stat.ncsu.edu/~dzhang2/st744/table3.9.lst.txt.
1756 DATA LIST LIST NOTABLE/x y w.
1765 CROSSTABS x BY y/STATISTICS=CHISQ PHI CC LAMBDA UC BTAU CTAU GAMMA D CORR/CELLS=NONE.
1767 AT_CHECK([pspp -o pspp.csv -o pspp.txt crosstabs.sps])
1768 AT_CHECK([cat pspp.csv], [0], [dnl
1771 ,Valid,,Missing,,Total,
1772 ,N,Percent,N,Percent,N,Percent
1773 x × y,66.0000,100.0%,.0000,.0%,66.0000,100.0%
1775 Table: Chi-Square Tests
1776 ,Value,df,Asymptotic Sig. (2-tailed)
1777 Pearson Chi-Square,6.9562,2.0000,.031
1778 Likelihood Ratio,6.6901,2.0000,.035
1779 Linear-by-Linear Association,5.8450,1.0000,.016
1780 N of Valid Cases,66.0000,,
1782 Table: Symmetric Measures
1783 ,,Value,Asymp. Std. Error,Approx. T
1784 Nominal by Nominal,Phi,.3246,,
1786 ,Contingency Coefficient,.3088,,
1787 Ordinal by Ordinal,Kendall's tau-b,.2752,.0856,1.9920
1788 ,Kendall's tau-c,.1497,.0751,1.9920
1789 ,Gamma,.8717,.1250,1.9920
1790 ,Spearman Correlation,.2908,.0906,2.4311
1791 Interval by Interval,Pearson's R,.2999,.0973,2.5147
1792 N of Valid Cases,,66.0000,,
1794 Table: Directional Measures
1795 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1796 Nominal by Nominal,Lambda,Symmetric,.0455,.1629,.2723,.785
1797 ,,x Dependent,.0000,.0000,NaN,NaN
1798 ,,y Dependent,.0500,.1791,.2723,.785
1799 ,Goodman and Kruskal tau,x Dependent,.1054,,,
1800 ,,y Dependent,.0434,,,
1801 ,Uncertainty Coefficient,Symmetric,.0780,.0474,,
1802 ,,x Dependent,.2217,.1062,1.5373,
1803 ,,y Dependent,.0473,.0306,1.5373,
1804 Ordinal by Ordinal,Somers' d,Symmetric,.1960,,1.9920,.046
1805 ,,x Dependent,.1152,.0572,1.9920,.046
1806 ,,y Dependent,.6573,.1417,1.9920,.046
1810 AT_SETUP([CROSSTABS uncertainy coefficient])
1811 AT_DATA([uc.sps], [dnl
1812 * From http://groups.chass.utoronto.ca/pol242/5bMeasuringAssociation.htm.
1815 DATA LIST LIST NOTABLE/x y w.
1825 CROSSTABS x BY y/STATISTICS=LAMBDA UC/CELLS=NONE.
1827 AT_CHECK([pspp -o pspp.csv -o pspp.txt uc.sps])
1828 AT_CHECK([cat pspp.csv], [0], [dnl
1831 ,Valid,,Missing,,Total,
1832 ,N,Percent,N,Percent,N,Percent
1833 x × y,987.000,100.0%,.000,.0%,987.000,100.0%
1835 Table: Directional Measures
1836 ,,,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1837 Nominal by Nominal,Lambda,Symmetric,.000,.000,NaN,NaN
1838 ,,x Dependent,.000,.000,NaN,NaN
1839 ,,y Dependent,.000,.000,NaN,NaN
1840 ,Goodman and Kruskal tau,x Dependent,.076,,,
1841 ,,y Dependent,.108,,,
1842 ,Uncertainty Coefficient,Symmetric,.105,.012,,
1843 ,,x Dependent,.073,.009,7.890,
1844 ,,y Dependent,.184,.019,7.890,
1848 AT_SETUP([CROSSTABS estimated risk])
1849 dnl Example data and expected output from
1850 dnl http://www.psychology.nottingham.ac.uk/staff/ddc/c8cxpa/further/Project_resources/SPSSCrosstabW.pdf
1851 AT_DATA([risk.sps], [dnl
1852 DATA LIST LIST /factor disease count (F8.0).
1854 VALUE LABELS /factor 0 'Placebo' 1 'Aspirin'
1855 /disease 1 'No' 0 'Yes'.
1862 CROSSTABS factor BY disease/STATISTICS=RISK CHISQ.
1864 AT_CHECK([pspp -o pspp.csv -o pspp.txt risk.sps])
1865 AT_CHECK([cat pspp.csv], [0], [dnl
1866 Table: Reading free-form data from INLINE.
1874 ,Valid,,Missing,,Total,
1875 ,N,Percent,N,Percent,N,Percent
1876 factor × disease,250,100.0%,0,.0%,250,100.0%
1878 Table: factor × disease
1881 factor,Placebo,Count,20,80,100
1882 ,Aspirin,Count,15,135,150
1883 Total,,Count,35,215,250
1885 Table: Chi-Square Tests
1886 ,Value,df,Asymptotic Sig. (2-tailed),Exact Sig. (2-tailed),Exact Sig. (1-tailed)
1887 Pearson Chi-Square,4.98,1,.026,,
1888 Likelihood Ratio,4.88,1,.027,,
1889 Fisher's Exact Test,,,,.039,.021
1890 Continuity Correction,4.19,1,.041,,
1891 Linear-by-Linear Association,4.96,1,.026,,
1892 N of Valid Cases,250,,,,
1894 Table: Risk Estimate
1895 ,Value,95% Confidence Interval,
1897 Odds Ratio for factor (Placebo / Aspirin),2.25,2.25,2.25
1898 For cohort disease = Yes,1.08,1.08,1.08
1899 For cohort disease = No,.99,.99,.99
1900 N of Valid Cases,250.00,,
1904 AT_SETUP([CROSSTABS barchart])
1905 AT_DATA([bc.sps], [dnl
1908 DATA LIST LIST NOTABLE /x (a20) y (f8) z (f8) w (f8) .
1932 AT_CHECK([pspp -O format=txt -o xxx bc.sps], [0], [ignore])
1934 AT_CHECK([test -e xxx-1.png], [0], [ignore])
1935 AT_CHECK([test -e xxx-2.png], [0], [ignore])
1937 AT_CHECK([diff xxx-1.png xxx-2.png], [0], [ignore])