Wetted Perimeter Calculator for Various Channel Shapes

Calculate the wetted perimeter for various channel shapes including trapezoids, rectangles/squares, and circular pipes. Essential for hydraulic engineering and fluid mechanics applications.

Fisher's Exact Test

Input the values of the 2 x 2 contingency table

📚

Documentation

Fisher's Exact Test Calculator

Introduction

The Fisher's Exact Test is a statistical significance test used to determine if there are nonrandom associations between two categorical variables in small sample sizes. This Fisher's Exact Test calculator provides precise p-values for 2×2 contingency tables when sample sizes are too small for the chi-square test to be reliable. Unlike approximate tests, Fisher's Exact Test gives you exact probability calculations for categorical data analysis.

How to Use This Fisher's Exact Test Calculator

  1. Select test type: Choose between one-tailed or two-tailed Fisher's Exact Test
  2. Enter contingency table values:
    • Cell A: Number of successes in group 1
    • Cell B: Number of failures in group 1
    • Cell C: Number of successes in group 2
    • Cell D: Number of failures in group 2
  3. Calculate: Click to compute the exact p-value
  4. Interpret results: The Fisher's Exact Test p-value indicates statistical significance

The Fisher's Exact Test is essential when total sample size is small (typically n < 1000) or when expected frequencies in any cell are less than 5.

Input Validation

The Fisher's Exact Test calculator performs comprehensive validation:

  • All cell values must be non-negative integers
  • At least one cell must contain a positive value
  • Total sample size should be appropriate for exact testing methods
  • Invalid inputs display error messages with correction guidance

Fisher's Exact Test Formula

The Fisher's Exact Test uses the hypergeometric distribution to calculate exact probabilities:

Probability for a specific table: P=(a+b)!(c+d)!(a+c)!(b+d)!a!b!c!d!n!P = \frac{(a+b)!(c+d)!(a+c)!(b+d)!}{a!b!c!d!n!}

Where:

  • a, b, c, d = cell values in the 2×2 contingency table
  • n = total sample size (a+b+c+d)
  • ! = factorial notation

One-tailed Fisher's Exact Test: Ponetailed=i=amin(r1,c1)r1!r2!c1!c2!i!(r1i)!(c1i)!(r2c1+i)!n!P_{one-tailed} = \sum_{i=a}^{\min(r_1,c_1)} \frac{r_1!r_2!c_1!c_2!}{i!(r_1-i)!(c_1-i)!(r_2-c_1+i)!n!}

Two-tailed Fisher's Exact Test: Ptwotailed=P(table)P(observed)P(table)P_{two-tailed} = \sum_{P(table) \leq P(observed)} P(table)

Fisher's Exact Test Calculation Method

The Fisher's Exact Test calculator implements the following algorithm:

  1. Calculate observed probability: Compute the hypergeometric probability for the input contingency table
  2. One-tailed test: Sum probabilities for all tables with outcomes as extreme or more extreme in the predicted direction
  3. Two-tailed test: Sum probabilities for all possible tables with probability ≤ observed probability
  4. Precision handling: Uses logarithmic calculations to prevent numerical overflow for large factorials

The Fisher's Exact Test provides exact p-values without relying on asymptotic approximations, making it the gold standard for small sample categorical analysis.

When to Use Fisher's Exact Test

Fisher's Exact Test is recommended when:

  1. Small sample sizes: Total n < 1000 or any expected cell frequency < 5
  2. Exact p-values needed: When precise probability calculations are required
  3. 2×2 contingency tables: Testing independence between two binary variables
  4. Medical research: Clinical trials with small patient groups
  5. Quality control: Manufacturing defect analysis with limited samples

Fisher's Exact Test applications:

  • A/B testing with small conversion samples
  • Medical treatment efficacy studies
  • Genetic association studies
  • Survey research with binary outcomes
  • Educational intervention analysis

Fisher's Exact Test vs Chi-Square Test

AspectFisher's Exact TestChi-Square Test
Sample sizeSmall samples (n < 1000)Large samples (n ≥ 1000)
Expected frequenciesAny frequencyAll cells ≥ 5
P-value typeExact probabilityApproximate
Computational costHigherLower
AccuracyExactAsymptotic approximation

