CROSSTABS: Don't calculate ASE for symmetric Somers' d.
[pspp] / tests / language / stats / crosstabs.at
index 4dbd0bdc78e3ea554e45872007b745955d5c14e7..c33857b8f2eaa45805efdc847765b5b4d0fad8ca 100644 (file)
@@ -362,7 +362,7 @@ z,Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
 ,,Kendall's tau-c,.00,.32,.00,
 ,,Gamma,.00,.50,.00,
 ,,Spearman Correlation,.00,.22,.00,
-,Interval by Interval,Pearson's R,.04,.22,.18,
+,Interval by Interval,Pearson's R,.04,.22,.07,
 ,N of Valid Cases,,5,,,
 2,Nominal by Nominal,Phi,1.00,,,
 ,,Cramer's V,1.00,,,
@@ -370,34 +370,34 @@ z,Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
 ,Ordinal by Ordinal,Kendall's tau-b,-.71,.20,-1.73,
 ,,Kendall's tau-c,-.75,.43,-1.73,
 ,,Gamma,-1.00,.00,-1.73,
-,,Spearman Correlation,-.77,.17,-6.77,
-,Interval by Interval,Pearson's R,-.73,.18,-5.49,
+,,Spearman Correlation,-.77,.17,-1.73,
+,Interval by Interval,Pearson's R,-.73,.18,-1.49,
 ,N of Valid Cases,,4,,,
 
 Table: Directional measures.
 z,Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
-1,Nominal by Nominal,Lambda,Symmetric,.40,.28,1.02,
-,,,x Dependent,.25,NaN,1.12,
-,,,y Dependent,1.00,NaN,1.12,
+1,Nominal by Nominal,Lambda,Symmetric,.40,.28,1.12,
+,,,x Dependent,.25,,1.12,
+,,,y Dependent,1.00,,1.12,
 ,,Goodman and Kruskal tau,x Dependent,.25,,,
 ,,,y Dependent,1.00,,,
 ,,Uncertainty Coefficient,Symmetric,.47,.18,1.51,
 ,,,x Dependent,.31,.15,2.02,
 ,,,y Dependent,1.00,.00,2.02,
-,Ordinal by Ordinal,Somers' d,Symmetric,.00,.09,.00,
+,Ordinal by Ordinal,Somers' d,Symmetric,.00,,.00,
 ,,,x Dependent,.00,.50,.00,
 ,,,y Dependent,.00,.20,.00,
 ,Nominal by Interval,Eta,x Dependent,.04,,,
 ,,,y Dependent,1.00,,,
-2,Nominal by Nominal,Lambda,Symmetric,.50,.25,1.51,
-,,,x Dependent,.33,NaN,1.15,
-,,,y Dependent,1.00,NaN,1.15,
+2,Nominal by Nominal,Lambda,Symmetric,.50,.25,2.00,
+,,,x Dependent,.33,,1.15,
+,,,y Dependent,1.00,,1.15,
 ,,Goodman and Kruskal tau,x Dependent,.33,,,
 ,,,y Dependent,1.00,,,
 ,,Uncertainty Coefficient,Symmetric,.58,.17,1.56,
 ,,,x Dependent,.41,.17,2.36,
 ,,,y Dependent,1.00,.00,2.36,
-,Ordinal by Ordinal,Somers' d,Symmetric,-.67,.04,-1.73,
+,Ordinal by Ordinal,Somers' d,Symmetric,-.67,,-1.73,
 ,,,x Dependent,-1.00,.00,-1.73,
 ,,,y Dependent,-.50,.29,-1.73,
 ,Nominal by Interval,Eta,x Dependent,.73,,,
