Fisher's Exact Test Calculator

Analyze 2x2 contingency tables for statistical significance, especially with small sample sizes.

Enter the four values of your 2x2 contingency table below to calculate the one-tailed and two-tailed p-values, along with the odds ratio.

Practical Examples

Explore different scenarios to understand how Fisher's Exact Test works.

New Drug Efficacy

Medical Study

A clinical trial tests a new drug. Group 1 (Treatment) has 9 successes and 1 failure. Group 2 (Placebo) has 2 successes and 8 failures.

a: 9

b: 1

c: 2

d: 8

Gene-Disease Association

Genetics

Researchers investigate a link between a specific gene variant and a disease. Group 1 (Gene Variant) has 7 cases with the disease and 3 without. Group 2 (No Variant) has 1 case with the disease and 12 without.

a: 7

b: 3

c: 1

d: 12

Teaching Method Success

Education

A study compares two teaching methods. In Group 1 (Method A), 10 students passed and 2 failed. In Group 2 (Method B), 5 students passed and 8 failed.

a: 10

b: 2

c: 5

d: 8

Ad Campaign Conversion

Marketing

An A/B test for an ad campaign. Group 1 (Ad A) resulted in 4 conversions and 100 non-conversions. Group 2 (Ad B) resulted in 0 conversions and 110 non-conversions.

a: 4

b: 100

c: 0

d: 110

Other Titles
Understanding Fisher's Exact Test: A Comprehensive Guide
Delve into the theory, application, and interpretation of one of statistics' most precise tests for categorical data.

What is Fisher's Exact Test?

  • Core Principles
  • When to Use It
  • The Hypergeometric Distribution
Fisher's Exact Test is a statistical significance test used in the analysis of contingency tables. Although in practice it is employed when sample sizes are small, it is valid for all sample sizes. It is named after its inventor, R. A. Fisher, and is one of a class of exact tests, so called because the significance of the deviation from a null hypothesis can be calculated exactly, rather than relying on an approximation that becomes accurate in the limit of large sample sizes.
Core Principles
The test is used to examine the significance of the association (contingency) between two kinds of classifications. For instance, in a medical study, one classification could be whether a patient received a new drug or a placebo, and the other could be whether the patient's condition improved or not. The test assumes that the row and column totals are fixed (known) and calculates the exact probability of obtaining the observed cell frequencies by chance, given these marginal totals.
When to Use It
Fisher's Exact Test is the best choice for a 2x2 contingency table when sample sizes are small. The chi-squared test is an alternative, but its approximation becomes inaccurate with small expected frequencies. A common rule of thumb is to use Fisher's Exact Test when the expected value in any cell of a contingency table is below 5.

Step-by-Step Guide to Using the Calculator

  • Data Entry
  • Calculation
  • Interpreting the Results
Using this calculator is a straightforward process. It requires you to have your data organized in a 2x2 contingency table format.
1. Data Entry
The 2x2 table represents two groups and two outcomes. You need to input four values into the corresponding cells: Cell A (Group 1, Outcome 1), Cell B (Group 1, Outcome 2), Cell C (Group 2, Outcome 1), and Cell D (Group 2, Outcome 2). Ensure all values are non-negative integers.
2. Calculation
Once the data is entered, click the 'Calculate' button. The tool will instantly compute the p-values and the odds ratio based on the hypergeometric distribution formula.
3. Interpreting the Results
The key output is the Two-Tailed P-Value. A small p-value (typically < 0.05) suggests that the observed association between the variables is statistically significant. The Odds Ratio quantifies the strength of the association. An odds ratio of 1 indicates no association, while a value greater than 1 suggests a positive association, and less than 1 suggests a negative association.

Real-World Applications of Fisher's Exact Test

  • Clinical Trials
  • Genetic Research
  • Social Sciences
Clinical Trials
In medicine, it's used to compare the effectiveness of a treatment vs. a placebo. For example, testing if a new vaccine prevents a disease by comparing the number of vaccinated vs. unvaccinated individuals who get sick.
Genetic Research
To determine if a particular gene allele is associated with a specific trait or disease. For instance, analyzing the frequency of an allele in a group of patients compared to a healthy control group.
Social Sciences
In sociology or marketing, it can be used to analyze survey results. For example, testing if there's a significant association between gender and preference for a particular product.

Mathematical Derivation and Formula

  • The Contingency Table
  • The Hypergeometric Probability Formula
  • Calculating P-Values
The Contingency Table
The data is laid out in a 2x2 table: [[a, b], [c, d]]. The row totals are (a+b) and (c+d), and column totals are (a+c) and (b+d). The total number of observations is n = a+b+c+d.
The Hypergeometric Probability Formula
The probability of observing this specific arrangement of data, given the fixed marginal totals, is given by the hypergeometric distribution: p = [ (a+b)! (c+d)! (a+c)! (b+d)! ] / [ n! a! b! c! d! ]. Here, '!' denotes the factorial.
Calculating P-Values
The one-tailed p-value is the sum of probabilities of all tables that are as or more extreme in one direction. The two-tailed p-value is the sum of probabilities for all tables that are equally or less probable than the observed table. This requires iterating through all possible tables with the same marginals.

Common Misconceptions and Correct Methods

  • Fisher's Test vs. Chi-Squared Test
  • One-Tailed vs. Two-Tailed Tests
  • Correlation vs. Causation
Fisher's Test vs. Chi-Squared Test
A common point of confusion is when to use Fisher's test versus the chi-squared (χ²) test. The chi-squared test is an approximation and works well for large samples. Fisher's test is an exact method and is preferred for small sample sizes or when expected cell counts are low (e.g., less than 5). When in doubt, especially with a 2x2 table, Fisher's test is a safer choice.
One-Tailed vs. Two-Tailed Tests
A one-tailed test is used when you have a directional hypothesis (e.g., Group A is better than Group B). A two-tailed test is used when the hypothesis is non-directional (e.g., is there a difference between Group A and Group B?). In most scientific research, the two-tailed test is the standard unless there is a very strong a priori reason to use a one-tailed test.
Correlation vs. Causation
A significant p-value from Fisher's Exact Test indicates a statistically significant association between the two variables. It does not, however, imply causation. It means the variables are unlikely to be independent, but it doesn't explain why. Establishing causality requires a well-designed experimental study and further domain-specific evidence.