AI summary by TwinMind
Fisher's Exact Test and the Hypergeometric Distribution
StatQuest with Josh Starmer
5m 15s
Introduction to Fisher's Exact Test
- Statistical method explained using M&M candy example
- Purpose: determine if sample distribution differs significantly from expected distribution
- Application: enrichment analysis (e.g., gene metabolism studies)
M&M Sample Setup
- Sample: 1 handful = 7 blue M&Ms + 1 red M&M
- Total bag contents: 40 M&Ms (2 servings × 20 M&Ms per serving)
- Expected color proportions obtained from internet research
- Question: Does this bag have more blues than normal?
Probability Calculations
- Order doesn't matter - all arrangements of 7 blue + 1 red considered equal
- Sequential probability calculation for 7 blues followed by 1 red:
- 1st blue: 8/40 (8 blue M&Ms out of 40 total)
- 2nd blue: 7/39 (7 blue remaining out of 39 total)
- 3rd blue: 6/38
- Pattern continues: 5/37, 4/36, 3/35, 2/34
- Final red: 5/33 (5 red M&Ms out of 33 remaining)
- Multiply all probabilities = very small number
Accounting for All Possible Orders
- Must add probabilities for all possible arrangements of 7 blue + 1 red
- Same calculation process for each arrangement
- Computer assistance required for comprehensive calculation
- Final probability still very small
P-Value Calculation
- P-value = sum of probabilities for all outcomes equally rare or rarer
- Includes scenarios like:
- 8 blues in a row
- 7 oranges + 1 blue
- Many other equally rare combinations
- Final p-value: 0.01
- Conclusion: Bag is statistically "special" (significantly different from expected)
Applications and Tools
- Same methodology applies to:
- Gene enrichment analysis
- Metabolic pathway studies
- Any categorical enrichment testing
- R programming code provided for Fisher's exact test implementation
