Added result_class parameter to tab_double and updated all callers. Removed tab_fixed
[pspp] / tests / language / stats / crosstabs.at
index 67571dd93e876d97044ab09e4ed55d4dd916cb7c..791dde29333393223d9906f1408a0f023ddb2eb2 100644 (file)
@@ -59,9 +59,9 @@ Variable,Format
 x,F8.0
 y,A18
 
-"crosstabs.sps:4: warning: BEGIN DATA: Missing value(s) for all variables from x onward.  These will be filled with the system-missing value or blanks, as appropriate."
+"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."
 
-"crosstabs.sps:6: warning: BEGIN DATA: Missing value(s) for all variables from x onward.  These will be filled with the system-missing value or blanks, as appropriate."
+"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."
 
 Table: Summary.
 ,Cases,,,,,
@@ -175,9 +175,9 @@ Total,2.00,2.00,4.00
 
 Table: Chi-square tests.
 Statistic,Value,df,Asymp. Sig. (2-tailed)
-Pearson Chi-Square,2.00,2,.37
-Likelihood Ratio,2.77,2,.25
-Linear-by-Linear Association,.27,1,.60
+Pearson Chi-Square,2.00,2,.368
+Likelihood Ratio,2.77,2,.250
+Linear-by-Linear Association,.27,1,.602
 N of Valid Cases,4,,
 ]])
 AT_CLEANUP
@@ -207,6 +207,7 @@ CROSSTABS
     /STATISTICS=CHISQ
     /CELLS=COUNT ROW COLUMN TOTAL.
 ])
+
 AT_CHECK([pspp -O format=csv crosstabs.sps], [0],
   [[Variable,Value,Label
 v0,a ,
@@ -235,10 +236,10 @@ Total,4.00,2.00,6.00
 
 Table: Chi-square tests.
 Statistic,Value,df,Asymp. Sig. (2-tailed),Exact Sig. (2-tailed),Exact Sig. (1-tailed)
-Pearson Chi-Square,.38,1,.54,,
-Likelihood Ratio,.37,1,.54,,
-Fisher's Exact Test,,,,1.00,.60
-Continuity Correction,.00,1,1.00,,
+Pearson Chi-Square,.38,1,.540,,
+Likelihood Ratio,.37,1,.545,,
+Fisher's Exact Test,,,,1.000,.600
+Continuity Correction,.00,1,1.000,,
 N of Valid Cases,6,,,,
 
 Variable,Value,Label
@@ -268,10 +269,10 @@ Total,1.00,3.00,4.00
 
 Table: Chi-square tests.
 Statistic,Value,df,Asymp. Sig. (2-tailed),Exact Sig. (2-tailed),Exact Sig. (1-tailed)
-Pearson Chi-Square,.44,1,.50,,
-Likelihood Ratio,.68,1,.41,,
-Fisher's Exact Test,,,,1.00,.75
-Continuity Correction,.00,1,1.00,,
+Pearson Chi-Square,.44,1,.505,,
+Likelihood Ratio,.68,1,.410,,
+Fisher's Exact Test,,,,1.000,.750
+Continuity Correction,.00,1,1.000,,
 N of Valid Cases,4,,,,
 ]])
 AT_CLEANUP
@@ -343,13 +344,13 @@ Total,,3.00,1.00,4.00
 
 Table: Chi-square tests.
 z,Statistic,Value,df,Asymp. Sig. (2-tailed)
-1,Pearson Chi-Square,5.00,4,.29
-,Likelihood Ratio,5.00,4,.29
-,Linear-by-Linear Association,.01,1,.94
+1,Pearson Chi-Square,5.00,4,.287
+,Likelihood Ratio,5.00,4,.287
+,Linear-by-Linear Association,.01,1,.938
 ,N of Valid Cases,5,,
-2,Pearson Chi-Square,4.00,3,.26
-,Likelihood Ratio,4.50,3,.21
-,Linear-by-Linear Association,1.58,1,.21
+2,Pearson Chi-Square,4.00,3,.261
+,Likelihood Ratio,4.50,3,.212
+,Linear-by-Linear Association,1.58,1,.209
 ,N of Valid Cases,4,,
 
 Table: Symmetric measures.
@@ -462,3 +463,271 @@ X1 * X2,0,0.0%,1,100.0%,1,100.0%
 crosstabs.sps:8: warning: CROSSTABS: Crosstabulation X1 * X2 contained no non-missing cases.
 ])
 AT_CLEANUP
