1 AT_BANNER([CROSSTABS procedure])
3 AT_SETUP([CROSSTABS integer mode crash])
4 AT_DATA([crosstabs.sps],
5 [DATA LIST LIST /A * B * X * Y * .
10 CROSSTABS VARIABLES X (1,7) Y (1,7) /TABLES X BY Y.
12 AT_CHECK([pspp -O format=csv crosstabs.sps], [0],
13 [[Table: Reading free-form data from INLINE.
22 ,Valid,,Missing,,Total,
23 ,N,Percent,N,Percent,N,Percent
24 X * Y,1,100.0%,0,0.0%,1,100.0%
28 X,1.00,2.00,3.00,4.00,5.00,6.00,7.00,Total
29 1.00,.00,.00,.00,.00,.00,.00,.00,.00
30 2.00,.00,.00,.00,.00,.00,.00,.00,.00
31 3.00,.00,.00,.00,.00,.00,.00,.00,.00
32 4.00,.00,.00,.00,.00,1.00,.00,.00,1.00
33 5.00,.00,.00,.00,.00,.00,.00,.00,.00
34 6.00,.00,.00,.00,.00,.00,.00,.00,.00
35 7.00,.00,.00,.00,.00,.00,.00,.00,.00
36 Total,.00,.00,.00,.00,1.00,.00,.00,1.00
41 AT_SETUP([CROSSTABS long string crash])
42 AT_DATA([crosstabs.sps],
43 [data list list /x * y (a18).
54 CROSSTABS /TABLES = x BY y.
56 AT_CHECK([pspp -o - -O format=csv crosstabs.sps], [0],
57 [[Table: Reading free-form data from INLINE.
62 "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."
64 "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."
68 ,Valid,,Missing,,Total,
69 ,N,Percent,N,Percent,N,Percent
70 x * y,4,66.7%,2,33.3%,6,100.0%
74 x,one unity ,three lots ,two duality ,zero none ,Total
75 1.00,1.00,.00,.00,1.00,2.00
76 2.00,.00,.00,1.00,.00,1.00
77 3.00,.00,1.00,.00,.00,1.00
78 Total,1.00,1.00,1.00,1.00,4.00
82 AT_SETUP([CROSSTABS crash])
83 AT_DATA([crosstabs.sps],
104 CROSSTABS TABLES y by z.
106 AT_CHECK([pspp -O format=csv crosstabs.sps], [0],
107 [[Table: Reading 1 record from INLINE.
108 Variable,Record,Columns,Format
127 ,Valid,,Missing,,Total,
128 ,N,Percent,N,Percent,N,Percent
129 y * z,9,100.0%,0,0.0%,9,100.0%
131 Table: y * z [count].
140 # Bug #26739, which caused CROSSTABS to crash or to fail to output
141 # chi-square results.
142 AT_SETUP([CROSSTABS chi-square crash])
143 AT_DATA([crosstabs.sps],
144 [[DATA LIST LIST /x * y *.
156 AT_CHECK([pspp -O format=csv crosstabs.sps], [0],
157 [[Table: Reading free-form data from INLINE.
164 ,Valid,,Missing,,Total,
165 ,N,Percent,N,Percent,N,Percent
166 x * y,4,100.0%,0,0.0%,4,100.0%
168 Table: x * y [count].
176 Table: Chi-square tests.
177 Statistic,Value,df,Asymp. Sig. (2-tailed)
178 Pearson Chi-Square,2.00,2,.368
179 Likelihood Ratio,2.77,2,.250
180 Linear-by-Linear Association,.27,1,.602
186 AT_SETUP([CROSSTABS crash with SPLIT FILE])
187 AT_DATA([crosstabs.sps],
188 [data list notable / v0 to v2 1-6 (A)
202 SPLIT FILE SEPARATE BY v0.
206 /FORMAT=AVALUE TABLES PIVOT
208 /CELLS=COUNT ROW COLUMN TOTAL.
211 AT_CHECK([pspp -O format=csv crosstabs.sps], [0],
212 [[Variable,Value,Label
217 ,Valid,,Missing,,Total,
218 ,N,Percent,N,Percent,N,Percent
219 v1 * v2,6,100.0%,0,0.0%,6,100.0%
221 "Table: v1 * v2 [count, row %, column %, total %]."
225 ,75.00%,25.00%,100.00%
226 ,75.00%,50.00%,66.67%
227 ,50.00%,16.67%,66.67%
229 ,50.00%,50.00%,100.00%
230 ,25.00%,50.00%,33.33%
231 ,16.67%,16.67%,33.33%
233 ,66.67%,33.33%,100.00%
234 ,100.00%,100.00%,100.00%
235 ,66.67%,33.33%,100.00%
237 Table: Chi-square tests.
238 Statistic,Value,df,Asymp. Sig. (2-tailed),Exact Sig. (2-tailed),Exact Sig. (1-tailed)
239 Pearson Chi-Square,.38,1,.540,,
240 Likelihood Ratio,.37,1,.545,,
241 Fisher's Exact Test,,,,1.000,.600
242 Continuity Correction,.00,1,1.000,,
243 N of Valid Cases,6,,,,
250 ,Valid,,Missing,,Total,
251 ,N,Percent,N,Percent,N,Percent
252 v1 * v2,4,100.0%,0,0.0%,4,100.0%
254 "Table: v1 * v2 [count, row %, column %, total %]."
258 ,.00%,100.00%,100.00%
262 ,33.33%,66.67%,100.00%
263 ,100.00%,66.67%,75.00%
264 ,25.00%,50.00%,75.00%
266 ,25.00%,75.00%,100.00%
267 ,100.00%,100.00%,100.00%
268 ,25.00%,75.00%,100.00%
270 Table: Chi-square tests.
271 Statistic,Value,df,Asymp. Sig. (2-tailed),Exact Sig. (2-tailed),Exact Sig. (1-tailed)
272 Pearson Chi-Square,.44,1,.505,,
273 Likelihood Ratio,.68,1,.410,,
274 Fisher's Exact Test,,,,1.000,.750
275 Continuity Correction,.00,1,1.000,,
276 N of Valid Cases,4,,,,
281 AT_SETUP([3-way CROSSTABS])
282 AT_DATA([crosstabs.sps],
303 CROSSTABS TABLES x BY y BY z/STATISTICS=ALL.
305 AT_CHECK([pspp -O format=csv crosstabs.sps], [0],
306 [[Table: Reading 1 record from INLINE.
307 Variable,Record,Columns,Format
326 ,Valid,,Missing,,Total,
327 ,N,Percent,N,Percent,N,Percent
328 x * y * z,9,100.0%,0,0.0%,9,100.0%
330 Table: x * y * z [count].
338 Total,,4.00,1.00,5.00
343 Total,,3.00,1.00,4.00
345 Table: Chi-square tests.
346 z,Statistic,Value,df,Asymp. Sig. (2-tailed)
347 1,Pearson Chi-Square,5.00,4,.287
348 ,Likelihood Ratio,5.00,4,.287
349 ,Linear-by-Linear Association,.01,1,.938
350 ,N of Valid Cases,5,,
351 2,Pearson Chi-Square,4.00,3,.261
352 ,Likelihood Ratio,4.50,3,.212
353 ,Linear-by-Linear Association,1.58,1,.209
354 ,N of Valid Cases,4,,
356 Table: Symmetric measures.
357 z,Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
358 1,Nominal by Nominal,Phi,1.00,,,
360 ,,Contingency Coefficient,.71,,,
361 ,Ordinal by Ordinal,Kendall's tau-b,.00,.32,.00,
362 ,,Kendall's tau-c,.00,.32,.00,
364 ,,Spearman Correlation,.00,.22,.00,
365 ,Interval by Interval,Pearson's R,.04,.22,.07,
366 ,N of Valid Cases,,5,,,
367 2,Nominal by Nominal,Phi,1.00,,,
369 ,,Contingency Coefficient,.71,,,
370 ,Ordinal by Ordinal,Kendall's tau-b,-.71,.20,-1.73,
371 ,,Kendall's tau-c,-.75,.43,-1.73,
372 ,,Gamma,-1.00,.00,-1.73,
373 ,,Spearman Correlation,-.77,.17,-1.73,
374 ,Interval by Interval,Pearson's R,-.73,.18,-1.49,
375 ,N of Valid Cases,,4,,,
377 Table: Directional measures.
378 z,Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
379 1,Nominal by Nominal,Lambda,Symmetric,.40,.28,1.12,.264
380 ,,,x Dependent,.25,.22,1.12,.264
381 ,,,y Dependent,1.00,.00,1.12,.264
382 ,,Goodman and Kruskal tau,x Dependent,.25,,,. @&t@
383 ,,,y Dependent,1.00,,,. @&t@
384 ,,Uncertainty Coefficient,Symmetric,.47,.18,,. @&t@
385 ,,,x Dependent,.31,.15,2.02,. @&t@
386 ,,,y Dependent,1.00,.00,2.02,. @&t@
387 ,Ordinal by Ordinal,Somers' d,Symmetric,.00,,.00,1.000
388 ,,,x Dependent,.00,.50,.00,1.000
389 ,,,y Dependent,.00,.20,.00,1.000
390 ,Nominal by Interval,Eta,x Dependent,.04,,,. @&t@
391 ,,,y Dependent,1.00,,,. @&t@
392 2,Nominal by Nominal,Lambda,Symmetric,.50,.25,2.00,.046
393 ,,,x Dependent,.33,.27,1.15,.248
394 ,,,y Dependent,1.00,.00,1.15,.248
395 ,,Goodman and Kruskal tau,x Dependent,.33,,,. @&t@
396 ,,,y Dependent,1.00,,,. @&t@
397 ,,Uncertainty Coefficient,Symmetric,.58,.17,,. @&t@
398 ,,,x Dependent,.41,.17,2.36,. @&t@
399 ,,,y Dependent,1.00,.00,2.36,. @&t@
400 ,Ordinal by Ordinal,Somers' d,Symmetric,-.67,,-1.73,.083
401 ,,,x Dependent,-1.00,.00,-1.73,.083
402 ,,,y Dependent,-.50,.29,-1.73,.083
403 ,Nominal by Interval,Eta,x Dependent,.73,,,. @&t@
404 ,,,y Dependent,1.00,,,. @&t@
410 AT_SETUP([CROSSTABS descending sort order])
411 AT_DATA([crosstabs-descending.sps],
412 [[DATA LIST NOTABLE LIST /x * y *.
427 AT_CHECK([pspp -O format=csv crosstabs-descending.sps], [0],
430 ,Valid,,Missing,,Total,
431 ,N,Percent,N,Percent,N,Percent
432 x * y,6,100.0%,0,0.0%,6,100.0%
434 Table: x * y [count].
445 AT_SETUP([CROSSTABS crash when all cases missing])
446 AT_DATA([crosstabs.sps], [dnl
447 DATA LIST LIST NOTABLE /X1 X2.
452 MISSING VALUES x2 (1).
454 CROSSTABS /TABLES= X1 by X2.
456 AT_CHECK([pspp -O format=csv crosstabs.sps], [0], [dnl
459 ,Valid,,Missing,,Total,
460 ,N,Percent,N,Percent,N,Percent
461 X1 * X2,0,0.0%,1,100.0%,1,100.0%
463 crosstabs.sps:8: warning: CROSSTABS: Crosstabulation X1 * X2 contained no non-missing cases.
469 dnl This example comes from http://www.ats.ucla.edu/stat/spss/whatstat/whatstat.htm#chisq
470 AT_SETUP([CROSSTABS Fisher Exact Test])
472 AT_DATA([fisher-exact.sps], [dnl
476 DATA LIST notable LIST /schtyp (F9.2) female (F9.2) ses (F9.2) .
680 VARIABLE LABEL schtyp 'type of school'.
681 ADD VALUE LABELS female 0 male 1 female.
682 ADD VALUE LABELS ses 1 low 2 middle 3 high.
683 ADD VALUE LABELS schtyp 1 public 2 private.
685 crosstabs /tables = schtyp by female /statistic = chisq.
686 crosstabs /tables = female by ses /statistic = chisq.
689 AT_CHECK([pspp -O format=csv fisher-exact.sps], [0], [dnl
692 ,Valid,,Missing,,Total,
693 ,N,Percent,N,Percent,N,Percent
694 type of school * female,200,100.0%,0,0.0%,200,100.0%
696 Table: type of school * female [[count]].
698 type of school,male,female,Total
699 public,77.000,91.000,168.000
700 private,14.000,18.000,32.000
701 Total,91.000,109.000,200.000
703 Table: Chi-square tests.
704 Statistic,Value,df,Asymp. Sig. (2-tailed),Exact Sig. (2-tailed),Exact Sig. (1-tailed)
705 Pearson Chi-Square,.047,1,.828,,
706 Likelihood Ratio,.047,1,.828,,
707 Fisher's Exact Test,,,,.849,.492
708 Continuity Correction,.001,1,.981,,
709 Linear-by-Linear Association,.047,1,.829,,
710 N of Valid Cases,200,,,,
714 ,Valid,,Missing,,Total,
715 ,N,Percent,N,Percent,N,Percent
716 female * ses,200,100.0%,0,0.0%,200,100.0%
718 Table: female * ses [[count]].
720 female,low,middle,high,Total
721 male,15.000,47.000,29.000,91.000
722 female,32.000,48.000,29.000,109.000
723 Total,47.000,95.000,58.000,200.000
725 Table: Chi-square tests.
726 Statistic,Value,df,Asymp. Sig. (2-tailed)
727 Pearson Chi-Square,4.577,2,.101
728 Likelihood Ratio,4.679,2,.096
729 Linear-by-Linear Association,3.110,1,.078
730 N of Valid Cases,200,,
735 AT_SETUP([CROSSTABS Pearson's R])
737 AT_DATA([pearson.sps], [dnl
740 * From http://www.statisticslectures.com/topics/pearsonr/.
749 CROSSTABS x BY y/STATISTICS=CORR.
751 AT_CHECK([pspp -O format=csv pearson.sps], [0], [dnl
754 ,Valid,,Missing,,Total,
755 ,N,Percent,N,Percent,N,Percent
756 x * y,5,100.0%,0,0.0%,5,100.0%
758 Table: x * y [[count]].
760 x,4.000,6.000,10.000,12.000,13.000,Total
761 1.000,1.000,.000,.000,.000,.000,1.000
762 3.000,.000,1.000,.000,.000,.000,1.000
763 5.000,.000,.000,1.000,1.000,.000,2.000
764 6.000,.000,.000,.000,.000,1.000,1.000
765 Total,1.000,1.000,1.000,1.000,1.000,5.000
767 Table: Symmetric measures.
768 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
769 Ordinal by Ordinal,Spearman Correlation,.975,.022,7.550,
770 Interval by Interval,Pearson's R,.968,.017,6.708,
771 N of Valid Cases,,5,,,
775 AT_DATA([pearson2.sps], [dnl
778 * Checked with http://www.socscistatistics.com/tests/pearson/Default2.aspx.
792 CROSSTABS x BY y/STATISTICS=CORR.
794 AT_CHECK([pspp -O format=csv pearson2.sps], [0], [dnl
797 ,Valid,,Missing,,Total,
798 ,N,Percent,N,Percent,N,Percent
799 x * y,10,100.0%,0,0.0%,10,100.0%
801 Table: x * y [[count]].
802 ,y,,,,,,,,,
803 x,1.500,4.000,5.000,6.000,6.500,7.000,9.000,10.500,11.000,Total
804 1.000,1.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000
805 2.000,1.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000
806 3.000,.000,1.000,.000,.000,.000,.000,.000,.000,.000,1.000
807 4.000,.000,.000,.000,1.000,.000,.000,.000,.000,.000,1.000
808 5.000,.000,.000,1.000,.000,.000,.000,.000,.000,.000,1.000
809 6.000,.000,.000,.000,.000,.000,1.000,.000,.000,.000,1.000
810 7.000,.000,.000,.000,.000,1.000,.000,.000,.000,.000,1.000
811 8.000,.000,.000,.000,.000,.000,.000,1.000,.000,.000,1.000
812 9.000,.000,.000,.000,.000,.000,.000,.000,1.000,.000,1.000
813 10.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000,1.000
814 Total,2.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,10.000
816 Table: Symmetric measures.
817 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
818 Ordinal by Ordinal,Spearman Correlation,.973,.015,11.844,
819 Interval by Interval,Pearson's R,.971,.017,11.580,
820 N of Valid Cases,,10,,,
824 AT_DATA([pearson3.sps], [dnl
827 * From http://learntech.uwe.ac.uk/da/Default.aspx?pageid=1442.
840 CROSSTABS x BY y/STATISTICS=CORR.
842 AT_CHECK([pspp -O format=csv pearson3.sps], [0], [dnl
845 ,Valid,,Missing,,Total,
846 ,N,Percent,N,Percent,N,Percent
847 x * y,9,100.0%,0,0.0%,9,100.0%
849 Table: x * y [[count]].
851 x,28.000,58.000,66.000,75.000,85.000,87.000,91.000,122.000,Total
852 25.000,1.000,.000,.000,.000,.000,.000,.000,.000,1.000
853 35.000,.000,1.000,.000,.000,.000,.000,.000,.000,1.000
854 44.000,.000,.000,1.000,.000,.000,.000,.000,.000,1.000
855 50.000,.000,.000,.000,1.000,.000,.000,.000,.000,1.000
856 56.000,.000,.000,.000,.000,.000,1.000,1.000,.000,2.000
857 65.000,.000,.000,.000,.000,1.000,.000,1.000,.000,2.000
858 87.000,.000,.000,.000,.000,.000,.000,.000,1.000,1.000
859 Total,1.000,1.000,1.000,1.000,1.000,1.000,2.000,1.000,9.000
861 Table: Symmetric measures.
862 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
863 Ordinal by Ordinal,Spearman Correlation,.911,.068,5.860,
864 Interval by Interval,Pearson's R,.966,.017,9.915,
865 N of Valid Cases,,9,,,
869 AT_DATA([pearson4.sps], [dnl
872 * From http://psychology.ucdavis.edu/faculty_sites/sommerb/sommerdemo/correlation/hand/pearson_hand.htm.
888 CROSSTABS x BY y/STATISTICS=CORR.
890 AT_CHECK([pspp -O format=csv pearson4.sps], [0], [dnl
893 ,Valid,,Missing,,Total,
894 ,N,Percent,N,Percent,N,Percent
895 x * y,12,100.0%,0,0.0%,12,100.0%
897 Table: x * y [[count]].
898 ,y,,,,,,,,,,,,
899 x,2.000,4.000,5.000,7.000,9.000,11.000,12.000,14.000,15.000,17.000,18.000,20.000,Total
900 2.000,.000,.000,.000,1.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000
901 3.000,.000,.000,.000,.000,.000,.000,1.000,.000,.000,.000,.000,.000,1.000
902 4.000,.000,.000,.000,.000,1.000,1.000,.000,.000,.000,.000,.000,.000,2.000
903 5.000,.000,.000,1.000,.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000
904 6.000,1.000,1.000,.000,.000,.000,.000,.000,.000,.000,.000,.000,.000,2.000
905 7.000,.000,.000,.000,.000,.000,.000,.000,1.000,.000,.000,.000,.000,1.000
906 8.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000,.000,.000,.000,1.000
907 9.000,.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000,.000,.000,1.000
908 10.000,.000,.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000,1.000,2.000
909 Total,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,12.000
911 Table: Symmetric measures.
912 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
913 Ordinal by Ordinal,Spearman Correlation,.657,.140,2.758,
914 Interval by Interval,Pearson's R,.667,.132,2.830,
915 N of Valid Cases,,12,,,
919 AT_DATA([pearson5.sps], [dnl
922 * From http://www.statisticslectures.com/topics/pearsonr/.
936 CROSSTABS x BY y/STATISTICS=CORR.
938 AT_CHECK([pspp -O format=csv pearson5.sps], [0], [dnl
941 ,Valid,,Missing,,Total,
942 ,N,Percent,N,Percent,N,Percent
943 x * y,10,100.0%,0,0.0%,10,100.0%
945 Table: x * y [[count]].
946 ,y,,,,,,,,,,
947 x,15000.000,26000.000,29000.000,32000.000,33000.000,41000.000,45000.000,52000.000,68000.000,80000.000,Total
948 18.000,1.000,.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000
949 24.000,.000,1.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000
950 25.000,.000,.000,1.000,.000,.000,.000,.000,.000,.000,.000,1.000
951 26.000,.000,.000,.000,1.000,.000,.000,.000,.000,.000,.000,1.000
952 33.000,.000,.000,.000,.000,1.000,.000,.000,.000,.000,.000,1.000
953 37.000,.000,.000,.000,.000,.000,1.000,.000,.000,.000,.000,1.000
954 40.000,.000,.000,.000,.000,.000,.000,1.000,.000,.000,.000,1.000
955 45.000,.000,.000,.000,.000,.000,.000,.000,1.000,.000,.000,1.000
956 57.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000,.000,1.000
957 64.000,.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000,1.000
958 Total,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,10.000
960 Table: Symmetric measures.
961 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
962 Ordinal by Ordinal,Spearman Correlation,1.000,.000,+Infinity,
963 Interval by Interval,Pearson's R,.992,.004,22.638,
964 N of Valid Cases,,10,,,
968 AT_SETUP([CROSSTABS Goodman and Kruskal's lambda])
969 AT_DATA([lambda.sps], [dnl
972 * From http://www.csupomona.edu/~jlkorey/POWERMUTT/Topics/contingency_tables.html.
973 DATA LIST LIST NOTABLE/x y w.
984 CROSSTABS x BY y/CELLS=NONE/STATISTICS=LAMBDA.
986 * From http://vassarstats.net.
987 DATA LIST LIST NOTABLE/x y w.
1001 CROSSTABS x BY y/CELLS=NONE/STATISTICS=LAMBDA.
1003 * From Goodman, L.A., Kruskal, W.H. (1954) "Measures of association for
1004 cross classifications". Part I. Journal of the American Statistical
1005 Association, 49, 732-764.
1006 DATA LIST LIST NOTABLE/x y w.
1022 CROSSTABS x BY y/CELLS=NONE/STATISTICS=LAMBDA.
1024 AT_CHECK([pspp -O format=csv lambda.sps], [0], [dnl
1027 ,Valid,,Missing,,Total,
1028 ,N,Percent,N,Percent,N,Percent
1029 x * y,1296.000,100.0%,.000,0.0%,1296.000,100.0%
1031 Table: Directional measures.
1032 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1033 Nominal by Nominal,Lambda,Symmetric,.423,.021,16.875,.000
1034 ,,x Dependent,.497,.024,15.986,.000
1035 ,,y Dependent,.370,.020,16.339,.000
1036 ,Goodman and Kruskal tau,x Dependent,.382,,,. @&t@
1037 ,,y Dependent,.198,,,. @&t@
1041 ,Valid,,Missing,,Total,
1042 ,N,Percent,N,Percent,N,Percent
1043 x * y,137.000,100.0%,.000,0.0%,137.000,100.0%
1045 Table: Directional measures.
1046 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1047 Nominal by Nominal,Lambda,Symmetric,.259,.081,2.902,.004
1048 ,,x Dependent,.250,.089,2.479,.013
1049 ,,y Dependent,.267,.085,2.766,.006
1050 ,Goodman and Kruskal tau,x Dependent,.129,,,. @&t@
1051 ,,y Dependent,.123,,,. @&t@
1055 ,Valid,,Missing,,Total,
1056 ,N,Percent,N,Percent,N,Percent
1057 x * y,6800.000,100.0%,.000,0.0%,6800.000,100.0%
1059 Table: Directional measures.
1060 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1061 Nominal by Nominal,Lambda,Symmetric,.208,.010,18.793,.000
1062 ,,x Dependent,.224,.013,16.076,.000
1063 ,,y Dependent,.192,.012,14.438,.000
1064 ,Goodman and Kruskal tau,x Dependent,.089,,,. @&t@
1065 ,,y Dependent,.081,,,. @&t@
1069 AT_SETUP([CROSSTABS Goodman and Kruskal's lambda - treatment of ties])
1070 AT_DATA([lambda.sps], [dnl
1073 * From Douglas Bonett.
1074 DATA LIST LIST NOTABLE/x y w.
1085 CROSSTABS x BY y/CELLS=NONE/STATISTICS=LAMBDA.
1087 AT_CHECK([pspp -O format=csv lambda.sps], [0], [dnl
1090 ,Valid,,Missing,,Total,
1091 ,N,Percent,N,Percent,N,Percent
1092 x * y,500.000,100.0%,.000,0.0%,500.000,100.0%
1094 Table: Directional measures.
1095 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1096 Nominal by Nominal,Lambda,Symmetric,.031,.013,2.336,.019
1097 ,,x Dependent,.000,.000,NaN,NaN
1098 ,,y Dependent,.033,.014,2.336,.019
1099 ,Goodman and Kruskal tau,x Dependent,.012,,,. @&t@
1100 ,,y Dependent,.009,,,. @&t@
1104 AT_SETUP([CROSSTABS Somers' D, Tau-B, Tau-C, Gamma])
1105 AT_DATA([somersd.sps], [dnl
1108 * From http://stats.stackexchange.com/questions/72203/problem-with-calculating-asymptotic-standard-error-for-somers-d.
1109 DATA LIST LIST NOTABLE/x y * w (F10.6).
1127 CROSSTABS x BY y/STATISTICS=D/CELLS=NONE.
1129 * From http://uregina.ca/~gingrich/gamma.pdf.
1130 DATA LIST LIST NOTABLE/x y w.
1143 CROSSTABS x BY y/STATISTICS=BTAU CTAU GAMMA D/CELLS=NONE.
1145 AT_CHECK([pspp -O format=csv somersd.sps], [0], [dnl
1148 ,Valid,,Missing,,Total,
1149 ,N,Percent,N,Percent,N,Percent
1150 x * y,1.000000,100.0%,.000000,0.0%,1.000000,100.0%
1152 Table: Directional measures.
1153 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1154 Ordinal by Ordinal,Somers' d,Symmetric,-.084,,-.149,.882
1155 ,,x Dependent,-.045,.300,-.149,.882
1156 ,,y Dependent,-.684,2.378,-.149,.882
1160 ,Valid,,Missing,,Total,
1161 ,N,Percent,N,Percent,N,Percent
1162 x * y,687.000,100.0%,.000,0.0%,687.000,100.0%
1164 Table: Symmetric measures.
1165 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1166 Ordinal by Ordinal,Kendall's tau-b,.372,.033,10.669,
1167 ,Kendall's tau-c,.310,.029,10.669,
1168 ,Gamma,.591,.043,10.669,
1169 N of Valid Cases,,687.000,,,
1171 Table: Directional measures.
1172 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1173 Ordinal by Ordinal,Somers' d,Symmetric,.371,,10.669,.000
1174 ,,x Dependent,.351,.032,10.669,.000
1175 ,,y Dependent,.394,.035,10.669,.000
1178 AT_DATA([ordinal.sps], [dnl
1181 * From https://www.iup.edu/WorkArea/DownloadAsset.aspx?id=9829, "Case 1".
1182 DATA LIST LIST NOTABLE /x y w.
1189 CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
1191 * Same site, case 2.
1192 DATA LIST LIST NOTABLE /x y w.
1199 CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
1201 * Same site, case 3.
1202 DATA LIST LIST NOTABLE /x y w.
1209 CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
1211 * Same site, case 4.
1212 DATA LIST LIST NOTABLE /x y w.
1220 CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
1222 * Same site, case 5.
1223 DATA LIST LIST NOTABLE /x y w.
1231 CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
1233 * Same site, case 6.
1234 DATA LIST LIST NOTABLE /x y w.
1246 CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
1248 * Same site, case 7.
1249 DATA LIST LIST NOTABLE /x y w.
1261 CROSSTABS x BY y/STATISTICS=LAMBDA D PHI GAMMA/CELLS=NONE.
1263 * Same site, case 8.
1264 DATA LIST LIST NOTABLE /x y w.
1284 CROSSTABS x BY y/STATISTICS=LAMBDA D PHI BTAU/CELLS=NONE.
1286 AT_CHECK([pspp -O format=csv ordinal.sps], [0], [dnl
1289 ,Valid,,Missing,,Total,
1290 ,N,Percent,N,Percent,N,Percent
1291 x * y,150.000,100.0%,.000,0.0%,150.000,100.0%
1293 Table: Symmetric measures.
1294 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1295 Ordinal by Ordinal,Kendall's tau-b,1.000,.000,24.841,
1296 ,Gamma,1.000,.000,24.841,
1297 N of Valid Cases,,150.000,,,
1299 Table: Directional measures.
1300 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1301 Ordinal by Ordinal,Somers' d,Symmetric,1.000,,24.841,.000
1302 ,,x Dependent,1.000,.000,24.841,.000
1303 ,,y Dependent,1.000,.000,24.841,.000
1307 ,Valid,,Missing,,Total,
1308 ,N,Percent,N,Percent,N,Percent
1309 x * y,150.000,100.0%,.000,0.0%,150.000,100.0%
1311 Table: Symmetric measures.
1312 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1313 Ordinal by Ordinal,Kendall's tau-b,1.000,.000,24.841,
1314 ,Gamma,1.000,.000,24.841,
1315 N of Valid Cases,,150.000,,,
1317 Table: Directional measures.
1318 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1319 Ordinal by Ordinal,Somers' d,Symmetric,1.000,,24.841,.000
1320 ,,x Dependent,1.000,.000,24.841,.000
1321 ,,y Dependent,1.000,.000,24.841,.000
1325 ,Valid,,Missing,,Total,
1326 ,N,Percent,N,Percent,N,Percent
1327 x * y,150.000,100.0%,.000,0.0%,150.000,100.0%
1329 Table: Symmetric measures.
1330 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1331 Ordinal by Ordinal,Kendall's tau-b,-1.000,.000,-24.841,
1332 ,Gamma,-1.000,.000,-24.841,
1333 N of Valid Cases,,150.000,,,
1335 Table: Directional measures.
1336 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1337 Ordinal by Ordinal,Somers' d,Symmetric,-1.000,,-24.841,.000
1338 ,,x Dependent,-1.000,.000,-24.841,.000
1339 ,,y Dependent,-1.000,.000,-24.841,.000
1343 ,Valid,,Missing,,Total,
1344 ,N,Percent,N,Percent,N,Percent
1345 x * y,150.000,100.0%,.000,0.0%,150.000,100.0%
1347 Table: Symmetric measures.
1348 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1349 Ordinal by Ordinal,Kendall's tau-b,.972,.007,24.841,
1350 ,Gamma,1.000,.000,24.841,
1351 N of Valid Cases,,150.000,,,
1353 Table: Directional measures.
1354 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1355 Ordinal by Ordinal,Somers' d,Symmetric,.971,,24.841,.000
1356 ,,x Dependent,.944,.013,24.841,.000
1357 ,,y Dependent,1.000,.000,24.841,.000
1361 ,Valid,,Missing,,Total,
1362 ,N,Percent,N,Percent,N,Percent
1363 x * y,150.000,100.0%,.000,0.0%,150.000,100.0%
1365 Table: Symmetric measures.
1366 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1367 Ordinal by Ordinal,Kendall's tau-b,.119,.059,1.009,
1368 ,Gamma,1.000,.000,1.009,
1369 N of Valid Cases,,150.000,,,
1371 Table: Directional measures.
1372 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1373 Ordinal by Ordinal,Somers' d,Symmetric,.035,,1.009,.313
1374 ,,x Dependent,.805,.032,1.009,.313
1375 ,,y Dependent,.018,.017,1.009,.313
1379 ,Valid,,Missing,,Total,
1380 ,N,Percent,N,Percent,N,Percent
1381 x * y,148.000,100.0%,.000,0.0%,148.000,100.0%
1383 Table: Symmetric measures.
1384 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1385 Ordinal by Ordinal,Kendall's tau-b,-.208,.078,-2.641,
1386 ,Gamma,-.381,.130,-2.641,
1387 N of Valid Cases,,148.000,,,
1389 Table: Directional measures.
1390 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1391 Ordinal by Ordinal,Somers' d,Symmetric,-.206,,-2.641,.008
1392 ,,x Dependent,-.182,.069,-2.641,.008
1393 ,,y Dependent,-.237,.089,-2.641,.008
1397 ,Valid,,Missing,,Total,
1398 ,N,Percent,N,Percent,N,Percent
1399 x * y,148.000,100.0%,.000,0.0%,148.000,100.0%
1401 Table: Symmetric measures.
1402 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1403 Nominal by Nominal,Phi,.731,,,
1405 Ordinal by Ordinal,Gamma,-.110,.107,-1.022,
1406 N of Valid Cases,,148.000,,,
1408 Table: Directional measures.
1409 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1410 Nominal by Nominal,Lambda,Symmetric,.338,.059,4.743,.000
1411 ,,x Dependent,.640,.085,4.875,.000
1412 ,,y Dependent,.174,.050,3.248,.001
1413 ,Goodman and Kruskal tau,x Dependent,.534,,,. @&t@
1414 ,,y Dependent,.167,,,. @&t@
1415 Ordinal by Ordinal,Somers' d,Symmetric,-.074,,-1.022,.307
1416 ,,x Dependent,-.060,.059,-1.022,.307
1417 ,,y Dependent,-.096,.094,-1.022,.307
1421 ,Valid,,Missing,,Total,
1422 ,N,Percent,N,Percent,N,Percent
1423 x * y,212.000,100.0%,.000,0.0%,212.000,100.0%
1425 Table: Symmetric measures.
1426 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1427 Nominal by Nominal,Phi,.432,,,
1429 Ordinal by Ordinal,Kendall's tau-b,.209,.062,3.338,
1430 N of Valid Cases,,212.000,,,
1432 Table: Directional measures.
1433 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1434 Nominal by Nominal,Lambda,Symmetric,.102,.067,1.473,.141
1435 ,,x Dependent,.027,.087,.302,.763
1436 ,,y Dependent,.165,.065,2.349,.019
1437 ,Goodman and Kruskal tau,x Dependent,.051,,,. @&t@
1438 ,,y Dependent,.068,,,. @&t@
1439 Ordinal by Ordinal,Somers' d,Symmetric,.209,,3.338,.001
1440 ,,x Dependent,.202,.060,3.338,.001
1441 ,,y Dependent,.217,.064,3.338,.001
1445 AT_SETUP([CROSSTABS many statistics])
1446 AT_DATA([crosstabs.sps], [dnl
1449 * From http://www4.stat.ncsu.edu/~dzhang2/st744/table3.9.lst.txt.
1450 DATA LIST LIST NOTABLE/x y w.
1459 CROSSTABS x BY y/STATISTICS=CHISQ PHI CC LAMBDA UC BTAU CTAU GAMMA D CORR/CELLS=NONE.
1461 AT_CHECK([pspp -O format=csv crosstabs.sps], [0], [dnl
1464 ,Valid,,Missing,,Total,
1465 ,N,Percent,N,Percent,N,Percent
1466 x * y,66.0000,100.0%,.0000,0.0%,66.0000,100.0%
1468 Table: Chi-square tests.
1469 Statistic,Value,df,Asymp. Sig. (2-tailed)
1470 Pearson Chi-Square,6.9562,2.0000,.031
1471 Likelihood Ratio,6.6901,2.0000,.035
1472 Linear-by-Linear Association,5.8450,1.0000,.016
1473 N of Valid Cases,66.0000,,
1475 Table: Symmetric measures.
1476 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1477 Nominal by Nominal,Phi,.3246,,,
1478 ,Cramer's V,.3246,,,
1479 ,Contingency Coefficient,.3088,,,
1480 Ordinal by Ordinal,Kendall's tau-b,.2752,.0856,1.9920,
1481 ,Kendall's tau-c,.1497,.0751,1.9920,
1482 ,Gamma,.8717,.1250,1.9920,
1483 ,Spearman Correlation,.2908,.0906,2.4311,
1484 Interval by Interval,Pearson's R,.2999,.0973,2.5147,
1485 N of Valid Cases,,66.0000,,,
1487 Table: Directional measures.
1488 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1489 Nominal by Nominal,Lambda,Symmetric,.0455,.1629,.2723,.785
1490 ,,x Dependent,.0000,.0000,NaN,NaN
1491 ,,y Dependent,.0500,.1791,.2723,.785
1492 ,Goodman and Kruskal tau,x Dependent,.1054,,,. @&t@
1493 ,,y Dependent,.0434,,,. @&t@
1494 ,Uncertainty Coefficient,Symmetric,.0780,.0474,,. @&t@
1495 ,,x Dependent,.2217,.1062,1.5373,. @&t@
1496 ,,y Dependent,.0473,.0306,1.5373,. @&t@
1497 Ordinal by Ordinal,Somers' d,Symmetric,.1960,,1.9920,.046
1498 ,,x Dependent,.1152,.0572,1.9920,.046
1499 ,,y Dependent,.6573,.1417,1.9920,.046
1503 AT_SETUP([CROSSTABS uncertainy coefficient])
1504 AT_DATA([uc.sps], [dnl
1505 * From http://groups.chass.utoronto.ca/pol242/5bMeasuringAssociation.htm.
1508 DATA LIST LIST NOTABLE/x y w.
1518 CROSSTABS x BY y/STATISTICS=LAMBDA UC/CELLS=NONE.
1520 AT_CHECK([pspp -O format=csv uc.sps], [0], [dnl
1523 ,Valid,,Missing,,Total,
1524 ,N,Percent,N,Percent,N,Percent
1525 x * y,987.000,100.0%,.000,0.0%,987.000,100.0%
1527 Table: Directional measures.
1528 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1529 Nominal by Nominal,Lambda,Symmetric,.000,.000,NaN,NaN
1530 ,,x Dependent,.000,.000,NaN,NaN
1531 ,,y Dependent,.000,.000,NaN,NaN
1532 ,Goodman and Kruskal tau,x Dependent,.076,,,. @&t@
1533 ,,y Dependent,.108,,,. @&t@
1534 ,Uncertainty Coefficient,Symmetric,.105,.012,,. @&t@
1535 ,,x Dependent,.073,.009,7.890,. @&t@
1536 ,,y Dependent,.184,.019,7.890,. @&t@