I have a contingency table which look like that:
matrix(c(0, 7, 2, 13), 2, 2)
So I started to think that those three contingency tables are the same:
matrix(c(2, 13, 0, 7), 2, 2)
matrix(c(7, 0, 13, 2), 2, 2)
matrix(c(13, 2, 7, 0), 2, 2)
There are only rows or/and columns permutations. According to fisher exact test, I think it is no matter. Look at the example paragraph, there is an equation.
Can you explain me why I have different results and I have to correct it by changing alternative argument? Equation's implementation and build in function strange usages is presented below:
fisher.test(matrix(c(0, 7, 2, 13), 2, 2), alternative = "less")
fisher.test(matrix(c(2, 13, 0, 7), 2, 2), alternative = "greater")
fisher.test(matrix(c(7, 0, 13, 2), 2, 2), alternative = "greater")
fisher.test(matrix(c(13, 2, 7, 0), 2, 2), alternative = "less")
(factorial(2)*factorial(20)*factorial(7)*factorial(15))/(factorial(2)*factorial(0)*factorial(13)*factorial(7)*factorial(22))
Thanks. I have used
factorial()
, because I thought that formula looks easier when you change rows, columns. It shows that all equation stay the same.