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 integer mode crash 2])
42 AT_DATA([crosstabs.sps], [dnl
49 VARIABLES x (1,3) y (1,7)
52 AT_CHECK([pspp -O format=csv crosstabs.sps], [0],
53 [[Table: Reading free-form data from INLINE.
60 ,Valid,,Missing,,Total,
61 ,N,Percent,N,Percent,N,Percent
62 x * y,0,0.0%,1,100.0%,1,100.0%
67 AT_SETUP([CROSSTABS long string crash])
68 AT_DATA([crosstabs.sps],
69 [data list list /x * y (a18).
80 CROSSTABS /TABLES = x BY y.
82 AT_CHECK([pspp -o - -O format=csv crosstabs.sps], [0],
83 [[Table: Reading free-form data from INLINE.
88 "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."
90 "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."
94 ,Valid,,Missing,,Total,
95 ,N,Percent,N,Percent,N,Percent
96 x * y,4,66.7%,2,33.3%,6,100.0%
100 x,one unity ,three lots ,two duality ,zero none ,Total
101 1.00,1.00,.00,.00,1.00,2.00
102 2.00,.00,.00,1.00,.00,1.00
103 3.00,.00,1.00,.00,.00,1.00
104 Total,1.00,1.00,1.00,1.00,4.00
108 AT_SETUP([CROSSTABS crash])
109 AT_DATA([crosstabs.sps],
130 CROSSTABS TABLES y by z.
132 AT_CHECK([pspp -O format=csv crosstabs.sps], [0],
133 [[Table: Reading 1 record from INLINE.
134 Variable,Record,Columns,Format
153 ,Valid,,Missing,,Total,
154 ,N,Percent,N,Percent,N,Percent
155 y * z,9,100.0%,0,0.0%,9,100.0%
157 Table: y * z [count].
166 # Bug #26739, which caused CROSSTABS to crash or to fail to output
167 # chi-square results.
168 AT_SETUP([CROSSTABS chi-square crash])
169 AT_DATA([crosstabs.sps],
170 [[DATA LIST LIST /x * y *.
182 AT_CHECK([pspp -O format=csv crosstabs.sps], [0],
183 [[Table: Reading free-form data from INLINE.
190 ,Valid,,Missing,,Total,
191 ,N,Percent,N,Percent,N,Percent
192 x * y,4,100.0%,0,0.0%,4,100.0%
194 Table: x * y [count].
202 Table: Chi-square tests.
203 Statistic,Value,df,Asymp. Sig. (2-tailed)
204 Pearson Chi-Square,2.00,2,.368
205 Likelihood Ratio,2.77,2,.250
206 Linear-by-Linear Association,.27,1,.602
212 AT_SETUP([CROSSTABS crash with SPLIT FILE])
213 AT_DATA([crosstabs.sps],
214 [data list notable / v0 to v2 1-6 (A)
228 SPLIT FILE SEPARATE BY v0.
232 /FORMAT=AVALUE TABLES PIVOT
234 /CELLS=COUNT ROW COLUMN TOTAL.
237 AT_CHECK([pspp -O format=csv crosstabs.sps], [0],
238 [[Variable,Value,Label
243 ,Valid,,Missing,,Total,
244 ,N,Percent,N,Percent,N,Percent
245 v1 * v2,6,100.0%,0,0.0%,6,100.0%
247 "Table: v1 * v2 [count, row %, column %, total %]."
251 ,75.00%,25.00%,100.00%
252 ,75.00%,50.00%,66.67%
253 ,50.00%,16.67%,66.67%
255 ,50.00%,50.00%,100.00%
256 ,25.00%,50.00%,33.33%
257 ,16.67%,16.67%,33.33%
259 ,66.67%,33.33%,100.00%
260 ,100.00%,100.00%,100.00%
261 ,66.67%,33.33%,100.00%
263 Table: Chi-square tests.
264 Statistic,Value,df,Asymp. Sig. (2-tailed),Exact Sig. (2-tailed),Exact Sig. (1-tailed)
265 Pearson Chi-Square,.38,1,.540,,
266 Likelihood Ratio,.37,1,.545,,
267 Fisher's Exact Test,,,,1.000,.600
268 Continuity Correction,.00,1,1.000,,
269 N of Valid Cases,6,,,,
276 ,Valid,,Missing,,Total,
277 ,N,Percent,N,Percent,N,Percent
278 v1 * v2,4,100.0%,0,0.0%,4,100.0%
280 "Table: v1 * v2 [count, row %, column %, total %]."
284 ,.00%,100.00%,100.00%
288 ,33.33%,66.67%,100.00%
289 ,100.00%,66.67%,75.00%
290 ,25.00%,50.00%,75.00%
292 ,25.00%,75.00%,100.00%
293 ,100.00%,100.00%,100.00%
294 ,25.00%,75.00%,100.00%
296 Table: Chi-square tests.
297 Statistic,Value,df,Asymp. Sig. (2-tailed),Exact Sig. (2-tailed),Exact Sig. (1-tailed)
298 Pearson Chi-Square,.44,1,.505,,
299 Likelihood Ratio,.68,1,.410,,
300 Fisher's Exact Test,,,,1.000,.750
301 Continuity Correction,.00,1,1.000,,
302 N of Valid Cases,4,,,,
307 AT_SETUP([3-way CROSSTABS])
308 AT_DATA([crosstabs.sps],
329 CROSSTABS TABLES x BY y BY z/STATISTICS=ALL.
331 AT_CHECK([pspp -O format=csv crosstabs.sps], [0],
332 [[Table: Reading 1 record from INLINE.
333 Variable,Record,Columns,Format
352 ,Valid,,Missing,,Total,
353 ,N,Percent,N,Percent,N,Percent
354 x * y * z,9,100.0%,0,0.0%,9,100.0%
356 Table: x * y * z [count].
364 Total,,4.00,1.00,5.00
369 Total,,3.00,1.00,4.00
371 Table: Chi-square tests.
372 z,Statistic,Value,df,Asymp. Sig. (2-tailed)
373 1,Pearson Chi-Square,5.00,4,.287
374 ,Likelihood Ratio,5.00,4,.287
375 ,Linear-by-Linear Association,.01,1,.938
376 ,N of Valid Cases,5,,
377 2,Pearson Chi-Square,4.00,3,.261
378 ,Likelihood Ratio,4.50,3,.212
379 ,Linear-by-Linear Association,1.58,1,.209
380 ,N of Valid Cases,4,,
382 Table: Symmetric measures.
383 z,Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
384 1,Nominal by Nominal,Phi,1.00,,,
386 ,,Contingency Coefficient,.71,,,
387 ,Ordinal by Ordinal,Kendall's tau-b,.00,.32,.00,
388 ,,Kendall's tau-c,.00,.32,.00,
390 ,,Spearman Correlation,.00,.22,.00,
391 ,Interval by Interval,Pearson's R,.04,.22,.07,
392 ,N of Valid Cases,,5,,,
393 2,Nominal by Nominal,Phi,1.00,,,
395 ,,Contingency Coefficient,.71,,,
396 ,Ordinal by Ordinal,Kendall's tau-b,-.71,.20,-1.73,
397 ,,Kendall's tau-c,-.75,.43,-1.73,
398 ,,Gamma,-1.00,.00,-1.73,
399 ,,Spearman Correlation,-.77,.17,-1.73,
400 ,Interval by Interval,Pearson's R,-.73,.18,-1.49,
401 ,N of Valid Cases,,4,,,
403 Table: Directional measures.
404 z,Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
405 1,Nominal by Nominal,Lambda,Symmetric,.40,.28,1.12,.264
406 ,,,x Dependent,.25,.22,1.12,.264
407 ,,,y Dependent,1.00,.00,1.12,.264
408 ,,Goodman and Kruskal tau,x Dependent,.25,,,. @&t@
409 ,,,y Dependent,1.00,,,. @&t@
410 ,,Uncertainty Coefficient,Symmetric,.47,.18,,. @&t@
411 ,,,x Dependent,.31,.15,2.02,. @&t@
412 ,,,y Dependent,1.00,.00,2.02,. @&t@
413 ,Ordinal by Ordinal,Somers' d,Symmetric,.00,,.00,1.000
414 ,,,x Dependent,.00,.50,.00,1.000
415 ,,,y Dependent,.00,.20,.00,1.000
416 ,Nominal by Interval,Eta,x Dependent,.04,,,. @&t@
417 ,,,y Dependent,1.00,,,. @&t@
418 2,Nominal by Nominal,Lambda,Symmetric,.50,.25,2.00,.046
419 ,,,x Dependent,.33,.27,1.15,.248
420 ,,,y Dependent,1.00,.00,1.15,.248
421 ,,Goodman and Kruskal tau,x Dependent,.33,,,. @&t@
422 ,,,y Dependent,1.00,,,. @&t@
423 ,,Uncertainty Coefficient,Symmetric,.58,.17,,. @&t@
424 ,,,x Dependent,.41,.17,2.36,. @&t@
425 ,,,y Dependent,1.00,.00,2.36,. @&t@
426 ,Ordinal by Ordinal,Somers' d,Symmetric,-.67,,-1.73,.083
427 ,,,x Dependent,-1.00,.00,-1.73,.083
428 ,,,y Dependent,-.50,.29,-1.73,.083
429 ,Nominal by Interval,Eta,x Dependent,.73,,,. @&t@
430 ,,,y Dependent,1.00,,,. @&t@
434 AT_SETUP([CROSSTABS rounding weights with COUNT])
435 AT_DATA([crosstabs.sps],
436 [[DATA LIST NOTABLE LIST /x y w.
447 * These should have the same effect (no rounding).
448 CROSSTABS /TABLES x BY y.
449 CROSSTABS /TABLES x BY y /COUNT ASIS.
451 * Round input weights.
452 CROSSTABS /TABLES x BY y /COUNT CASE ROUND.
453 CROSSTABS /TABLES x BY y /COUNT CASE TRUNCATE.
455 * Round cell weights.
456 CROSSTABS /TABLES x BY y /COUNT.
457 CROSSTABS /TABLES x BY y /COUNT TRUNCATE.
460 AT_CHECK([pspp -O format=csv crosstabs.sps], [0],
463 ,Valid,,Missing,,Total,
464 ,N,Percent,N,Percent,N,Percent
465 x * y,9.00,100.0%,.00,0.0%,9.00,100.0%
467 Table: x * y [count].
476 ,Valid,,Missing,,Total,
477 ,N,Percent,N,Percent,N,Percent
478 x * y,9.00,100.0%,.00,0.0%,9.00,100.0%
480 Table: x * y [count].
489 ,Valid,,Missing,,Total,
490 ,N,Percent,N,Percent,N,Percent
491 x * y,9.00,100.0%,.00,0.0%,9.00,100.0%
493 Table: x * y [count].
502 ,Valid,,Missing,,Total,
503 ,N,Percent,N,Percent,N,Percent
504 x * y,7.00,100.0%,.00,0.0%,7.00,100.0%
506 Table: x * y [count].
515 ,Valid,,Missing,,Total,
516 ,N,Percent,N,Percent,N,Percent
517 x * y,9.00,100.0%,.00,0.0%,9.00,100.0%
519 Table: x * y [count].
528 ,Valid,,Missing,,Total,
529 ,N,Percent,N,Percent,N,Percent
530 x * y,8.00,100.0%,.00,0.0%,8.00,100.0%
532 Table: x * y [count].
541 AT_SETUP([CROSSTABS descending sort order])
542 AT_DATA([crosstabs-descending.sps],
543 [[DATA LIST NOTABLE LIST /x * y *.
558 AT_CHECK([pspp -O format=csv crosstabs-descending.sps], [0],
561 ,Valid,,Missing,,Total,
562 ,N,Percent,N,Percent,N,Percent
563 x * y,6,100.0%,0,0.0%,6,100.0%
565 Table: x * y [count].
576 AT_SETUP([CROSSTABS crash when all cases missing])
577 AT_DATA([crosstabs.sps], [dnl
578 DATA LIST LIST NOTABLE /X1 X2.
583 MISSING VALUES x2 (1).
585 CROSSTABS /TABLES= X1 by X2.
587 AT_CHECK([pspp -O format=csv crosstabs.sps], [0], [dnl
590 ,Valid,,Missing,,Total,
591 ,N,Percent,N,Percent,N,Percent
592 X1 * X2,0,0.0%,1,100.0%,1,100.0%
594 crosstabs.sps:8: warning: CROSSTABS: Crosstabulation X1 * X2 contained no non-missing cases.
600 dnl This example comes from http://www.ats.ucla.edu/stat/spss/whatstat/whatstat.htm#chisq
601 AT_SETUP([CROSSTABS Fisher Exact Test])
603 AT_DATA([fisher-exact.sps], [dnl
607 DATA LIST notable LIST /schtyp (F9.2) female (F9.2) ses (F9.2) .
811 VARIABLE LABEL schtyp 'type of school'.
812 ADD VALUE LABELS female 0 male 1 female.
813 ADD VALUE LABELS ses 1 low 2 middle 3 high.
814 ADD VALUE LABELS schtyp 1 public 2 private.
816 crosstabs /tables = schtyp by female /statistic = chisq.
817 crosstabs /tables = female by ses /statistic = chisq.
820 AT_CHECK([pspp -O format=csv fisher-exact.sps], [0], [dnl
823 ,Valid,,Missing,,Total,
824 ,N,Percent,N,Percent,N,Percent
825 type of school * female,200,100.0%,0,0.0%,200,100.0%
827 Table: type of school * female [[count]].
829 type of school,male,female,Total
830 public,77.000,91.000,168.000
831 private,14.000,18.000,32.000
832 Total,91.000,109.000,200.000
834 Table: Chi-square tests.
835 Statistic,Value,df,Asymp. Sig. (2-tailed),Exact Sig. (2-tailed),Exact Sig. (1-tailed)
836 Pearson Chi-Square,.047,1,.828,,
837 Likelihood Ratio,.047,1,.828,,
838 Fisher's Exact Test,,,,.849,.492
839 Continuity Correction,.001,1,.981,,
840 Linear-by-Linear Association,.047,1,.829,,
841 N of Valid Cases,200,,,,
845 ,Valid,,Missing,,Total,
846 ,N,Percent,N,Percent,N,Percent
847 female * ses,200,100.0%,0,0.0%,200,100.0%
849 Table: female * ses [[count]].
851 female,low,middle,high,Total
852 male,15.000,47.000,29.000,91.000
853 female,32.000,48.000,29.000,109.000
854 Total,47.000,95.000,58.000,200.000
856 Table: Chi-square tests.
857 Statistic,Value,df,Asymp. Sig. (2-tailed)
858 Pearson Chi-Square,4.577,2,.101
859 Likelihood Ratio,4.679,2,.096
860 Linear-by-Linear Association,3.110,1,.078
861 N of Valid Cases,200,,
866 AT_SETUP([CROSSTABS Pearson's R])
868 AT_DATA([pearson.sps], [dnl
871 * From http://www.statisticslectures.com/topics/pearsonr/.
880 CROSSTABS x BY y/STATISTICS=CORR.
882 AT_CHECK([pspp -O format=csv pearson.sps], [0], [dnl
885 ,Valid,,Missing,,Total,
886 ,N,Percent,N,Percent,N,Percent
887 x * y,5,100.0%,0,0.0%,5,100.0%
889 Table: x * y [[count]].
891 x,4.000,6.000,10.000,12.000,13.000,Total
892 1.000,1.000,.000,.000,.000,.000,1.000
893 3.000,.000,1.000,.000,.000,.000,1.000
894 5.000,.000,.000,1.000,1.000,.000,2.000
895 6.000,.000,.000,.000,.000,1.000,1.000
896 Total,1.000,1.000,1.000,1.000,1.000,5.000
898 Table: Symmetric measures.
899 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
900 Ordinal by Ordinal,Spearman Correlation,.975,.022,7.550,
901 Interval by Interval,Pearson's R,.968,.017,6.708,
902 N of Valid Cases,,5,,,
906 AT_DATA([pearson2.sps], [dnl
909 * Checked with http://www.socscistatistics.com/tests/pearson/Default2.aspx.
923 CROSSTABS x BY y/STATISTICS=CORR.
925 AT_CHECK([pspp -O format=csv pearson2.sps], [0], [dnl
928 ,Valid,,Missing,,Total,
929 ,N,Percent,N,Percent,N,Percent
930 x * y,10,100.0%,0,0.0%,10,100.0%
932 Table: x * y [[count]].
933 ,y,,,,,,,,,
934 x,1.500,4.000,5.000,6.000,6.500,7.000,9.000,10.500,11.000,Total
935 1.000,1.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000
936 2.000,1.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000
937 3.000,.000,1.000,.000,.000,.000,.000,.000,.000,.000,1.000
938 4.000,.000,.000,.000,1.000,.000,.000,.000,.000,.000,1.000
939 5.000,.000,.000,1.000,.000,.000,.000,.000,.000,.000,1.000
940 6.000,.000,.000,.000,.000,.000,1.000,.000,.000,.000,1.000
941 7.000,.000,.000,.000,.000,1.000,.000,.000,.000,.000,1.000
942 8.000,.000,.000,.000,.000,.000,.000,1.000,.000,.000,1.000
943 9.000,.000,.000,.000,.000,.000,.000,.000,1.000,.000,1.000
944 10.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000,1.000
945 Total,2.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,10.000
947 Table: Symmetric measures.
948 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
949 Ordinal by Ordinal,Spearman Correlation,.973,.015,11.844,
950 Interval by Interval,Pearson's R,.971,.017,11.580,
951 N of Valid Cases,,10,,,
955 AT_DATA([pearson3.sps], [dnl
958 * From http://learntech.uwe.ac.uk/da/Default.aspx?pageid=1442.
971 CROSSTABS x BY y/STATISTICS=CORR.
973 AT_CHECK([pspp -O format=csv pearson3.sps], [0], [dnl
976 ,Valid,,Missing,,Total,
977 ,N,Percent,N,Percent,N,Percent
978 x * y,9,100.0%,0,0.0%,9,100.0%
980 Table: x * y [[count]].
982 x,28.000,58.000,66.000,75.000,85.000,87.000,91.000,122.000,Total
983 25.000,1.000,.000,.000,.000,.000,.000,.000,.000,1.000
984 35.000,.000,1.000,.000,.000,.000,.000,.000,.000,1.000
985 44.000,.000,.000,1.000,.000,.000,.000,.000,.000,1.000
986 50.000,.000,.000,.000,1.000,.000,.000,.000,.000,1.000
987 56.000,.000,.000,.000,.000,.000,1.000,1.000,.000,2.000
988 65.000,.000,.000,.000,.000,1.000,.000,1.000,.000,2.000
989 87.000,.000,.000,.000,.000,.000,.000,.000,1.000,1.000
990 Total,1.000,1.000,1.000,1.000,1.000,1.000,2.000,1.000,9.000
992 Table: Symmetric measures.
993 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
994 Ordinal by Ordinal,Spearman Correlation,.911,.068,5.860,
995 Interval by Interval,Pearson's R,.966,.017,9.915,
996 N of Valid Cases,,9,,,
1000 AT_DATA([pearson4.sps], [dnl
1003 * From http://psychology.ucdavis.edu/faculty_sites/sommerb/sommerdemo/correlation/hand/pearson_hand.htm.
1019 CROSSTABS x BY y/STATISTICS=CORR.
1021 AT_CHECK([pspp -O format=csv pearson4.sps], [0], [dnl
1024 ,Valid,,Missing,,Total,
1025 ,N,Percent,N,Percent,N,Percent
1026 x * y,12,100.0%,0,0.0%,12,100.0%
1028 Table: x * y [[count]].
1029 ,y,,,,,,,,,,,,
1030 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
1031 2.000,.000,.000,.000,1.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000
1032 3.000,.000,.000,.000,.000,.000,.000,1.000,.000,.000,.000,.000,.000,1.000
1033 4.000,.000,.000,.000,.000,1.000,1.000,.000,.000,.000,.000,.000,.000,2.000
1034 5.000,.000,.000,1.000,.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000
1035 6.000,1.000,1.000,.000,.000,.000,.000,.000,.000,.000,.000,.000,.000,2.000
1036 7.000,.000,.000,.000,.000,.000,.000,.000,1.000,.000,.000,.000,.000,1.000
1037 8.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000,.000,.000,.000,1.000
1038 9.000,.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000,.000,.000,1.000
1039 10.000,.000,.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000,1.000,2.000
1040 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
1042 Table: Symmetric measures.
1043 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1044 Ordinal by Ordinal,Spearman Correlation,.657,.140,2.758,
1045 Interval by Interval,Pearson's R,.667,.132,2.830,
1046 N of Valid Cases,,12,,,
1050 AT_DATA([pearson5.sps], [dnl
1053 * From http://www.statisticslectures.com/topics/pearsonr/.
1067 CROSSTABS x BY y/STATISTICS=CORR.
1069 AT_CHECK([pspp -O format=csv pearson5.sps], [0], [dnl
1072 ,Valid,,Missing,,Total,
1073 ,N,Percent,N,Percent,N,Percent
1074 x * y,10,100.0%,0,0.0%,10,100.0%
1076 Table: x * y [[count]].
1077 ,y,,,,,,,,,,
1078 x,15000.000,26000.000,29000.000,32000.000,33000.000,41000.000,45000.000,52000.000,68000.000,80000.000,Total
1079 18.000,1.000,.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000
1080 24.000,.000,1.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000
1081 25.000,.000,.000,1.000,.000,.000,.000,.000,.000,.000,.000,1.000
1082 26.000,.000,.000,.000,1.000,.000,.000,.000,.000,.000,.000,1.000
1083 33.000,.000,.000,.000,.000,1.000,.000,.000,.000,.000,.000,1.000
1084 37.000,.000,.000,.000,.000,.000,1.000,.000,.000,.000,.000,1.000
1085 40.000,.000,.000,.000,.000,.000,.000,1.000,.000,.000,.000,1.000
1086 45.000,.000,.000,.000,.000,.000,.000,.000,1.000,.000,.000,1.000
1087 57.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000,.000,1.000
1088 64.000,.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000,1.000
1089 Total,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,10.000
1091 Table: Symmetric measures.
1092 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1093 Ordinal by Ordinal,Spearman Correlation,1.000,.000,+Infinity,
1094 Interval by Interval,Pearson's R,.992,.004,22.638,
1095 N of Valid Cases,,10,,,
1099 AT_SETUP([CROSSTABS Goodman and Kruskal's lambda])
1100 AT_DATA([lambda.sps], [dnl
1103 * From http://www.csupomona.edu/~jlkorey/POWERMUTT/Topics/contingency_tables.html.
1104 DATA LIST LIST NOTABLE/x y w.
1115 CROSSTABS x BY y/CELLS=NONE/STATISTICS=LAMBDA.
1117 * From http://vassarstats.net.
1118 DATA LIST LIST NOTABLE/x y w.
1132 CROSSTABS x BY y/CELLS=NONE/STATISTICS=LAMBDA.
1134 * From Goodman, L.A., Kruskal, W.H. (1954) "Measures of association for
1135 cross classifications". Part I. Journal of the American Statistical
1136 Association, 49, 732-764.
1137 DATA LIST LIST NOTABLE/x y w.
1153 CROSSTABS x BY y/CELLS=NONE/STATISTICS=LAMBDA.
1155 AT_CHECK([pspp -O format=csv lambda.sps], [0], [dnl
1158 ,Valid,,Missing,,Total,
1159 ,N,Percent,N,Percent,N,Percent
1160 x * y,1296.000,100.0%,.000,0.0%,1296.000,100.0%
1162 Table: Directional measures.
1163 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1164 Nominal by Nominal,Lambda,Symmetric,.423,.021,16.875,.000
1165 ,,x Dependent,.497,.024,15.986,.000
1166 ,,y Dependent,.370,.020,16.339,.000
1167 ,Goodman and Kruskal tau,x Dependent,.382,,,. @&t@
1168 ,,y Dependent,.198,,,. @&t@
1172 ,Valid,,Missing,,Total,
1173 ,N,Percent,N,Percent,N,Percent
1174 x * y,137.000,100.0%,.000,0.0%,137.000,100.0%
1176 Table: Directional measures.
1177 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1178 Nominal by Nominal,Lambda,Symmetric,.259,.081,2.902,.004
1179 ,,x Dependent,.250,.089,2.479,.013
1180 ,,y Dependent,.267,.085,2.766,.006
1181 ,Goodman and Kruskal tau,x Dependent,.129,,,. @&t@
1182 ,,y Dependent,.123,,,. @&t@
1186 ,Valid,,Missing,,Total,
1187 ,N,Percent,N,Percent,N,Percent
1188 x * y,6800.000,100.0%,.000,0.0%,6800.000,100.0%
1190 Table: Directional measures.
1191 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1192 Nominal by Nominal,Lambda,Symmetric,.208,.010,18.793,.000
1193 ,,x Dependent,.224,.013,16.076,.000
1194 ,,y Dependent,.192,.012,14.438,.000
1195 ,Goodman and Kruskal tau,x Dependent,.089,,,. @&t@
1196 ,,y Dependent,.081,,,. @&t@
1200 AT_SETUP([CROSSTABS Goodman and Kruskal's lambda - treatment of ties])
1201 AT_DATA([lambda.sps], [dnl
1204 * From Douglas Bonett.
1205 DATA LIST LIST NOTABLE/x y w.
1216 CROSSTABS x BY y/CELLS=NONE/STATISTICS=LAMBDA.
1218 AT_CHECK([pspp -O format=csv lambda.sps], [0], [dnl
1221 ,Valid,,Missing,,Total,
1222 ,N,Percent,N,Percent,N,Percent
1223 x * y,500.000,100.0%,.000,0.0%,500.000,100.0%
1225 Table: Directional measures.
1226 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1227 Nominal by Nominal,Lambda,Symmetric,.031,.013,2.336,.019
1228 ,,x Dependent,.000,.000,NaN,NaN
1229 ,,y Dependent,.033,.014,2.336,.019
1230 ,Goodman and Kruskal tau,x Dependent,.012,,,. @&t@
1231 ,,y Dependent,.009,,,. @&t@
1235 AT_SETUP([CROSSTABS Somers' D, Tau-B, Tau-C, Gamma])
1236 AT_DATA([somersd.sps], [dnl
1239 * From http://stats.stackexchange.com/questions/72203/problem-with-calculating-asymptotic-standard-error-for-somers-d.
1240 DATA LIST LIST NOTABLE/x y * w (F10.6).
1258 CROSSTABS x BY y/STATISTICS=D/CELLS=NONE.
1260 * From http://uregina.ca/~gingrich/gamma.pdf.
1261 DATA LIST LIST NOTABLE/x y w.
1274 CROSSTABS x BY y/STATISTICS=BTAU CTAU GAMMA D/CELLS=NONE.
1276 AT_CHECK([pspp -O format=csv somersd.sps], [0], [dnl
1279 ,Valid,,Missing,,Total,
1280 ,N,Percent,N,Percent,N,Percent
1281 x * y,1.000000,100.0%,.000000,0.0%,1.000000,100.0%
1283 Table: Directional measures.
1284 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1285 Ordinal by Ordinal,Somers' d,Symmetric,-.084,,-.149,.882
1286 ,,x Dependent,-.045,.300,-.149,.882
1287 ,,y Dependent,-.684,2.378,-.149,.882
1291 ,Valid,,Missing,,Total,
1292 ,N,Percent,N,Percent,N,Percent
1293 x * y,687.000,100.0%,.000,0.0%,687.000,100.0%
1295 Table: Symmetric measures.
1296 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1297 Ordinal by Ordinal,Kendall's tau-b,.372,.033,10.669,
1298 ,Kendall's tau-c,.310,.029,10.669,
1299 ,Gamma,.591,.043,10.669,
1300 N of Valid Cases,,687.000,,,
1302 Table: Directional measures.
1303 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1304 Ordinal by Ordinal,Somers' d,Symmetric,.371,,10.669,.000
1305 ,,x Dependent,.351,.032,10.669,.000
1306 ,,y Dependent,.394,.035,10.669,.000
1309 AT_DATA([ordinal.sps], [dnl
1312 * From https://www.iup.edu/WorkArea/DownloadAsset.aspx?id=9829, "Case 1".
1313 DATA LIST LIST NOTABLE /x y w.
1320 CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
1322 * Same site, case 2.
1323 DATA LIST LIST NOTABLE /x y w.
1330 CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
1332 * Same site, case 3.
1333 DATA LIST LIST NOTABLE /x y w.
1340 CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
1342 * Same site, case 4.
1343 DATA LIST LIST NOTABLE /x y w.
1351 CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
1353 * Same site, case 5.
1354 DATA LIST LIST NOTABLE /x y w.
1362 CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
1364 * Same site, case 6.
1365 DATA LIST LIST NOTABLE /x y w.
1377 CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
1379 * Same site, case 7.
1380 DATA LIST LIST NOTABLE /x y w.
1392 CROSSTABS x BY y/STATISTICS=LAMBDA D PHI GAMMA/CELLS=NONE.
1394 * Same site, case 8.
1395 DATA LIST LIST NOTABLE /x y w.
1415 CROSSTABS x BY y/STATISTICS=LAMBDA D PHI BTAU/CELLS=NONE.
1417 AT_CHECK([pspp -O format=csv ordinal.sps], [0], [dnl
1420 ,Valid,,Missing,,Total,
1421 ,N,Percent,N,Percent,N,Percent
1422 x * y,150.000,100.0%,.000,0.0%,150.000,100.0%
1424 Table: Symmetric measures.
1425 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1426 Ordinal by Ordinal,Kendall's tau-b,1.000,.000,24.841,
1427 ,Gamma,1.000,.000,24.841,
1428 N of Valid Cases,,150.000,,,
1430 Table: Directional measures.
1431 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1432 Ordinal by Ordinal,Somers' d,Symmetric,1.000,,24.841,.000
1433 ,,x Dependent,1.000,.000,24.841,.000
1434 ,,y Dependent,1.000,.000,24.841,.000
1438 ,Valid,,Missing,,Total,
1439 ,N,Percent,N,Percent,N,Percent
1440 x * y,150.000,100.0%,.000,0.0%,150.000,100.0%
1442 Table: Symmetric measures.
1443 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1444 Ordinal by Ordinal,Kendall's tau-b,1.000,.000,24.841,
1445 ,Gamma,1.000,.000,24.841,
1446 N of Valid Cases,,150.000,,,
1448 Table: Directional measures.
1449 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1450 Ordinal by Ordinal,Somers' d,Symmetric,1.000,,24.841,.000
1451 ,,x Dependent,1.000,.000,24.841,.000
1452 ,,y Dependent,1.000,.000,24.841,.000
1456 ,Valid,,Missing,,Total,
1457 ,N,Percent,N,Percent,N,Percent
1458 x * y,150.000,100.0%,.000,0.0%,150.000,100.0%
1460 Table: Symmetric measures.
1461 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1462 Ordinal by Ordinal,Kendall's tau-b,-1.000,.000,-24.841,
1463 ,Gamma,-1.000,.000,-24.841,
1464 N of Valid Cases,,150.000,,,
1466 Table: Directional measures.
1467 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1468 Ordinal by Ordinal,Somers' d,Symmetric,-1.000,,-24.841,.000
1469 ,,x Dependent,-1.000,.000,-24.841,.000
1470 ,,y Dependent,-1.000,.000,-24.841,.000
1474 ,Valid,,Missing,,Total,
1475 ,N,Percent,N,Percent,N,Percent
1476 x * y,150.000,100.0%,.000,0.0%,150.000,100.0%
1478 Table: Symmetric measures.
1479 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1480 Ordinal by Ordinal,Kendall's tau-b,.972,.007,24.841,
1481 ,Gamma,1.000,.000,24.841,
1482 N of Valid Cases,,150.000,,,
1484 Table: Directional measures.
1485 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1486 Ordinal by Ordinal,Somers' d,Symmetric,.971,,24.841,.000
1487 ,,x Dependent,.944,.013,24.841,.000
1488 ,,y Dependent,1.000,.000,24.841,.000
1492 ,Valid,,Missing,,Total,
1493 ,N,Percent,N,Percent,N,Percent
1494 x * y,150.000,100.0%,.000,0.0%,150.000,100.0%
1496 Table: Symmetric measures.
1497 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1498 Ordinal by Ordinal,Kendall's tau-b,.119,.059,1.009,
1499 ,Gamma,1.000,.000,1.009,
1500 N of Valid Cases,,150.000,,,
1502 Table: Directional measures.
1503 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1504 Ordinal by Ordinal,Somers' d,Symmetric,.035,,1.009,.313
1505 ,,x Dependent,.805,.032,1.009,.313
1506 ,,y Dependent,.018,.017,1.009,.313
1510 ,Valid,,Missing,,Total,
1511 ,N,Percent,N,Percent,N,Percent
1512 x * y,148.000,100.0%,.000,0.0%,148.000,100.0%
1514 Table: Symmetric measures.
1515 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1516 Ordinal by Ordinal,Kendall's tau-b,-.208,.078,-2.641,
1517 ,Gamma,-.381,.130,-2.641,
1518 N of Valid Cases,,148.000,,,
1520 Table: Directional measures.
1521 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1522 Ordinal by Ordinal,Somers' d,Symmetric,-.206,,-2.641,.008
1523 ,,x Dependent,-.182,.069,-2.641,.008
1524 ,,y Dependent,-.237,.089,-2.641,.008
1528 ,Valid,,Missing,,Total,
1529 ,N,Percent,N,Percent,N,Percent
1530 x * y,148.000,100.0%,.000,0.0%,148.000,100.0%
1532 Table: Symmetric measures.
1533 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1534 Nominal by Nominal,Phi,.731,,,
1536 Ordinal by Ordinal,Gamma,-.110,.107,-1.022,
1537 N of Valid Cases,,148.000,,,
1539 Table: Directional measures.
1540 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1541 Nominal by Nominal,Lambda,Symmetric,.338,.059,4.743,.000
1542 ,,x Dependent,.640,.085,4.875,.000
1543 ,,y Dependent,.174,.050,3.248,.001
1544 ,Goodman and Kruskal tau,x Dependent,.534,,,. @&t@
1545 ,,y Dependent,.167,,,. @&t@
1546 Ordinal by Ordinal,Somers' d,Symmetric,-.074,,-1.022,.307
1547 ,,x Dependent,-.060,.059,-1.022,.307
1548 ,,y Dependent,-.096,.094,-1.022,.307
1552 ,Valid,,Missing,,Total,
1553 ,N,Percent,N,Percent,N,Percent
1554 x * y,212.000,100.0%,.000,0.0%,212.000,100.0%
1556 Table: Symmetric measures.
1557 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1558 Nominal by Nominal,Phi,.432,,,
1560 Ordinal by Ordinal,Kendall's tau-b,.209,.062,3.338,
1561 N of Valid Cases,,212.000,,,
1563 Table: Directional measures.
1564 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1565 Nominal by Nominal,Lambda,Symmetric,.102,.067,1.473,.141
1566 ,,x Dependent,.027,.087,.302,.763
1567 ,,y Dependent,.165,.065,2.349,.019
1568 ,Goodman and Kruskal tau,x Dependent,.051,,,. @&t@
1569 ,,y Dependent,.068,,,. @&t@
1570 Ordinal by Ordinal,Somers' d,Symmetric,.209,,3.338,.001
1571 ,,x Dependent,.202,.060,3.338,.001
1572 ,,y Dependent,.217,.064,3.338,.001
1576 AT_SETUP([CROSSTABS Cohens Kappa])
1578 dnl Example from Wood J. M.
1579 dnl "Understanding and Computing Cohen's Kappa: A Tutorial"
1580 dnl WebPsychEmpiricist. Oct 3 2007
1581 AT_DATA([kappa.sps], [dnl
1584 data list notable list /p1 * p2 * w *.
1593 crosstabs /table = p1 by p2
1598 AT_CHECK([pspp -O format=csv kappa.sps], [0], [dnl
1601 ,Valid,,Missing,,Total,
1602 ,N,Percent,N,Percent,N,Percent
1603 p1 * p2,20.000,100.0%,.000,0.0%,20.000,100.0%
1605 Table: p1 * p2 [[count]].
1608 .000,18.000,1.000,19.000
1609 1.000,1.000,.000,1.000
1610 Total,19.000,1.000,20.000
1612 Table: Symmetric measures.
1613 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1614 Measure of Agreement,Kappa,-.053,.037,-.235,
1615 N of Valid Cases,,20.000,,,
1621 AT_SETUP([CROSSTABS many statistics])
1622 AT_DATA([crosstabs.sps], [dnl
1625 * From http://www4.stat.ncsu.edu/~dzhang2/st744/table3.9.lst.txt.
1626 DATA LIST LIST NOTABLE/x y w.
1635 CROSSTABS x BY y/STATISTICS=CHISQ PHI CC LAMBDA UC BTAU CTAU GAMMA D CORR/CELLS=NONE.
1637 AT_CHECK([pspp -O format=csv crosstabs.sps], [0], [dnl
1640 ,Valid,,Missing,,Total,
1641 ,N,Percent,N,Percent,N,Percent
1642 x * y,66.0000,100.0%,.0000,0.0%,66.0000,100.0%
1644 Table: Chi-square tests.
1645 Statistic,Value,df,Asymp. Sig. (2-tailed)
1646 Pearson Chi-Square,6.9562,2.0000,.031
1647 Likelihood Ratio,6.6901,2.0000,.035
1648 Linear-by-Linear Association,5.8450,1.0000,.016
1649 N of Valid Cases,66.0000,,
1651 Table: Symmetric measures.
1652 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1653 Nominal by Nominal,Phi,.3246,,,
1654 ,Cramer's V,.3246,,,
1655 ,Contingency Coefficient,.3088,,,
1656 Ordinal by Ordinal,Kendall's tau-b,.2752,.0856,1.9920,
1657 ,Kendall's tau-c,.1497,.0751,1.9920,
1658 ,Gamma,.8717,.1250,1.9920,
1659 ,Spearman Correlation,.2908,.0906,2.4311,
1660 Interval by Interval,Pearson's R,.2999,.0973,2.5147,
1661 N of Valid Cases,,66.0000,,,
1663 Table: Directional measures.
1664 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1665 Nominal by Nominal,Lambda,Symmetric,.0455,.1629,.2723,.785
1666 ,,x Dependent,.0000,.0000,NaN,NaN
1667 ,,y Dependent,.0500,.1791,.2723,.785
1668 ,Goodman and Kruskal tau,x Dependent,.1054,,,. @&t@
1669 ,,y Dependent,.0434,,,. @&t@
1670 ,Uncertainty Coefficient,Symmetric,.0780,.0474,,. @&t@
1671 ,,x Dependent,.2217,.1062,1.5373,. @&t@
1672 ,,y Dependent,.0473,.0306,1.5373,. @&t@
1673 Ordinal by Ordinal,Somers' d,Symmetric,.1960,,1.9920,.046
1674 ,,x Dependent,.1152,.0572,1.9920,.046
1675 ,,y Dependent,.6573,.1417,1.9920,.046
1679 AT_SETUP([CROSSTABS uncertainy coefficient])
1680 AT_DATA([uc.sps], [dnl
1681 * From http://groups.chass.utoronto.ca/pol242/5bMeasuringAssociation.htm.
1684 DATA LIST LIST NOTABLE/x y w.
1694 CROSSTABS x BY y/STATISTICS=LAMBDA UC/CELLS=NONE.
1696 AT_CHECK([pspp -O format=csv uc.sps], [0], [dnl
1699 ,Valid,,Missing,,Total,
1700 ,N,Percent,N,Percent,N,Percent
1701 x * y,987.000,100.0%,.000,0.0%,987.000,100.0%
1703 Table: Directional measures.
1704 Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
1705 Nominal by Nominal,Lambda,Symmetric,.000,.000,NaN,NaN
1706 ,,x Dependent,.000,.000,NaN,NaN
1707 ,,y Dependent,.000,.000,NaN,NaN
1708 ,Goodman and Kruskal tau,x Dependent,.076,,,. @&t@
1709 ,,y Dependent,.108,,,. @&t@
1710 ,Uncertainty Coefficient,Symmetric,.105,.012,,. @&t@
1711 ,,x Dependent,.073,.009,7.890,. @&t@
1712 ,,y Dependent,.184,.019,7.890,. @&t@
1718 AT_SETUP([CROSSTABS barchart])
1719 AT_DATA([bc.sps], [dnl
1722 DATA LIST LIST NOTABLE /x (a20) y (f8) z (f8) w (f8) .
1746 AT_CHECK([pspp -O format=txt -o xxx bc.sps], [0], [ignore])
1748 AT_CHECK([test -e xxx-1.png], [0], [ignore])
1749 AT_CHECK([test -e xxx-2.png], [0], [ignore])
1751 AT_CHECK([diff xxx-1.png xxx-2.png], [0], [ignore])