Fisher's Exact Test

Calculate Fisher's exact test p-values for 2x2 contingency tables. Free online statistics tool with odds ratio, one-tailed and two-tailed p-values, and breakdowns.

Test independence with Fisher's Exact Test

About This Calculator

This Fisher's Exact Test calculator computes both one-tailed and two-tailed p-values for a 2x2 contingency table using the hypergeometric distribution. It also calculates the odds ratio with a 95% confidence interval and displays the full enumeration of all possible tables with the same marginal totals. Fisher's exact test is an exact statistical test of independence, meaning it does not rely on asymptotic approximations like the chi-square test.

Fisher's exact test is ideal for small sample sizes, tables with small expected cell frequencies (less than 5), or when the marginal totals are highly unbalanced. The test works by fixing the row and column totals and then calculating the exact probability of the observed table under the null hypothesis using the hypergeometric probability formula: P = (a+b)!(c+d)!(a+c)!(b+d)! / (a! b! c! d! n!). The p-value is the sum of probabilities of all tables that are as extreme or more extreme than the observed one.

The odds ratio measures the strength of association between the two categorical variables. An odds ratio of 1 means no association, greater than 1 means a positive association, and less than 1 means a negative association. When any cell contains zero, the calculator applies the Haldane correction (adding 0.5 to all cells) to compute a valid odds ratio and confidence interval.

Regional Notes

India: Fisher's exact test is widely taught in Indian medical and statistics programs. It is commonly used in clinical trials, epidemiological studies, and A/B testing for market research when sample sizes are limited.

United States: Fisher's exact test is a standard method in biostatistics, especially in pharmaceutical research and FDA submissions. It is preferred over the chi-square test when analyzing adverse events or rare outcomes with small expected cell counts.

United Kingdom: UK medical research guidelines (e.g., from the MRC and NICE) recommend Fisher's exact test when the chi-square test assumptions are violated due to small expected frequencies, making it a common tool in public health research.

Frequently Asked Questions

What is Fisher's exact test?

Fisher's exact test is a statistical test of independence for categorical variables organized in a 2x2 contingency table. It determines whether there is a nonrandom association between two categorical variables by calculating the exact probability of observing the given table under the null hypothesis of independence using the hypergeometric distribution.

When should I use Fisher's exact test instead of chi-square test?

Use Fisher's exact test when the sample size is small, when any expected cell frequency is less than 5, or when the marginal totals are very uneven. Unlike the chi-square test which relies on an approximation, Fisher's exact test computes the exact p-value and is therefore more reliable for small samples or sparse contingency tables.

How is Fisher's exact test calculated?

Fisher's exact test calculates the probability of observing a 2x2 contingency table using the hypergeometric distribution formula: P = (a+b)!(c+d)!(a+c)!(b+d)! / (a! b! c! d! n!). The p-value is the sum of probabilities of all tables with the same marginal totals that are as extreme or more extreme than the observed table.

What is the difference between one-tailed and two-tailed p-values?

A one-tailed p-value tests for association in a specific direction (positive or negative correlation), while a two-tailed p-value tests for any association regardless of direction. The two-tailed p-value sums probabilities of all tables with probability less than or equal to the observed table. The one-tailed p-value only considers tables more extreme in the same direction as the observed deviation.

What is a 2x2 contingency table?

A 2x2 contingency table displays the frequency distribution of two categorical variables, each having two categories. The table has four cells (a, b, c, d) representing the counts for each combination of variable levels, with row totals and column totals showing the marginal distributions.

What does the odds ratio mean in Fisher's exact test?

The odds ratio measures the strength of association between the two variables in a 2x2 table. It is calculated as (a × d) / (b × c). An odds ratio of 1 indicates no association, greater than 1 indicates a positive association, and less than 1 indicates a negative association. The 95% confidence interval provides a range of plausible values for the true odds ratio.

What does a significant p-value mean in Fisher's exact test?

A significant p-value (typically less than 0.05) indicates that there is sufficient evidence to reject the null hypothesis of independence between the two categorical variables. This means the observed association in the contingency table is unlikely to have occurred by chance alone, suggesting a real relationship between the variables.

Can Fisher's exact test be applied to larger contingency tables?

While Fisher's exact test is most commonly used for 2x2 tables, it can be extended to larger contingency tables (r x c) as the Fisher-Freeman-Halton test. However, the computational complexity increases dramatically with more rows and columns, making it impractical for large tables. The chi-square test or G-test are more practical alternatives for larger tables.