+
+
+
+dnl This example comes from http://www.ats.ucla.edu/stat/spss/whatstat/whatstat.htm#chisq
+AT_SETUP([CROSSTABS Fisher Exact Test])
+
+AT_DATA([fisher-exact.sps], [dnl
+SET FORMAT F12.3.
+SET DECIMAL DOT.
+
+DATA LIST notable LIST  /schtyp (F9.2) female (F9.2) ses (F9.2) .
+begin data.
+      1.00       .00      1.00 
+      1.00      1.00      2.00 
+      1.00       .00      3.00 
+      1.00       .00      3.00 
+      1.00       .00      2.00 
+      1.00       .00      2.00 
+      1.00       .00      2.00 
+      1.00       .00      2.00 
+      1.00       .00      2.00 
+      1.00       .00      2.00 
+      1.00       .00      2.00 
+      1.00       .00      2.00 
+      1.00       .00      3.00 
+      1.00       .00      3.00 
+      1.00       .00      1.00 
+      1.00       .00      1.00 
+      1.00       .00      3.00 
+      2.00       .00      2.00 
+      1.00       .00      3.00 
+      1.00       .00      2.00 
+      1.00       .00      2.00 
+      1.00       .00      2.00 
+      1.00       .00      2.00 
+      1.00       .00      3.00 
+      1.00       .00      2.00 
+      1.00       .00      2.00 
+      1.00       .00      3.00 
+      2.00       .00      2.00 
+      2.00       .00      3.00 
+      1.00       .00      1.00 
+      1.00       .00      2.00 
+      1.00       .00      3.00 
+      2.00       .00      3.00 
+      1.00       .00      2.00 
+      2.00       .00      3.00 
+      1.00       .00      3.00 
+      2.00       .00      2.00 
+      1.00       .00      3.00 
+      1.00       .00      1.00 
+      1.00       .00      2.00 
+      2.00       .00      2.00 
+      2.00       .00      2.00 
+      1.00       .00      2.00 
+      1.00       .00      1.00 
+      1.00       .00      3.00 
+      1.00       .00      1.00 
+      1.00       .00      3.00 
+      1.00       .00      2.00 
+      2.00       .00      2.00 
+      1.00       .00      2.00 
+      1.00       .00      2.00 
+      1.00       .00      3.00 
+      1.00       .00      2.00 
+      2.00       .00      2.00 
+      1.00       .00      2.00 
+      1.00       .00      3.00 
+      1.00       .00      1.00 
+      1.00       .00      2.00 
+      2.00       .00      2.00 
+      1.00       .00      2.00 
+      2.00       .00      2.00 
+      1.00       .00      3.00 
+      1.00       .00      1.00 
+      1.00       .00      2.00 
+      2.00       .00      3.00 
+      1.00       .00      2.00 
+      1.00       .00      2.00 
+      1.00       .00      1.00 
+      1.00       .00      1.00 
+      1.00       .00      2.00 
+      1.00       .00      2.00 
+      1.00       .00      3.00 
+      1.00       .00      2.00 
+      1.00       .00      2.00 
+      1.00       .00      2.00 
+      1.00       .00      1.00 
+      1.00       .00      3.00 
+      1.00       .00      3.00 
+      1.00       .00      2.00 
+      1.00       .00      3.00 
+      1.00       .00      3.00 
+      1.00       .00      1.00 
+      2.00       .00      2.00 
+      1.00       .00      1.00 
+      1.00       .00      2.00 
+      1.00       .00      3.00 
+      1.00       .00      3.00 
+      1.00       .00      3.00 
+      1.00       .00      2.00 
+      1.00       .00      3.00 
+      1.00       .00      2.00 
+      1.00       .00      1.00 
+      1.00      1.00      3.00 
+      1.00      1.00      1.00 
+      1.00      1.00      1.00 
+      1.00      1.00      1.00 
+      1.00      1.00      2.00 
+      1.00      1.00      3.00 
+      1.00      1.00      1.00 
+      2.00      1.00      3.00 
+      1.00      1.00      3.00 
+      1.00      1.00      3.00 
+      1.00      1.00      1.00 
+      1.00      1.00      3.00 
+      1.00      1.00      2.00 
+      1.00      1.00      2.00 
+      1.00      1.00      3.00 
+      1.00      1.00      1.00 
+      2.00      1.00      1.00 
+      2.00      1.00      3.00 
+      1.00      1.00      2.00 
+      1.00      1.00      1.00 
+      1.00      1.00      3.00 
+      1.00      1.00      1.00 
+      2.00      1.00      3.00 
+      1.00      1.00      2.00 
+      1.00      1.00      3.00 
+      1.00      1.00      3.00 
+      1.00      1.00      1.00 
+      1.00      1.00      1.00 
+      2.00      1.00      1.00 
+      1.00      1.00      2.00 
+      1.00      1.00      2.00 
+      1.00      1.00      2.00 
+      1.00      1.00      1.00 
+      1.00      1.00      3.00 
+      1.00      1.00      2.00 
+      1.00      1.00      2.00 
+      1.00      1.00      3.00 
+      1.00      1.00      1.00 
+      1.00      1.00      2.00 
+      1.00      1.00      1.00 
+      1.00      1.00      2.00 
+      1.00      1.00      2.00 
+      1.00      1.00      1.00 
+      1.00      1.00      3.00 
+      2.00      1.00      2.00 
+      1.00      1.00      2.00 
+      1.00      1.00      2.00 
+      2.00      1.00      2.00 
+      1.00      1.00      1.00 
+      1.00      1.00      3.00 
+      1.00      1.00      2.00 
+      1.00      1.00      2.00 
+      1.00      1.00      2.00 
+      2.00      1.00      3.00 
+      1.00      1.00      2.00 
+      2.00      1.00      2.00 
+      1.00      1.00      1.00 
+      1.00      1.00      1.00 
+      1.00      1.00      1.00 
+      1.00      1.00      3.00 
+      1.00      1.00      2.00 
+      1.00      1.00      2.00 
+      1.00      1.00      2.00 
+      1.00      1.00      2.00 
+      1.00      1.00      2.00 
+      1.00      1.00      2.00 
+      1.00      1.00      2.00 
+      1.00      1.00      3.00 
+      1.00      1.00      1.00 
+      1.00      1.00      2.00 
+      2.00      1.00      3.00 
+      1.00      1.00      1.00 
+      1.00      1.00      2.00 
+      1.00      1.00      1.00 
+      1.00      1.00      2.00 
+      1.00      1.00      1.00 
+      2.00      1.00      2.00 
+      1.00      1.00      1.00 
+      1.00      1.00      1.00 
+      1.00      1.00      2.00 
+      1.00      1.00      3.00 
+      1.00      1.00      3.00 
+      1.00      1.00      1.00 
+      1.00      1.00      1.00 
+      1.00      1.00      2.00 
+      1.00      1.00      2.00 
+      1.00      1.00      3.00 
+      1.00      1.00      1.00 
+      1.00      1.00      2.00 
+      2.00      1.00      2.00 
+      1.00      1.00      3.00 
+      1.00      1.00      2.00 
+      1.00      1.00      3.00 
+      1.00      1.00      1.00 
+      1.00      1.00      2.00 
+      1.00      1.00      2.00 
+      2.00      1.00      3.00 
+      1.00      1.00      1.00 
+      1.00      1.00      1.00 
+      2.00      1.00      3.00 
+      2.00      1.00      2.00 
+      1.00      1.00      3.00 
+      2.00      1.00      2.00 
+      2.00      1.00      2.00 
+      1.00      1.00      2.00 
+      2.00      1.00      2.00 
+      1.00      1.00      2.00 
+      1.00      1.00      3.00 
+end data.
+
+VARIABLE LABEL schtyp 'type of school'.
+ADD VALUE LABELS female 0 male 1 female.
+ADD VALUE LABELS ses 1 low 2 middle 3 high.
+ADD VALUE LABELS schtyp 1 public 2 private.
+
+crosstabs /tables = schtyp by female /statistic = chisq.
+crosstabs /tables = female by ses  /statistic = chisq.
+])
+
+AT_CHECK([pspp -O format=csv fisher-exact.sps], [0], [dnl
+Table: Summary.
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+type of school * female,200,100.0%,0,0.0%,200,100.0%
+
+Table: type of school * female [[count]].
+,female,,
+type of school,male,female,Total
+public,77.000,91.000,168.000
+private,14.000,18.000,32.000
+Total,91.000,109.000,200.000
+
+Table: Chi-square tests.
+Statistic,Value,df,Asymp. Sig. (2-tailed),Exact Sig. (2-tailed),Exact Sig. (1-tailed)
+Pearson Chi-Square,.047,1,.828,,
+Likelihood Ratio,.047,1,.828,,
+Fisher's Exact Test,,,,.849,.492
+Continuity Correction,.001,1,.981,,
+Linear-by-Linear Association,.047,1,.829,,
+N of Valid Cases,200,,,,
+
+Table: Summary.
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+female * ses,200,100.0%,0,0.0%,200,100.0%
+
+Table: female * ses [[count]].
+,ses,,,
+female,low,middle,high,Total
+male,15.000,47.000,29.000,91.000
+female,32.000,48.000,29.000,109.000
+Total,47.000,95.000,58.000,200.000
+
+Table: Chi-square tests.
+Statistic,Value,df,Asymp. Sig. (2-tailed)
+Pearson Chi-Square,4.577,2,.101
+Likelihood Ratio,4.679,2,.096
+Linear-by-Linear Association,3.110,1,.078
+N of Valid Cases,200,,
+])
+
+AT_CLEANUP
\ No newline at end of file