1
votes

I'm using R to calculate the Fisher Exact test on a contingency table. I need it because in some table cells, I have values lower than 5, so I can't use Chi-square.

I use fisher.test(table), but this only gives me a p-value.


Question: What if I also need a value for the test statistic?

1
can you show what you have tried?Phlume
I did exactly what @Ben did in his first answer, and got the same results. Nonetheless, SPSS also give me a valure for the FI(x) as explained here (p. 151) link. How do I calculate this in R?Forinstance
Did you find a solution in the last 5 years? @ForinstanceJerry T

1 Answers

0
votes

Are you sure? From a clean R session (R-devel, but I would be very surprised if this were different in any recent version of R

z <- matrix(c(2,17,8,3),nrow=2)
(f <- fisher.test(z))
##
##  Fisher's Exact Test for Count Data
## data:  z
## p-value = 0.0009742
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  0.003595195 0.413247726
## sample estimates:
## odds ratio 
## 0.05159674 

This gives you the odds ratio. f$estimate extracts the value, if you want to use it in further computations.