@@ -735,6 +735,8 @@ AT_CLEANUP
 AT_SETUP([CROSSTABS Pearson's R])
 # Test 1.
 AT_DATA([pearson.sps], [dnl
+SET FORMAT F8.3.
+
 * From http://www.statisticslectures.com/topics/pearsonr/.
 DATA LIST FREE/x y.
 BEGIN DATA.
@@ -755,22 +757,24 @@ x * y,5,100.0%,0,0.0%,5,100.0%
 
 Table: x * y [[count]].
 ,y,,,,,
-x,4.00,6.00,10.00,12.00,13.00,Total
-1.00,1.00,.00,.00,.00,.00,1.00
-3.00,.00,1.00,.00,.00,.00,1.00
-5.00,.00,.00,1.00,1.00,.00,2.00
-6.00,.00,.00,.00,.00,1.00,1.00
-Total,1.00,1.00,1.00,1.00,1.00,5.00
+x,4.000,6.000,10.000,12.000,13.000,Total
+1.000,1.000,.000,.000,.000,.000,1.000
+3.000,.000,1.000,.000,.000,.000,1.000
+5.000,.000,.000,1.000,1.000,.000,2.000
+6.000,.000,.000,.000,.000,1.000,1.000
+Total,1.000,1.000,1.000,1.000,1.000,5.000
 
 Table: Symmetric measures.
 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
-Ordinal by Ordinal,Spearman Correlation,.97,.02,2.84,
-Interval by Interval,Pearson's R,.97,.02,3.36,
+Ordinal by Ordinal,Spearman Correlation,.975,.022,7.550,
+Interval by Interval,Pearson's R,.968,.017,6.708,
 N of Valid Cases,,5,,,
 ])
 
 # Test 2.
 AT_DATA([pearson2.sps], [dnl
+SET FORMAT F8.3.
+
 * Checked with http://www.socscistatistics.com/tests/pearson/Default2.aspx.
 DATA LIST FREE/x y.
 BEGIN DATA.
@@ -796,28 +800,30 @@ x * y,10,100.0%,0,0.0%,10,100.0%
 
 Table: x * y [[count]].
 ,y,,,,,,,,,
-x,1.50,4.00,5.00,6.00,6.50,7.00,9.00,10.50,11.00,Total
-1.00,1.00,.00,.00,.00,.00,.00,.00,.00,.00,1.00
-2.00,1.00,.00,.00,.00,.00,.00,.00,.00,.00,1.00
-3.00,.00,1.00,.00,.00,.00,.00,.00,.00,.00,1.00
-4.00,.00,.00,.00,1.00,.00,.00,.00,.00,.00,1.00
-5.00,.00,.00,1.00,.00,.00,.00,.00,.00,.00,1.00
-6.00,.00,.00,.00,.00,.00,1.00,.00,.00,.00,1.00
-7.00,.00,.00,.00,.00,1.00,.00,.00,.00,.00,1.00
-8.00,.00,.00,.00,.00,.00,.00,1.00,.00,.00,1.00
-9.00,.00,.00,.00,.00,.00,.00,.00,1.00,.00,1.00
-10.00,.00,.00,.00,.00,.00,.00,.00,.00,1.00,1.00
-Total,2.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,10.00
+x,1.500,4.000,5.000,6.000,6.500,7.000,9.000,10.500,11.000,Total
+1.000,1.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000
+2.000,1.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000
+3.000,.000,1.000,.000,.000,.000,.000,.000,.000,.000,1.000
+4.000,.000,.000,.000,1.000,.000,.000,.000,.000,.000,1.000
+5.000,.000,.000,1.000,.000,.000,.000,.000,.000,.000,1.000
+6.000,.000,.000,.000,.000,.000,1.000,.000,.000,.000,1.000
+7.000,.000,.000,.000,.000,1.000,.000,.000,.000,.000,1.000
+8.000,.000,.000,.000,.000,.000,.000,1.000,.000,.000,1.000
+9.000,.000,.000,.000,.000,.000,.000,.000,1.000,.000,1.000
+10.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000,1.000
+Total,2.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,10.000
 
 Table: Symmetric measures.
 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
-Ordinal by Ordinal,Spearman Correlation,.97,.02,3.66,
-Interval by Interval,Pearson's R,.97,.02,3.69,
+Ordinal by Ordinal,Spearman Correlation,.973,.015,11.844,
+Interval by Interval,Pearson's R,.971,.017,11.580,
 N of Valid Cases,,10,,,
 ])
 
 # Test 3.
 AT_DATA([pearson3.sps], [dnl
+SET FORMAT F8.3.
+
 * From http://learntech.uwe.ac.uk/da/Default.aspx?pageid=1442.
 DATA LIST FREE/x y.
 BEGIN DATA.
@@ -842,25 +848,27 @@ x * y,9,100.0%,0,0.0%,9,100.0%
 
 Table: x * y [[count]].
 ,y,,,,,,,,
-x,28.00,58.00,66.00,75.00,85.00,87.00,91.00,122.00,Total
-25.00,1.00,.00,.00,.00,.00,.00,.00,.00,1.00
-35.00,.00,1.00,.00,.00,.00,.00,.00,.00,1.00
-44.00,.00,.00,1.00,.00,.00,.00,.00,.00,1.00
-50.00,.00,.00,.00,1.00,.00,.00,.00,.00,1.00
-56.00,.00,.00,.00,.00,.00,1.00,1.00,.00,2.00
-65.00,.00,.00,.00,.00,1.00,.00,1.00,.00,2.00
-87.00,.00,.00,.00,.00,.00,.00,.00,1.00,1.00
-Total,1.00,1.00,1.00,1.00,1.00,1.00,2.00,1.00,9.00
+x,28.000,58.000,66.000,75.000,85.000,87.000,91.000,122.000,Total
+25.000,1.000,.000,.000,.000,.000,.000,.000,.000,1.000
+35.000,.000,1.000,.000,.000,.000,.000,.000,.000,1.000
+44.000,.000,.000,1.000,.000,.000,.000,.000,.000,1.000
+50.000,.000,.000,.000,1.000,.000,.000,.000,.000,1.000
+56.000,.000,.000,.000,.000,.000,1.000,1.000,.000,2.000
+65.000,.000,.000,.000,.000,1.000,.000,1.000,.000,2.000
+87.000,.000,.000,.000,.000,.000,.000,.000,1.000,1.000
+Total,1.000,1.000,1.000,1.000,1.000,1.000,2.000,1.000,9.000
 
 Table: Symmetric measures.
 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
-Ordinal by Ordinal,Spearman Correlation,.91,.07,3.45,
-Interval by Interval,Pearson's R,.97,.02,5.00,
+Ordinal by Ordinal,Spearman Correlation,.911,.068,5.860,
+Interval by Interval,Pearson's R,.966,.017,9.915,
 N of Valid Cases,,9,,,
 ])
 
 # Test 4.
 AT_DATA([pearson4.sps], [dnl
+SET FORMAT F8.3.
+
 * From http://psychology.ucdavis.edu/faculty_sites/sommerb/sommerdemo/correlation/hand/pearson_hand.htm.
 DATA LIST FREE/x y.
 BEGIN DATA.
@@ -888,27 +896,29 @@ x * y,12,100.0%,0,0.0%,12,100.0%
 
 Table: x * y [[count]].
 ,y,,,,,,,,,,,,
-x,2.00,4.00,5.00,7.00,9.00,11.00,12.00,14.00,15.00,17.00,18.00,20.00,Total
-2.00,.00,.00,.00,1.00,.00,.00,.00,.00,.00,.00,.00,.00,1.00
-3.00,.00,.00,.00,.00,.00,.00,1.00,.00,.00,.00,.00,.00,1.00
-4.00,.00,.00,.00,.00,1.00,1.00,.00,.00,.00,.00,.00,.00,2.00
-5.00,.00,.00,1.00,.00,.00,.00,.00,.00,.00,.00,.00,.00,1.00
-6.00,1.00,1.00,.00,.00,.00,.00,.00,.00,.00,.00,.00,.00,2.00
-7.00,.00,.00,.00,.00,.00,.00,.00,1.00,.00,.00,.00,.00,1.00
-8.00,.00,.00,.00,.00,.00,.00,.00,.00,1.00,.00,.00,.00,1.00
-9.00,.00,.00,.00,.00,.00,.00,.00,.00,.00,1.00,.00,.00,1.00
-10.00,.00,.00,.00,.00,.00,.00,.00,.00,.00,.00,1.00,1.00,2.00
-Total,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,12.00
+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
+2.000,.000,.000,.000,1.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000
+3.000,.000,.000,.000,.000,.000,.000,1.000,.000,.000,.000,.000,.000,1.000
+4.000,.000,.000,.000,.000,1.000,1.000,.000,.000,.000,.000,.000,.000,2.000
+5.000,.000,.000,1.000,.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000
+6.000,1.000,1.000,.000,.000,.000,.000,.000,.000,.000,.000,.000,.000,2.000
+7.000,.000,.000,.000,.000,.000,.000,.000,1.000,.000,.000,.000,.000,1.000
+8.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000,.000,.000,.000,1.000
+9.000,.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000,.000,.000,1.000
+10.000,.000,.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000,1.000,2.000
+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
 
 Table: Symmetric measures.
 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
-Ordinal by Ordinal,Spearman Correlation,.66,.14,2.59,
-Interval by Interval,Pearson's R,.67,.13,2.93,
+Ordinal by Ordinal,Spearman Correlation,.657,.140,2.758,
+Interval by Interval,Pearson's R,.667,.132,2.830,
 N of Valid Cases,,12,,,
 ])
 
 # Test 5.
 AT_DATA([pearson5.sps], [dnl
+SET FORMAT F8.3.
+
 * From http://www.statisticslectures.com/topics/pearsonr/.
 DATA LIST FREE/x y.
 BEGIN DATA.
@@ -934,23 +944,465 @@ x * y,10,100.0%,0,0.0%,10,100.0%
 
 Table: x * y [[count]].
 ,y,,,,,,,,,,
-x,15000.00,26000.00,29000.00,32000.00,33000.00,41000.00,45000.00,52000.00,68000.00,80000.00,Total
-18.00,1.00,.00,.00,.00,.00,.00,.00,.00,.00,.00,1.00
-24.00,.00,1.00,.00,.00,.00,.00,.00,.00,.00,.00,1.00
-25.00,.00,.00,1.00,.00,.00,.00,.00,.00,.00,.00,1.00
-26.00,.00,.00,.00,1.00,.00,.00,.00,.00,.00,.00,1.00
-33.00,.00,.00,.00,.00,1.00,.00,.00,.00,.00,.00,1.00
-37.00,.00,.00,.00,.00,.00,1.00,.00,.00,.00,.00,1.00
-40.00,.00,.00,.00,.00,.00,.00,1.00,.00,.00,.00,1.00
-45.00,.00,.00,.00,.00,.00,.00,.00,1.00,.00,.00,1.00
-57.00,.00,.00,.00,.00,.00,.00,.00,.00,1.00,.00,1.00
-64.00,.00,.00,.00,.00,.00,.00,.00,.00,.00,1.00,1.00
-Total,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,10.00
+x,15000.000,26000.000,29000.000,32000.000,33000.000,41000.000,45000.000,52000.000,68000.000,80000.000,Total
+18.000,1.000,.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000
+24.000,.000,1.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000
+25.000,.000,.000,1.000,.000,.000,.000,.000,.000,.000,.000,1.000
+26.000,.000,.000,.000,1.000,.000,.000,.000,.000,.000,.000,1.000
+33.000,.000,.000,.000,.000,1.000,.000,.000,.000,.000,.000,1.000
+37.000,.000,.000,.000,.000,.000,1.000,.000,.000,.000,.000,1.000
+40.000,.000,.000,.000,.000,.000,.000,1.000,.000,.000,.000,1.000
+45.000,.000,.000,.000,.000,.000,.000,.000,1.000,.000,.000,1.000
+57.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000,.000,1.000
+64.000,.000,.000,.000,.000,.000,.000,.000,.000,.000,1.000,1.000
+Total,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,10.000
 
 Table: Symmetric measures.
 Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
-Ordinal by Ordinal,Spearman Correlation,1.00,.00,3.76,
-Interval by Interval,Pearson's R,.99,.00,3.86,
+Ordinal by Ordinal,Spearman Correlation,1.000,.000,+Infinity,
+Interval by Interval,Pearson's R,.992,.004,22.638,
 N of Valid Cases,,10,,,
 ])
 AT_CLEANUP
+
+AT_SETUP([CROSSTABS Goodman and Kruskal's lambda])
+AT_DATA([lambda.sps], [dnl
+SET FORMAT F8.3.
+
+* From http://www.csupomona.edu/~jlkorey/POWERMUTT/Topics/contingency_tables.html.
+DATA LIST LIST NOTABLE/x y w.
+WEIGHT BY w.
+BEGIN DATA.
+1 1 424
+1 2 213
+1 3 59
+3 1 55
+3 2 188
+3 3 357
+END DATA.
+
+CROSSTABS x BY y/CELLS=NONE/STATISTICS=LAMBDA.
+
+* From http://vassarstats.net.
+DATA LIST LIST NOTABLE/x y w.
+WEIGHT BY w.
+BEGIN DATA.
+1 1 19
+1 2 26
+1 3 8
+2 1 21
+2 2 13
+2 3 5
+3 1 6
+3 2 12
+3 3 27
+END DATA.
+
+CROSSTABS x BY y/CELLS=NONE/STATISTICS=LAMBDA.
+
+* From Goodman, L.A., Kruskal, W.H. (1954) "Measures of association for
+  cross classifications". Part I. Journal of the American Statistical
+  Association, 49, 732-764.
+DATA LIST LIST NOTABLE/x y w.
+WEIGHT BY w.
+BEGIN DATA.
+1 1 1768
+1 2 807
+1 3 189
+1 4 47
+2 1 946
+2 2 1387
+2 3 746
+2 4 53
+3 1 115
+3 2 438
+3 3 288
+3 4 16
+END DATA.
+CROSSTABS x BY y/CELLS=NONE/STATISTICS=LAMBDA.
+])
+AT_CHECK([pspp -O format=csv lambda.sps], [0], [dnl
+Table: Summary.
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x * y,1296.000,100.0%,.000,0.0%,1296.000,100.0%
+
+Table: Directional measures.
+Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Nominal by Nominal,Lambda,Symmetric,.423,.021,16.875,
+,,x Dependent,.497,,15.986,
+,,y Dependent,.370,,16.339,
+,Goodman and Kruskal tau,x Dependent,.382,,,
+,,y Dependent,.198,,,
+
+Table: Summary.
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x * y,137.000,100.0%,.000,0.0%,137.000,100.0%
+
+Table: Directional measures.
+Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Nominal by Nominal,Lambda,Symmetric,.259,.081,2.902,
+,,x Dependent,.250,,2.479,
+,,y Dependent,.267,,2.766,
+,Goodman and Kruskal tau,x Dependent,.129,,,
+,,y Dependent,.123,,,
+
+Table: Summary.
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x * y,6800.000,100.0%,.000,0.0%,6800.000,100.0%
+
+Table: Directional measures.
+Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Nominal by Nominal,Lambda,Symmetric,.208,.010,18.793,
+,,x Dependent,.224,,16.076,
+,,y Dependent,.192,,14.438,
+,Goodman and Kruskal tau,x Dependent,.089,,,
+,,y Dependent,.081,,,
+])
+AT_CLEANUP
+
+AT_SETUP([CROSSTABS Somers' D, Tau-B, Tau-C, Gamma])
+AT_DATA([somersd.sps], [dnl
+SET FORMAT F8.3.
+
+* From http://stats.stackexchange.com/questions/72203/problem-with-calculating-asymptotic-standard-error-for-somers-d.
+DATA LIST LIST NOTABLE/x y * w (F10.6).
+WEIGHT BY w.
+BEGIN DATA.
+1 1 0.000025
+1 2 0.0001
+1 3 0.001
+1 4 0.0025
+1 5 0.004
+1 6 0.0075
+1 7 0.0125
+2 1 0.049975
+2 2 0.0999
+2 3 0.199
+2 4 0.2475
+2 5 0.196
+2 6 0.1425
+2 7 0.0375
+END DATA.
+CROSSTABS x BY y/STATISTICS=D/CELLS=NONE.
+
+* From http://uregina.ca/~gingrich/gamma.pdf.
+DATA LIST LIST NOTABLE/x y w.
+WEIGHT BY w.
+BEGIN DATA.
+1 1 34
+1 2 24
+1 3 15
+2 1 42
+2 2 74
+2 3 67
+3 1 28
+3 2 111
+3 3 292
+END DATA.
+CROSSTABS x BY y/STATISTICS=BTAU CTAU GAMMA D/CELLS=NONE.
+])
+AT_CHECK([pspp -O format=csv somersd.sps], [0], [dnl
+Table: Summary.
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x * y,1.000000,100.0%,.000000,0.0%,1.000000,100.0%
+
+Table: Directional measures.
+Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Ordinal by Ordinal,Somers' d,Symmetric,-.084,,-.149,
+,,x Dependent,-.045,.300,-.149,
+,,y Dependent,-.684,2.378,-.149,
+
+Table: Summary.
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x * y,687.000,100.0%,.000,0.0%,687.000,100.0%
+
+Table: Symmetric measures.
+Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Ordinal by Ordinal,Kendall's tau-b,.372,.033,10.669,
+,Kendall's tau-c,.310,.029,10.669,
+,Gamma,.591,.043,10.669,
+N of Valid Cases,,687.000,,,
+
+Table: Directional measures.
+Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Ordinal by Ordinal,Somers' d,Symmetric,.371,,10.669,
+,,x Dependent,.351,.032,10.669,
+,,y Dependent,.394,.035,10.669,
+])
+
+AT_DATA([ordinal.sps], [dnl
+SET FORMAT F8.3.
+
+* From https://www.iup.edu/WorkArea/DownloadAsset.aspx?id=9829, "Case 1".
+DATA LIST LIST NOTABLE /x y w.
+WEIGHT BY w.
+BEGIN DATA.
+1 2 40
+2 3 80
+3 4 30
+END DATA.
+CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
+
+* Same site, case 2.
+DATA LIST LIST NOTABLE /x y w.
+WEIGHT BY w.
+BEGIN DATA.
+1 1 40
+2 3 80
+3 4 30
+END DATA.
+CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
+
+* Same site, case 3.
+DATA LIST LIST NOTABLE /x y w.
+WEIGHT BY w.
+BEGIN DATA.
+1 4 40
+2 3 80
+3 2 30
+END DATA.
+CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
+
+* Same site, case 4.
+DATA LIST LIST NOTABLE /x y w.
+WEIGHT BY w.
+BEGIN DATA.
+1 1 20
+1 2 20
+2 3 80
+3 4 30
+END DATA.
+CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
+
+* Same site, case 5.
+DATA LIST LIST NOTABLE /x y w.
+WEIGHT BY w.
+BEGIN DATA.
+1 2 40
+2 2 80
+3 2 29
+3 3 1
+END DATA.
+CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
+
+* Same site, case 6.
+DATA LIST LIST NOTABLE /x y w.
+WEIGHT BY w.
+BEGIN DATA.
+1 1 3
+1 2 6
+1 3 28
+1 4 61
+2 1 4
+2 2 5
+2 3 21
+2 4 20
+END DATA.
+CROSSTABS x BY y/STATISTICS=GAMMA D BTAU/CELLS=NONE.
+
+* Same site, case 7.
+DATA LIST LIST NOTABLE /x y w.
+WEIGHT BY w.
+BEGIN DATA.
+1 1 38
+1 2 6
+1 3 3
+1 4 51
+2 1 4
+2 2 20
+2 3 21
+2 4 5
+END DATA.
+CROSSTABS x BY y/STATISTICS=LAMBDA D PHI GAMMA/CELLS=NONE.
+
+* Same site, case 8.
+DATA LIST LIST NOTABLE /x y w.
+WEIGHT BY w.
+BEGIN DATA.
+1 1 2
+1 2 3
+1 3 5
+1 4 1
+2 1 2
+2 2 16
+2 3 3
+2 4 6
+3 1 3
+3 2 10
+3 3 35
+3 4 27
+4 1 6
+4 2 15
+4 3 33
+4 4 45
+END DATA.
+CROSSTABS x BY y/STATISTICS=LAMBDA D PHI BTAU/CELLS=NONE.
+])
+AT_CHECK([pspp -O format=csv ordinal.sps], [0], [dnl
+Table: Summary.
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x * y,150.000,100.0%,.000,0.0%,150.000,100.0%
+
+Table: Symmetric measures.
+Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Ordinal by Ordinal,Kendall's tau-b,1.000,.000,24.841,
+,Gamma,1.000,.000,24.841,
+N of Valid Cases,,150.000,,,
+
+Table: Directional measures.
+Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Ordinal by Ordinal,Somers' d,Symmetric,1.000,,24.841,
+,,x Dependent,1.000,.000,24.841,
+,,y Dependent,1.000,.000,24.841,
+
+Table: Summary.
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x * y,150.000,100.0%,.000,0.0%,150.000,100.0%
+
+Table: Symmetric measures.
+Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Ordinal by Ordinal,Kendall's tau-b,1.000,.000,24.841,
+,Gamma,1.000,.000,24.841,
+N of Valid Cases,,150.000,,,
+
+Table: Directional measures.
+Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Ordinal by Ordinal,Somers' d,Symmetric,1.000,,24.841,
+,,x Dependent,1.000,.000,24.841,
+,,y Dependent,1.000,.000,24.841,
+
+Table: Summary.
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x * y,150.000,100.0%,.000,0.0%,150.000,100.0%
+
+Table: Symmetric measures.
+Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Ordinal by Ordinal,Kendall's tau-b,-1.000,.000,-24.841,
+,Gamma,-1.000,.000,-24.841,
+N of Valid Cases,,150.000,,,
+
+Table: Directional measures.
+Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Ordinal by Ordinal,Somers' d,Symmetric,-1.000,,-24.841,
+,,x Dependent,-1.000,.000,-24.841,
+,,y Dependent,-1.000,.000,-24.841,
+
+Table: Summary.
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x * y,150.000,100.0%,.000,0.0%,150.000,100.0%
+
+Table: Symmetric measures.
+Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Ordinal by Ordinal,Kendall's tau-b,.972,.007,24.841,
+,Gamma,1.000,.000,24.841,
+N of Valid Cases,,150.000,,,
+
+Table: Directional measures.
+Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Ordinal by Ordinal,Somers' d,Symmetric,.971,,24.841,
+,,x Dependent,.944,.013,24.841,
+,,y Dependent,1.000,.000,24.841,
+
+Table: Summary.
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x * y,150.000,100.0%,.000,0.0%,150.000,100.0%
+
+Table: Symmetric measures.
+Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Ordinal by Ordinal,Kendall's tau-b,.119,.059,1.009,
+,Gamma,1.000,.000,1.009,
+N of Valid Cases,,150.000,,,
+
+Table: Directional measures.
+Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Ordinal by Ordinal,Somers' d,Symmetric,.035,,1.009,
+,,x Dependent,.805,.032,1.009,
+,,y Dependent,.018,.017,1.009,
+
+Table: Summary.
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x * y,148.000,100.0%,.000,0.0%,148.000,100.0%
+
+Table: Symmetric measures.
+Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Ordinal by Ordinal,Kendall's tau-b,-.208,.078,-2.641,
+,Gamma,-.381,.130,-2.641,
+N of Valid Cases,,148.000,,,
+
+Table: Directional measures.
+Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Ordinal by Ordinal,Somers' d,Symmetric,-.206,,-2.641,
+,,x Dependent,-.182,.069,-2.641,
+,,y Dependent,-.237,.089,-2.641,
+
+Table: Summary.
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x * y,148.000,100.0%,.000,0.0%,148.000,100.0%
+
+Table: Symmetric measures.
+Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Nominal by Nominal,Phi,.731,,,
+,Cramer's V,.731,,,
+Ordinal by Ordinal,Gamma,-.110,.107,-1.022,
+N of Valid Cases,,148.000,,,
+
+Table: Directional measures.
+Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Nominal by Nominal,Lambda,Symmetric,.338,.059,4.743,
+,,x Dependent,.640,,4.875,
+,,y Dependent,.174,,3.248,
+,Goodman and Kruskal tau,x Dependent,.534,,,
+,,y Dependent,.167,,,
+Ordinal by Ordinal,Somers' d,Symmetric,-.074,,-1.022,
+,,x Dependent,-.060,.059,-1.022,
+,,y Dependent,-.096,.094,-1.022,
+
+Table: Summary.
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x * y,212.000,100.0%,.000,0.0%,212.000,100.0%
+
+Table: Symmetric measures.
+Category,Statistic,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Nominal by Nominal,Phi,.432,,,
+,Cramer's V,.249,,,
+Ordinal by Ordinal,Kendall's tau-b,.209,.062,3.338,
+N of Valid Cases,,212.000,,,
+
+Table: Directional measures.
+Category,Statistic,Type,Value,Asymp. Std. Error,Approx. T,Approx. Sig.
+Nominal by Nominal,Lambda,Symmetric,.102,.067,1.473,
+,,x Dependent,.027,,.302,
+,,y Dependent,.165,,2.349,
+,Goodman and Kruskal tau,x Dependent,.051,,,
+,,y Dependent,.068,,,
+Ordinal by Ordinal,Somers' d,Symmetric,.209,,3.338,
+,,x Dependent,.202,.060,3.338,
+,,y Dependent,.217,.064,3.338,
+])
+AT_CLEANUP