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
- Select test type: Choose between one-tailed or two-tailed Fisher's Exact Test
- 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
- Calculate: Click to compute the exact p-value
- 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:
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:
Two-tailed Fisher's Exact Test:
Fisher's Exact Test Calculation Method
The Fisher's Exact Test calculator implements the following algorithm:
- Calculate observed probability: Compute the hypergeometric probability for the input contingency table
- One-tailed test: Sum probabilities for all tables with outcomes as extreme or more extreme in the predicted direction
- Two-tailed test: Sum probabilities for all possible tables with probability ≤ observed probability
- 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:
- Small sample sizes: Total n < 1000 or any expected cell frequency < 5
- Exact p-values needed: When precise probability calculations are required
- 2×2 contingency tables: Testing independence between two binary variables
- Medical research: Clinical trials with small patient groups
- 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
Aspect | Fisher's Exact Test | Chi-Square Test |
---|---|---|
Sample size | Small samples (n < 1000) | Large samples (n ≥ 1000) |
Expected frequencies | Any frequency | All cells ≥ 5 |
P-value type | Exact probability | Approximate |
Computational cost | Higher | Lower |
Accuracy | Exact | Asymptotic 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
1# R implementation
2# Create contingency table
3table <- matrix(c(8, 2, 3, 7), nrow = 2, byrow = TRUE)
4
5# Fisher's Exact Test
6result <- fisher.test(table)
7print(paste("P-value:", result$p.value))
8
1// JavaScript implementation (simplified)
2function fisherExactTest(a, b, c, d, testType) {
3 // Uses hypergeometric distribution
4 // Implementation matches our calculator
5 return calculateFishersExactTest(a, b, c, d, testType);
6}
7
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
- 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.
- 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.
- Agresti, A. (2018). "An Introduction to Categorical Data Analysis" (3rd ed.). Wiley.
- 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.
Related Tools
Discover more tools that might be useful for your workflow