Get startedGet started for free

Fisher's Exact test

1. Fisher's Exact test

The Fisher's Exact test is another analysis for categorical data.

2. Specifications

When a non-parametric test of categorical data is required, such as whether Cheese and Pepperoni pizza will be eaten again, and the sample size is less than 1000 subjects, or when the frequency count is less than five for more than 20% of the condition comparisons, the Fisher’s Exact test is an appropriate alternative to the chi-square test. Typically, the Fisher’s exact is used for a two by two frequency table, as it is computationally intensive for larger frequency tables. Some statistical software is unable to compute Fisher's Exact test on tables larger than two by two but R can analyze larger tables. The computation is intensive as the Fisher’s Exact test gives an exact p-value, unlike the chi-square test approximation. Another major aspect of the Fisher’s Exact test is the probability of results are calculated from a hypergeometric distribution. This is a probability of determining the likelihood that the frequencies in the table are less than or equal to the table input to the test. For example, the probability of 80 or less of the 500 subjects not wanting to eat Pepperoni pizza again.

3. Hypotheses

The hypotheses for this test are the same as the Chi-square test. The null hypothesis is that there is no relationship between eating the pizza again and topping groups.

4. Sample

Recall the required sample size from the chi-square test was 964 subjects, indicated with N in the output, for an effect size of point-one, two degrees of freedom, point-eight power, and alpha of point-zero-five. Instead of acquiring 1000 subjects for each pizza type as for the Chi-Square test of Independence, this experiment gathered 1000 subjects total, with 500 subjects in each Pepperoni and Cheese pizza groups. With the smaller sample size of 1000 total, and a reduction of eating again to only Yes and No, a Fisher's Exact test should be run rather than the Chi-square test of independence.

5. Test

Similar to the Chi-square test, the frequency table of the variables is called in the function fisher-dot-test to run the Fisher’s Exact test. The significant test indicates there is a relationship between the pizza topping group and interest in eating the pizza again.

6. Effect size

The odds ratio output from fisher-dot-test is used as the effect size for this test. The odds ratio indicates the odds of one condition over the other for the opposite variable. A small effect using odds ratio is a value of one-point-five, a medium effect is two-point-five, and a large effect is four. For example, the odds ratio of point-six-two from our test indicates a small effect size. The small odds ratio effect size of point-six-two indicates the odds of wanting to eat the pizza again while the topping is Pepperoni is point-six-two times more than wanting to eat the pizza again while the topping is Cheese.

7. Power

We can use the pwr-dot-two-p-dot-test function of the pwr package to run a power analysis, indicating the odds ratio with h, the number of observations per sample with n, and p-value with sig-dot-level. A large power is found here, indicating high confidence in the test result. The pizza topping groups are likely related to the interest in eating the pizza again.

8. Let's practice!

Let's work on Fisher's Exact tests.