What is Fisher's Exact Test?
Fisher exact test assesses whether two categorical variables in a 2x2 contingency table are associated. Unlike the chi-square test, it computes an exact p-value rather than an approximation, making it ideal for small samples or tables with low expected cell counts. It is widely used in biology, medicine, and social science.
How to use this calculator
Enter the four cell counts of your 2x2 table: a and b form the first row, c and d form the second row. The calculator computes the exact hypergeometric probability of the observed table and the two-sided p-value, which sums the probabilities of all tables (with the same row and column totals) that are no more likely than the one you observed.
The formula explained
With margins fixed, the probability of any specific table follows the hypergeometric distribution:
$$p = \dfrac{(a+b)!\,(c+d)!\,(a+c)!\,(b+d)!}{n!\;a!\,b!\,c!\,d!}$$where \(n = a + b + c + d\). The two-sided p-value adds up \(p\) over every table with the same margins whose probability is less than or equal to the observed probability.
$$P_{\text{two-sided}} = \sum_{\,p_i \le p_{\text{obs}}} p_i$$
Worked example
For the table \(a = 8\), \(b = 2\), \(c = 1\), \(d = 5\) (\(n = 16\)), the probability of this exact table is about \(0.01865\). Summing all equally-or-less-likely tables gives a two-sided p-value of roughly \(0.0349\), suggesting a statistically significant association at the \(0.05\) level.
FAQ
When should I use Fisher's test instead of chi-square? Use Fisher exact test when sample sizes are small or any expected cell count is below 5, where the chi-square approximation is unreliable.
What does the two-sided p-value mean? It is the probability of obtaining a table at least as extreme as yours in either direction, assuming no association between the variables.
Can the test handle larger tables? This calculator handles 2x2 tables. Larger contingency tables require generalized exact tests.