Perform Fisher's exact test for 2×2 contingency tables. Compute exact one-tailed and two-tailed p-values, odds ratio with 95% confidence interval, and visualize the hypergeometric distribution.
Fisher's exact test is a statistical significance test used to analyze the association between two categorical variables in a 2×2 contingency table. It was developed by Sir Ronald Fisher in 1935 and is particularly valuable when sample sizes are small — situations where the chi‑square test may produce unreliable approximations. The test computes the exact probability of observing the given table (or a more extreme one) under the null hypothesis that the two variables are independent.
For a table with entries a, b, c, d, the probability of that exact table is:
P = (a+b)! (c+d)! (a+c)! (b+d)! / ( n! · a! · b! · c! · d! )
where n = a + b + c + d is the total number of observations.
The test enumerates all possible 2×2 tables that have the same row and column totals as the observed table. For each such table, it calculates the probability using the hypergeometric distribution. The p-value is the sum of probabilities of tables that are as extreme or more extreme than the observed table, according to the direction of the alternative hypothesis.
A pharmaceutical company conducts a small pilot study to evaluate a new drug for reducing symptom severity. Ten patients receive the drug, and eight receive a placebo. The primary outcome is symptom improvement (yes/no).
| Improved | Not improved | Total | |
|---|---|---|---|
| Drug | 10 | 5 | 15 |
| Placebo | 2 | 8 | 10 |
| Total | 12 | 13 | 25 |
The calculator yields a two‑tailed p‑value of 0.0143, indicating a statistically significant association between treatment and improvement (α = 0.05). The odds ratio is 8.00 (95% CI: 1.25 – 51.2), meaning the odds of improvement are 8 times higher in the drug group compared to placebo. This supports the efficacy of the new drug, though the small sample size warrants further study.
This example uses the default input values. Click the "Clinical Trial" preset to load it instantly.
| Feature | Fisher's Exact Test | Chi‑Square Test |
|---|---|---|
| Exactness | Exact p-value (no approximation) | Approximate (based on chi‑square distribution) |
| Small samples | Valid for any sample size, even very small | Unreliable when expected cell count < 5 |
| Computational cost | Higher (enumerates all possible tables) | Lower (simple formula) |
| Large tables | Can be computationally intensive for large totals | Efficient for large samples |
| Interpretation | Direct probability under the null | Approximate p-value from chi‑square distribution |
| Recommended when | Sample size < 100 or any expected cell < 5 | Large sample, all expected cells ≥ 5 |