Added a test which checks the Fisher Exact Test results
authorJohn Darrington <john@darrington.wattle.id.au>
Thu, 19 Sep 2013 05:16:51 +0000 (07:16 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Fri, 20 Sep 2013 15:34:45 +0000 (17:34 +0200)
tests/language/stats/crosstabs.at

index 4492e9a25002be3cbc73a4a0a96bfa5fdb9b501e..fbe9df6e3a8801bee63ea6c074ae9e85067d0a46 100644 (file)
@@ -462,3 +462,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