10.7 C
London
Sunday, July 7, 2024
HomeStataChi-Square Tests in StataHow to Perform Fisher’s Exact Test in Stata

How to Perform Fisher’s Exact Test in Stata

Related stories

Learn About Opening an Automobile Repair Shop in India

Starting a car repair shop is quite a good...

Unlocking the Power: Embracing the Benefits of Tax-Free Investing

  Unlocking the Power: Embracing the Benefits of Tax-Free Investing For...

Income Splitting in Canada for 2023

  Income Splitting in Canada for 2023 The federal government’s expanded...

Can I Deduct Home Office Expenses on my Tax Return 2023?

Can I Deduct Home Office Expenses on my Tax...

Canadian Tax – Personal Tax Deadline 2022

  Canadian Tax – Personal Tax Deadline 2022 Resources and Tools...

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

Fisher's Exact Test output in Stata

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.

Subscribe

- Never miss a story with notifications

- Gain full access to our premium content

- Browse free from up to 5 devices at once

Latest stories