When To Use Fisher's Exact Test

11 min read

Navigating the world of statistical analysis can sometimes feel like traversing a dense jungle. With a myriad of tests available, each made for specific conditions and data types, it’s easy to get lost. Think about it: among these, Fisher’s exact test stands out as a valuable tool, particularly when dealing with small sample sizes or data that doesn’t quite fit the assumptions of other tests. This article will serve as your practical guide to Fisher’s exact test, exploring when to use it, its underlying principles, and how it compares to other statistical methods.

Introduction: Understanding the Need for Fisher’s Exact Test

Imagine you're a researcher investigating the effectiveness of a new drug on a small group of patients. That's why you want to know if the drug has a significant impact on recovery rates. Or perhaps you're an analyst studying the relationship between two categorical variables, such as the association between smoking habits and the occurrence of a specific disease in a limited population. In scenarios like these, Fisher’s exact test becomes your reliable companion.

Fisher's exact test is a statistical significance test used to analyze contingency tables, which display the frequency distribution of categorical variables. Unlike some other tests that rely on approximations, Fisher's exact test calculates the exact probability of observing the given data (or more extreme data) under the null hypothesis of independence. This makes it especially suitable for situations where the sample size is small or when the assumptions of other tests, like the chi-squared test, are not met.

The Core Principles of Fisher’s Exact Test

At its heart, Fisher’s exact test assesses whether two categorical variables are independent. The test operates under the null hypothesis that there is no association between the variables. To understand this better, let's consider a classic example:

Suppose you are studying whether there's a relationship between gender and preference for a certain type of coffee. You survey 20 people and record their gender and coffee preference (either 'A' or 'B'). The data can be organized into a 2x2 contingency table:

Real talk — this step gets skipped all the time That alone is useful..

Coffee A Coffee B Total
Male 6 4 10
Female 1 9 10
Total 7 13 20

Fisher’s exact test calculates the probability of observing this particular arrangement of data, or arrangements that are more extreme, assuming that gender and coffee preference are independent. The "more extreme" arrangements are those that provide even stronger evidence against the null hypothesis.

The Hypergeometric Distribution

The foundation of Fisher’s exact test is the hypergeometric distribution. This distribution describes the probability of k successes (choosing an element with a particular characteristic) in n draws, without replacement, from a finite population of size N that contains exactly K objects with that characteristic Most people skip this — try not to..

In the context of a 2x2 contingency table, the hypergeometric distribution helps us calculate the probability of observing a particular cell value, given the marginal totals are fixed. The formula for the probability is:

