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 Chi-Square Test of Independence when one or more of the cell counts in a 2×2 table is less than 5.
This tutorial explains how to perform Fisher’s Exact Test in Stata.
Example: Fisher’s Exact Test in Stata
Suppose we want to know whether or not gender is associated with political party preference at a particular college. To explore this, we randomly poll 25 students on campus. The number of students who are Democrats or Republicans, based on gender, is shown in the table below:
Democrat | Republican | |
---|---|---|
Male | 4 | 9 |
Female | 8 | 4 |
To determine if there is a statistically significant association between gender and political party preference, we can perform Fisher’s Exact Test.
In Stata, we can use the tabi command to perform Fisher’s Exact test. We enter the counts in the 2×2 table from left to right with a to separate the top and bottom rows.
tabi 4 9 8 4
Here is how to interpret the output:
Output table: This table shows the counts for each cell, just as we entered them in.
Fisher’s exact: This is the p-value associated with a two-sided Fisher’s Exact Test. In this case, it is 0.115.
1-sided Fisher’s exact: This is the p-value associated with a one-sided Fisher’s Exact Test. In this case, it is 0.081.
The null hypothesis for Fisher’s Exact Test is that the two variables are independent. In this case, our null hypothesis is that gender and political party preference are independent, which is a two-sided test so we would use the first p-value of 0.115.
Since this p-value is not less than 0.05, we do not reject the null hypothesis. Thus, we don’t have sufficient evidence to say that there is a significant association between gender and political party preference.