Choose Fisher's Exact Test when sample size limitations make chi-square assumptions invalid.

Fisher's Exact Test Examples

Example 1: Medical Treatment Study

  • Treated patients who improved: 8 (Cell A)
  • Treated patients who didn't improve: 2 (Cell B)
  • Control patients who improved: 3 (Cell C)
  • Control patients who didn't improve: 7 (Cell D)
  • Fisher's Exact Test p-value: 0.0524

Example 2: Quality Control Analysis

  • Defective items from Machine A: 1 (Cell A)
  • Good items from Machine A: 19 (Cell B)
  • Defective items from Machine B: 6 (Cell C)
  • Good items from Machine B: 14 (Cell D)
  • Fisher's Exact Test p-value: 0.0456

Code Examples for Fisher's Exact Test

1# Python implementation using scipy
2from scipy.stats import fisher_exact
3
4# 2x2 contingency table
5table = [[8, 2],
6         [3, 7]]
7
8# Two-tailed Fisher's Exact Test
9odds_ratio, p_value = fisher_exact(table, alternative='two-sided')
10print(f"Fisher's Exact Test p-value: {p_value:.4f}")
11

Fisher's Exact Test Interpretation

P-value interpretation:

  • p < 0.001: Extremely strong evidence against null hypothesis
  • p < 0.01: Very strong evidence against null hypothesis
  • p < 0.05: Strong evidence against null hypothesis (significant)
  • p ≥ 0.05: Insufficient evidence to reject null hypothesis

Effect size considerations:

  • Small samples may have large effect sizes but non-significant p-values
  • Consider confidence intervals along with Fisher's Exact Test results
  • Clinical significance vs statistical significance

Frequently Asked Questions

What is Fisher's Exact Test used for? Fisher's Exact Test determines if there's a significant association between two categorical variables in a 2×2 contingency table, especially when sample sizes are small.

When should I use Fisher's Exact Test instead of chi-square? Use Fisher's Exact Test when your total sample size is less than 1000 or when any expected cell frequency is less than 5.

What's the difference between one-tailed and two-tailed Fisher's Exact Test? One-tailed tests for association in a specific direction (predetermined hypothesis), while two-tailed tests for any association without directional prediction.

Can Fisher's Exact Test handle tables larger than 2×2? Standard Fisher's Exact Test is designed for 2×2 tables. For larger contingency tables, use Freeman-Halton extension or other exact tests.

Is Fisher's Exact Test always more accurate than chi-square? Fisher's Exact Test provides exact p-values, making it more accurate for small samples. However, for large samples, chi-square is computationally efficient with negligible accuracy loss.

What assumptions does Fisher's Exact Test make? Fisher's Exact Test assumes fixed marginal totals, independence of observations, and that data follows a hypergeometric distribution.

How do I interpret Fisher's Exact Test confidence intervals? Confidence intervals for the odds ratio provide the range of plausible effect sizes. If the interval excludes 1.0, the association is statistically significant.

Can I use Fisher's Exact Test for paired data? No, Fisher's Exact Test is for independent groups. For paired categorical data, use McNemar's test instead.

References and Further Reading

  1. Fisher, R.A. (1922). "On the interpretation of χ² from contingency tables, and the calculation of P." Journal of the Royal Statistical Society, 85(1), 87-94.
  2. Freeman, G.H. & Halton, J.H. (1951). "Note on an exact treatment of contingency, goodness of fit and other problems of significance." Biometrika, 38(1/2), 141-149.
  3. Agresti, A. (2018). "An Introduction to Categorical Data Analysis" (3rd ed.). Wiley.
  4. McDonald, J.H. (2014). "Handbook of Biological Statistics" (3rd ed.). Sparky House Publishing.

Meta Title: Fisher's Exact Test Calculator - Free Statistical Analysis Tool Meta Description: Calculate exact p-values for 2×2 contingency tables with our Fisher's Exact Test calculator. Perfect for small samples and categorical data analysis in research.