I have this matrix:

x <- c(2, 38, 196, 2)

contingency <- matrix(x, nrow = 2, byrow = TRUE)


     [,1] [,2]
[1,]    2   38
[2,]  196    2

And I've carried out this Fisher's Exact Test:


which outputs this:

    Fisher's Exact Test for Count Data

data:  contingency
p-value < 2.2e-16
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
 6.103516e-05 4.703333e-03
sample estimates:
 odds ratio

My questions are:

The values in the matrix (2, 38, 196, 2) are means. Is it ok to run a Fisher’s Exact Test on these data?

If I was to conclude that the proportions in each group are unlikely to be equal, would i be correct?

  • 1
    $\begingroup$ Do you have the raw counts? If so you should use them. Fisher's test looks at all possible permutations of the 2x2 tables where the row and column sums are fixed. The p-value is determined by which tables are more extreme under the null hypothesis than the observed table. Since you are inputting integers Fisher's test will give you a result but it is not what you want. $\endgroup$ Dec 15, 2016 at 20:55
  • $\begingroup$ Under the null hypothesis that the the proportion for one group is the same as for the other the probability for an individual table has a hypergeometric distribution. Besides the fact that you said you are using means we also need to know what the rows and columns represent in terms of the categories. $\endgroup$ Dec 15, 2016 at 21:13
  • 1
    $\begingroup$ For example if the columns represent gender and the rows represents whether or not the subject studied for a test., the null hypothesis would be that the proportion of males that studied for the test is the same as for the females. $\endgroup$ Dec 15, 2016 at 21:18
  • $\begingroup$ The result sums the hypergeometric probabilities associated with tables as extreme or more extreme than the observed table. That would be those where calculated proportions are more different than the observed proportions as well as adding the hypergeometric probability for the observed table. $\endgroup$ Dec 15, 2016 at 21:32

2 Answers 2


The values in the cell of these tables should not be means, they should be counts. Fisher's test is valid only for contingency tables.


While there is nothing that can stop you from running Fishcer's Exact test like you do, it simply doesn't make sense.

The test assumes the totals in the experiment is fixed in advanced, which is not the case if you have floating mean values. The test gives you p-value by calculating all possible permutations, which can't be done for continuous data like sample means.

If you want to compare the means, consider t-test or ANOVA depend on your data set.

  • $\begingroup$ In order to obtain a p-value you only need the permutations that give tables as extreme or more extreme than the observed one. Also things get restricted because Fisher conditions on the marginal totals. I think the OP really wants to look at the contingency table and if counts are available nothing makes Fisher's test unreasonable. $\endgroup$ Dec 17, 2016 at 14:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.