What is Fisher’s Exact Test and how is it calculated? Can you provide an example?

Fisher’s Exact Test is a statistical method used to determine the significance of the relationship between two categorical variables. It is typically used when the sample size is small or when there are low expected frequencies in the data.

The test calculates the probability of obtaining a particular set of data, assuming that there is no real relationship between the variables. This probability is then compared to a predetermined level of significance, usually 0.05, to determine if the observed relationship is statistically significant.

Fisher’s Exact Test is calculated by creating a contingency table with the observed frequencies of the two variables, and then using a formula to calculate the probability of obtaining those frequencies. This probability is then compared to the significance level to determine if it is statistically significant.

For example, if we want to determine if there is a significant relationship between gender and job satisfaction, we would collect data on the number of males and females who reported being satisfied with their job. This data would be used to create a contingency table, and Fisher’s Exact Test would be used to calculate the probability of obtaining these frequencies. If the calculated probability is less than 0.05, we can conclude that there is a significant relationship between gender and job satisfaction.

Fisher’s Exact Test: Definition, Formula, and Example


Fisher’s Exact Test is used to determine whether or not there is a significant association between two categorical variables. It is typically used as an alternative to the  when one or more of the cell counts in a 2×2 table is less than 5. 

Fisher’s Exact Test uses the following null and alternative hypotheses:

  • H0: (null hypothesis) The two variables are independent.
  • H1: (alternative hypothesis) The two variables are not independent.

Suppose we have the following 2×2 table:

Group 1 Group 2 Row Total
Category 1 a b a+b
Category 2 c d c+d
Column Total a+c b+d a+b+c+d = n

The one-tailed p value for Fisher’s Exact Test is calculated as:

p = (a+b)!(c+d)!(a+c)!(b+d)! / (a!b!c!d!n!)

This produces the same p value as the CDF of the with the following parameters:

  • population size = n
  • population “successes” = a+b
  • sample size = a + c
  • sample “successes” = a

The two-tailed p value for Fisher’s Exact Test is less straightforward to calculate and can’t be found by simply multiplying the one-tailed p value by two. To find the two-tailed p value, we recommend using the .

Fisher’s Exact Test: Example

Suppose we want to know whether or not gender is associated with political party preference. We take a simple random sample of 25 voters and survey them on their political party preference. The following table shows the results of the survey:

Democrat Republican Total
Male 4 9 13
Female 8 4 12
Total 12 13 25

Step 1: Define the hypotheses.

We will perform Fisher’s Exact Test using the following hypotheses:

  • H0Gender and political party preference are independent.
  • H1: Gender and political party preference are not independent.

Step 2: Calculated the two-tailed p value.

Fisher's Exact test example

The two-tailed p value is 0.115239. Since this value is less than 0.05, we fail to reject the null hypothesis. We do not have sufficient evidence to say that there is any statistically significant association between gender and political party preference.

Additional Resources

The following tutorials explain how to perform a Fisher’s Exact Test using different statistical programs:

How to Perform Fisher’s Exact Test in SPSS
How to Perform Fisher’s Exact Test in Python

x