P = [(A+B)! And c! (B+D)!(C+D)! B! A! In practice, (A+C)! That said, ] / [N! D!

Where:

  • A, B, C, and D are the cell values in the 2x2 contingency table:

    Group 1 Group 2
    Outcome 1 A B
    Outcome 2 C D
  • N is the total sample size (A + B + C + D)

  • "!g." denotes the factorial function (e., 5!

To calculate the p-value for Fisher’s exact test, you sum the probabilities for the observed table and all more extreme tables (tables that provide stronger evidence against the null hypothesis). A small p-value (typically less than 0.The p-value represents the probability of observing the data (or more extreme data) if the null hypothesis is true. 05) suggests that the null hypothesis is unlikely to be true, and you can reject it in favor of the alternative hypothesis that the two variables are associated Turns out it matters..

When to Use Fisher's Exact Test: The Specific Scenarios

Fisher's exact test shines in specific circumstances. Understanding these scenarios is crucial for selecting the appropriate statistical test for your data. Here are the primary situations where Fisher's exact test is the preferred choice:

  1. Small Sample Sizes: This is the most common reason to use Fisher's exact test. When your sample size is small, the approximations used by other tests, such as the chi-squared test, become unreliable. As a general rule, if any cell in your contingency table has an expected count less than 5 (or some sources suggest less than 10), Fisher's exact test is more appropriate. The chi-squared test relies on the chi-squared distribution being a good approximation of the distribution of the test statistic, and this approximation breaks down with small expected counts. Fisher's exact test, being an exact test, doesn't rely on these approximations.

  2. Data Violating Chi-Squared Assumptions: The chi-squared test assumes that the observations are independent and that the expected cell counts are sufficiently large. When these assumptions are violated, the chi-squared test can produce inaccurate results. Fisher's exact test does not rely on these assumptions and remains valid even when they are not met. This makes it a more strong option in such scenarios.

  3. 2x2 Contingency Tables: Fisher's exact test is specifically designed for 2x2 contingency tables. While other tests can be used for larger contingency tables, Fisher's exact test provides the most accurate results for this specific case, especially when sample sizes are small Most people skip this — try not to..

  4. Categorical Data: Fisher's exact test is designed for categorical data, where variables are divided into categories rather than measured on a continuous scale. Examples include gender, treatment type, or presence/absence of a condition.

  5. Fixed Marginal Totals: In some experimental designs, the marginal totals (the row and column totals in the contingency table) are fixed by the experimental setup. Fisher's exact test is particularly suitable for these situations because it conditions on the observed marginal totals Less friction, more output..

Fisher's Exact Test vs. Chi-Squared Test: A Detailed Comparison

The chi-squared test is another common method for analyzing contingency tables. you'll want to understand the differences between these two tests to choose the appropriate one.

  • Sample Size: As mentioned earlier, Fisher's exact test is preferred for small sample sizes, while the chi-squared test is more appropriate for larger samples Nothing fancy..

  • Assumptions: The chi-squared test has stricter assumptions, including the requirement for large expected cell counts. Fisher's exact test is more solid and can be used when these assumptions are violated.

  • Calculation: The chi-squared test uses an approximation based on the chi-squared distribution, while Fisher's exact test calculates the exact probability.

  • Computation: Fisher's exact test can be computationally intensive for very large sample sizes, although modern software handles most cases efficiently. The chi-squared test is generally faster to compute Simple, but easy to overlook. But it adds up..

In a nutshell, if you have a 2x2 contingency table, small sample sizes, or data that violates the assumptions of the chi-squared test, Fisher's exact test is the more appropriate choice The details matter here. Simple as that..

How to Perform Fisher’s Exact Test

Performing Fisher's exact test is straightforward with modern statistical software. Here's a general outline:

  1. Organize Your Data: Create a 2x2 contingency table with your observed frequencies.

  2. Choose Your Statistical Software: Popular options include R, Python (with libraries like SciPy), SPSS, and SAS Easy to understand, harder to ignore..

  3. Input Your Data: Enter the data from your contingency table into the software.

  4. Run the Test: Use the appropriate function or command to perform Fisher's exact test. To give you an idea, in R, you would use the fisher.test() function That's the part that actually makes a difference..

  5. Interpret the Results: Examine the p-value generated by the test. If the p-value is below your chosen significance level (usually 0.05), you can reject the null hypothesis and conclude that there is a significant association between the two variables Easy to understand, harder to ignore..

Example in R

# Create a contingency table
data <- matrix(c(6, 4, 1, 9), nrow = 2, ncol = 2, byrow = TRUE)
colnames(data) <- c("Coffee A", "Coffee B")
rownames(data) <- c("Male", "Female")

# Perform Fisher's exact test
fisher.test(data)

# Output:

#        Fisher's Exact Test for Count Data

# data:  data
# p-value = 0.007937
# alternative hypothesis: true odds ratio is not equal to 1
# 95 percent confidence interval:
#  1.975309 93.000470
# sample estimates:
# odds ratio
#  13.69863

In this example, the p-value is 0.05. Even so, 007937, which is less than 0. Which means, we would reject the null hypothesis and conclude that there is a significant association between gender and coffee preference But it adds up..

Understanding the Odds Ratio

The output of Fisher's exact test often includes the odds ratio. Day to day, the odds ratio is a measure of association between the two variables. It represents the ratio of the odds of an event occurring in one group to the odds of it occurring in another group.

In the coffee preference example, the odds ratio is 13.69863. Day to day, this means that the odds of a male preferring Coffee A are approximately 13. And 7 times higher than the odds of a female preferring Coffee A. An odds ratio greater than 1 suggests a positive association, while an odds ratio less than 1 suggests a negative association Simple, but easy to overlook..

Real-World Applications of Fisher’s Exact Test

Fisher’s exact test is widely used in various fields, including:

  • Medicine: Evaluating the effectiveness of treatments, assessing the association between risk factors and diseases.
  • Biology: Analyzing genetic data, studying the distribution of species in different environments.
  • Marketing: Assessing the effectiveness of marketing campaigns, analyzing customer preferences.
  • Social Sciences: Studying the relationship between demographic variables and attitudes or behaviors.

Limitations of Fisher's Exact Test

While Fisher's exact test is a powerful tool, it also has some limitations:

  • Only for 2x2 Tables: Fisher's exact test is specifically designed for 2x2 contingency tables. For larger tables, other tests like the chi-squared test or Fisher's exact test extensions are needed.
  • Computational Intensity: For very large sample sizes, the calculations involved in Fisher's exact test can be computationally intensive, although this is less of a concern with modern software.
  • Conservative: Some statisticians argue that Fisher's exact test can be overly conservative, meaning it may fail to detect a significant association when one truly exists (lower statistical power). On the flip side, this conservatism is often seen as a tradeoff for its accuracy and reliability.

Frequently Asked Questions (FAQ)

  • Q: When should I use Fisher's exact test instead of the chi-squared test?

    • A: Use Fisher's exact test when you have a 2x2 contingency table, small sample sizes, or data that violates the assumptions of the chi-squared test (e.g., small expected cell counts).
  • Q: What is a p-value, and how do I interpret it?

    • A: The p-value is the probability of observing the data (or more extreme data) if the null hypothesis is true. A small p-value (typically less than 0.05) suggests that the null hypothesis is unlikely to be true, and you can reject it.
  • Q: What is an odds ratio, and how do I interpret it?

    • A: The odds ratio is a measure of association between two variables. It represents the ratio of the odds of an event occurring in one group to the odds of it occurring in another group. An odds ratio greater than 1 suggests a positive association, while an odds ratio less than 1 suggests a negative association.
  • Q: Can I use Fisher's exact test for larger contingency tables?

    • A: No, Fisher's exact test is specifically designed for 2x2 contingency tables. For larger tables, you would need to use other tests like the chi-squared test or extensions of Fisher's exact test.
  • Q: Is Fisher's exact test always the best choice for small sample sizes?

    • A: In general, yes. On the flip side, you'll want to consider the specific characteristics of your data and research question. In some cases, other tests may be more appropriate, but Fisher's exact test is a reliable and solid option for 2x2 tables with small sample sizes.

Conclusion: Mastering the Art of Choosing the Right Test

Fisher’s exact test is a valuable tool in the statistician’s arsenal, especially when dealing with small sample sizes or data that doesn’t meet the assumptions of other tests. By understanding its underlying principles, knowing when to use it, and appreciating its limitations, you can confidently apply this test to your research and draw accurate conclusions.

Remember, the choice of a statistical test is not merely a procedural step but a critical decision that impacts the validity and reliability of your findings. Fisher's exact test, with its precision and robustness, can be the key to unlocking meaningful insights from your data, particularly when the stakes are high and the sample sizes are modest Most people skip this — try not to..

So, the next time you encounter a 2x2 contingency table with limited data, don’t hesitate to turn to Fisher’s exact test. It might just be the perfect tool to reveal the true relationship between your variables. How will you apply this knowledge to your next research project?

New Content

Out the Door

Round It Out

If This Caught Your Eye

Thank you for reading about When To Use Fisher's Exact Test. We hope the information has been useful. Feel free to contact us if you have any questions. See you next time — don't forget to bookmark!
⌂ Back to Home