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,
380 ,,,x Dependent,.25,.22,1.12,
381 ,,,y Dependent,1.00,.00,1.12,
382 ,,Goodman and Kruskal tau,x Dependent,.25,,,
383 ,,,y Dependent,1.00,,,
384 ,,Uncertainty Coefficient,Symmetric,.47,.18,,
385 ,,,x Dependent,.31,.15,2.02,
386 ,,,y Dependent,1.00,.00,2.02,
387 ,Ordinal by Ordinal,Somers' d,Symmetric,.00,,.00,
388 ,,,x Dependent,.00,.50,.00,
389 ,,,y Dependent,.00,.20,.00,
390 ,Nominal by Interval,Eta,x Dependent,.04,,,
391 ,,,y Dependent,1.00,,,
392 2,Nominal by Nominal,Lambda,Symmetric,.50,.25,2.00,
393 ,,,x Dependent,.33,.27,1.15,
394 ,,,y Dependent,1.00,.00,1.15,
395 ,,Goodman and Kruskal tau,x Dependent,.33,,,
396 ,,,y Dependent,1.00,,,
397 ,,Uncertainty Coefficient,Symmetric,.58,.17,,
398 ,,,x Dependent,.41,.17,2.36,
399 ,,,y Dependent,1.00,.00,2.36,
400 ,Ordinal by Ordinal,Somers' d,Symmetric,-.67,,-1.73,
401 ,,,x Dependent,-1.00,.00,-1.73,
402 ,,,y Dependent,-.50,.29,-1.73,
403 ,Nominal by Interval,Eta,x Dependent,.73,,,
404 ,,,y Dependent,1.00,,,
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,
1034 ,,x Dependent,.497,.024,15.986,
1035 ,,y Dependent,.370,.020,16.339,
1036 ,Goodman and Kruskal tau,x Dependent,.382,,,
1037 ,,y Dependent,.198,,,
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,
1048 ,,x Dependent,.250,.089,2.479,
1049 ,,y Dependent,.267,.085,2.766,
1050 ,Goodman and Kruskal tau,x Dependent,.129,,,
1051 ,,y Dependent,.123,,,
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,
1062 ,,x Dependent,.224,.013,16.076,
1063 ,,y Dependent,.192,.012,14.438,
1064 ,Goodman and Kruskal tau,x Dependent,.089,,,
1065 ,,y Dependent,.081,,,
1069 AT_SETUP([CROSSTABS Somers' D, Tau-B, Tau-C, Gamma])
1070 AT_DATA([somersd.sps], [dnl
1073 * From http://stats.stackexchange.com/questions/72203/problem-with-calculating-asymptotic-standard-error-for-somers-d.
1074 DATA LIST LIST NOTABLE/x y * w (F10.6).
1092 CROSSTABS x BY y/STATISTICS=D/CELLS=NONE.
1094 * From http://uregina.ca/~gingrich/gamma.pdf.
1095 DATA LIST LIST NOTABLE/x y w.
1108 CROSSTABS x BY y/STATISTICS=BTAU CTAU GAMMA D/CELLS=NONE.
1110 AT_CHECK([pspp -O format=csv somersd.sps], [0], [dnl
1113 ,Valid,,Missing,,Total,
1114 ,N,Percent,N,Percent,N,Percent
1115 x * y,1.000000,100.0%,.000000,0.0%,1.000000,100.0%
1117 Table: Directional measures.
1118 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1119 Ordinal by Ordinal,Somers' d,Symmetric,-.084,,-.149,
1120 ,,x Dependent,-.045,.300,-.149,
1121 ,,y Dependent,-.684,2.378,-.149,
1125 ,Valid,,Missing,,Total,
1126 ,N,Percent,N,Percent,N,Percent
1127 x * y,687.000,100.0%,.000,0.0%,687.000,100.0%
1129 Table: Symmetric measures.
1130 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1131 Ordinal by Ordinal,Kendall's tau-b,.372,.033,10.669,
1132 ,Kendall's tau-c,.310,.029,10.669,
1133 ,Gamma,.591,.043,10.669,
1134 N of Valid Cases,,687.000,,,
1136 Table: Directional measures.
1137 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1138 Ordinal by Ordinal,Somers' d,Symmetric,.371,,10.669,
1139 ,,x Dependent,.351,.032,10.669,
1140 ,,y Dependent,.394,.035,10.669,
1143 AT_DATA([ordinal.sps], [dnl
1146 * From https://www.iup.edu/WorkArea/DownloadAsset.aspx?id=9829, "Case 1".
1147 DATA LIST LIST NOTABLE /x y w.
1154 CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
1156 * Same site, case 2.
1157 DATA LIST LIST NOTABLE /x y w.
1164 CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
1166 * Same site, case 3.
1167 DATA LIST LIST NOTABLE /x y w.
1174 CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
1176 * Same site, case 4.
1177 DATA LIST LIST NOTABLE /x y w.
1185 CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
1187 * Same site, case 5.
1188 DATA LIST LIST NOTABLE /x y w.
1196 CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
1198 * Same site, case 6.
1199 DATA LIST LIST NOTABLE /x y w.
1211 CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
1213 * Same site, case 7.
1214 DATA LIST LIST NOTABLE /x y w.
1226 CROSSTABS x BY y/STATISTICS=LAMBDA D PHI GAMMA/CELLS=NONE.
1228 * Same site, case 8.
1229 DATA LIST LIST NOTABLE /x y w.
1249 CROSSTABS x BY y/STATISTICS=LAMBDA D PHI BTAU/CELLS=NONE.
1251 AT_CHECK([pspp -O format=csv ordinal.sps], [0], [dnl
1254 ,Valid,,Missing,,Total,
1255 ,N,Percent,N,Percent,N,Percent
1256 x * y,150.000,100.0%,.000,0.0%,150.000,100.0%
1258 Table: Symmetric measures.
1259 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1260 Ordinal by Ordinal,Kendall's tau-b,1.000,.000,24.841,
1261 ,Gamma,1.000,.000,24.841,
1262 N of Valid Cases,,150.000,,,
1264 Table: Directional measures.
1265 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1266 Ordinal by Ordinal,Somers' d,Symmetric,1.000,,24.841,
1267 ,,x Dependent,1.000,.000,24.841,
1268 ,,y Dependent,1.000,.000,24.841,
1272 ,Valid,,Missing,,Total,
1273 ,N,Percent,N,Percent,N,Percent
1274 x * y,150.000,100.0%,.000,0.0%,150.000,100.0%
1276 Table: Symmetric measures.
1277 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1278 Ordinal by Ordinal,Kendall's tau-b,1.000,.000,24.841,
1279 ,Gamma,1.000,.000,24.841,
1280 N of Valid Cases,,150.000,,,
1282 Table: Directional measures.
1283 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1284 Ordinal by Ordinal,Somers' d,Symmetric,1.000,,24.841,
1285 ,,x Dependent,1.000,.000,24.841,
1286 ,,y Dependent,1.000,.000,24.841,
1290 ,Valid,,Missing,,Total,
1291 ,N,Percent,N,Percent,N,Percent
1292 x * y,150.000,100.0%,.000,0.0%,150.000,100.0%
1294 Table: Symmetric measures.
1295 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1296 Ordinal by Ordinal,Kendall's tau-b,-1.000,.000,-24.841,
1297 ,Gamma,-1.000,.000,-24.841,
1298 N of Valid Cases,,150.000,,,
1300 Table: Directional measures.
1301 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1302 Ordinal by Ordinal,Somers' d,Symmetric,-1.000,,-24.841,
1303 ,,x Dependent,-1.000,.000,-24.841,
1304 ,,y Dependent,-1.000,.000,-24.841,
1308 ,Valid,,Missing,,Total,
1309 ,N,Percent,N,Percent,N,Percent
1310 x * y,150.000,100.0%,.000,0.0%,150.000,100.0%
1312 Table: Symmetric measures.
1313 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1314 Ordinal by Ordinal,Kendall's tau-b,.972,.007,24.841,
1315 ,Gamma,1.000,.000,24.841,
1316 N of Valid Cases,,150.000,,,
1318 Table: Directional measures.
1319 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1320 Ordinal by Ordinal,Somers' d,Symmetric,.971,,24.841,
1321 ,,x Dependent,.944,.013,24.841,
1322 ,,y Dependent,1.000,.000,24.841,
1326 ,Valid,,Missing,,Total,
1327 ,N,Percent,N,Percent,N,Percent
1328 x * y,150.000,100.0%,.000,0.0%,150.000,100.0%
1330 Table: Symmetric measures.
1331 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1332 Ordinal by Ordinal,Kendall's tau-b,.119,.059,1.009,
1333 ,Gamma,1.000,.000,1.009,
1334 N of Valid Cases,,150.000,,,
1336 Table: Directional measures.
1337 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1338 Ordinal by Ordinal,Somers' d,Symmetric,.035,,1.009,
1339 ,,x Dependent,.805,.032,1.009,
1340 ,,y Dependent,.018,.017,1.009,
1344 ,Valid,,Missing,,Total,
1345 ,N,Percent,N,Percent,N,Percent
1346 x * y,148.000,100.0%,.000,0.0%,148.000,100.0%
1348 Table: Symmetric measures.
1349 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1350 Ordinal by Ordinal,Kendall's tau-b,-.208,.078,-2.641,
1351 ,Gamma,-.381,.130,-2.641,
1352 N of Valid Cases,,148.000,,,
1354 Table: Directional measures.
1355 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1356 Ordinal by Ordinal,Somers' d,Symmetric,-.206,,-2.641,
1357 ,,x Dependent,-.182,.069,-2.641,
1358 ,,y Dependent,-.237,.089,-2.641,
1362 ,Valid,,Missing,,Total,
1363 ,N,Percent,N,Percent,N,Percent
1364 x * y,148.000,100.0%,.000,0.0%,148.000,100.0%
1366 Table: Symmetric measures.
1367 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1368 Nominal by Nominal,Phi,.731,,,
1370 Ordinal by Ordinal,Gamma,-.110,.107,-1.022,
1371 N of Valid Cases,,148.000,,,
1373 Table: Directional measures.
1374 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1375 Nominal by Nominal,Lambda,Symmetric,.338,.059,4.743,
1376 ,,x Dependent,.640,.085,4.875,
1377 ,,y Dependent,.174,.050,3.248,
1378 ,Goodman and Kruskal tau,x Dependent,.534,,,
1379 ,,y Dependent,.167,,,
1380 Ordinal by Ordinal,Somers' d,Symmetric,-.074,,-1.022,
1381 ,,x Dependent,-.060,.059,-1.022,
1382 ,,y Dependent,-.096,.094,-1.022,
1386 ,Valid,,Missing,,Total,
1387 ,N,Percent,N,Percent,N,Percent
1388 x * y,212.000,100.0%,.000,0.0%,212.000,100.0%
1390 Table: Symmetric measures.
1391 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1392 Nominal by Nominal,Phi,.432,,,
1394 Ordinal by Ordinal,Kendall's tau-b,.209,.062,3.338,
1395 N of Valid Cases,,212.000,,,
1397 Table: Directional measures.
1398 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1399 Nominal by Nominal,Lambda,Symmetric,.102,.067,1.473,
1400 ,,x Dependent,.027,.087,.302,
1401 ,,y Dependent,.165,.065,2.349,
1402 ,Goodman and Kruskal tau,x Dependent,.051,,,
1403 ,,y Dependent,.068,,,
1404 Ordinal by Ordinal,Somers' d,Symmetric,.209,,3.338,
1405 ,,x Dependent,.202,.060,3.338,
1406 ,,y Dependent,.217,.064,3.338,
1410 AT_SETUP([CROSSTABS many statistics])
1411 AT_DATA([crosstabs.sps], [dnl
1414 * From http://www4.stat.ncsu.edu/~dzhang2/st744/table3.9.lst.txt.
1415 DATA LIST LIST NOTABLE/x y w.
1424 CROSSTABS x BY y/STATISTICS=CHISQ PHI CC LAMBDA UC BTAU CTAU GAMMA D CORR/CELLS=NONE.
1426 AT_CHECK([pspp -O format=csv crosstabs.sps], [0], [dnl
1429 ,Valid,,Missing,,Total,
1430 ,N,Percent,N,Percent,N,Percent
1431 x * y,66.0000,100.0%,.0000,0.0%,66.0000,100.0%
1433 Table: Chi-square tests.
1434 Statistic,Value,df,Asymp. Sig. (2-tailed)
1435 Pearson Chi-Square,6.9562,2.0000,.031
1436 Likelihood Ratio,6.6901,2.0000,.035
1437 Linear-by-Linear Association,5.8450,1.0000,.016
1438 N of Valid Cases,66.0000,,
1440 Table: Symmetric measures.
1441 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1442 Nominal by Nominal,Phi,.3246,,,
1443 ,Cramer's V,.3246,,,
1444 ,Contingency Coefficient,.3088,,,
1445 Ordinal by Ordinal,Kendall's tau-b,.2752,.0856,1.9920,
1446 ,Kendall's tau-c,.1497,.0751,1.9920,
1447 ,Gamma,.8717,.1250,1.9920,
1448 ,Spearman Correlation,.2908,.0906,2.4311,
1449 Interval by Interval,Pearson's R,.2999,.0973,2.5147,
1450 N of Valid Cases,,66.0000,,,
1452 Table: Directional measures.
1453 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1454 Nominal by Nominal,Lambda,Symmetric,.0455,.1629,.2723,
1455 ,,x Dependent,.0000,.0000,NaN,
1456 ,,y Dependent,.0500,.1791,.2723,
1457 ,Goodman and Kruskal tau,x Dependent,.1054,,,
1458 ,,y Dependent,.0434,,,
1459 ,Uncertainty Coefficient,Symmetric,.0780,.0474,,
1460 ,,x Dependent,.2217,.1062,1.5373,
1461 ,,y Dependent,.0473,.0306,1.5373,
1462 Ordinal by Ordinal,Somers' d,Symmetric,.1960,,1.9920,
1463 ,,x Dependent,.1152,.0572,1.9920,
1464 ,,y Dependent,.6573,.1417,1.9920,
1468 AT_SETUP([CROSSTABS uncertainy coefficient])
1469 AT_DATA([uc.sps], [dnl
1470 * From http://groups.chass.utoronto.ca/pol242/5bMeasuringAssociation.htm.
1473 DATA LIST LIST NOTABLE/x y w.
1483 CROSSTABS x BY y/STATISTICS=LAMBDA UC/CELLS=NONE.
1485 AT_CHECK([pspp -O format=csv uc.sps], [0], [dnl
1488 ,Valid,,Missing,,Total,
1489 ,N,Percent,N,Percent,N,Percent
1490 x * y,987.000,100.0%,.000,0.0%,987.000,100.0%
1492 Table: Directional measures.
1493 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1494 Nominal by Nominal,Lambda,Symmetric,.000,.000,NaN,
1495 ,,x Dependent,.000,.000,NaN,
1496 ,,y Dependent,.000,.000,NaN,
1497 ,Goodman and Kruskal tau,x Dependent,.076,,,
1498 ,,y Dependent,.108,,,
1499 ,Uncertainty Coefficient,Symmetric,.105,.012,,
1500 ,,x Dependent,.073,.009,7.890,
1501 ,,y Dependent,.184,.019,7.890,