Dear all,
I notice that "xtab" command can do Fisher's exact test. I found that
fisher.test(.) in R (requires vcd package) also produces Fisher's exact
test results. Does anyone know the differences between gretl's and R's
Fisher's exact test?
I test the following data (which can be downloaded from
http://ibeif.files.wordpress.com/2012/12/fishertea.xls
obs real guess
1 1 1
2 1 1
3 1 1
4 1 2
5 2 2
6 2 2
7 2 1
8 2 2
In gretl, the following script
<hansl>
open
http://ibeif.files.wordpress.com/2012/12/fishertea.xls
xtab real guess
</hansl>
produces the results:
Cross-tabulation of real (rows) against guess (columns)
[ 1][ 2] TOT.
[ 1] 3 1 4
[ 2] 1 3 4
TOTAL 4 4 8
Pearson chi-square test = 2 (1 df, p-value = 0.157299)
Warning: Less than of 80% of cells had expected values of 5 or greater.
Fisher's Exact Test:
Left: P-value = 0.985714
Right: P-value = 0.242857
2-Tail: P-value = 0.257143
However, in gretl with the following R script
fisher.test(table(real,guess))
produces the different results:
Fisher's Exact Test for Count Data
data: table(real, guess)
p-value = 0.4857
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
0.2117329 621.9337505
sample estimates:
odds ratio
6.408309
Thanks
Yi-Nung Yang