Fisher's Exact Test and the Hypergeometric Distribution
Key Takeaways
Fisher's exact test and the Hypergeometric distribution are used to determine if a sample is enriched, as demonstrated with an example of M&M's colors, calculating a p-value from the sample to assess its significance.
Full Transcript
hello and welcome to a stat quickie today we're going to talk about Fisher's exact test and enrichment analysis but first let's eat some M&Ms I want to share some with my friends so I just take one handful and get seven blue and one red what does this say about the distribution of colors in the bag do I have more blues than normal lastly can I calculate a p-value from this delicious sample this bags supposed to have two servings and I think a serving of M&Ms is twenty M&Ms so there must be 40mm s in the bag I looked up the proportions of the different colors of M&Ms on the internet and this is what I found so on the right we have a histogram of an idealized bag of M&Ms I'm going to use the histogram of the ideal bag of M&Ms based on the proportions I got off the internet and my sample my handful of M&Ms to determine if my bag is special in this example I don't care about the order of how the M&Ms fell into my hand so let's consider every possible ordering of seven blue and one red as legit let's start by calculating the probability of getting seven blue M&Ms followed by a single red M&M the probability that the first M&M is blue equals eight divided by 48 because there are eight blue M&Ms divided by 40 because there are 40 M&Ms total now that I've got one M&M in my hand there are only seven blue M&Ms left in the bag the probability that the second M&M is blue equals 7 divided by 39 7 because there are now only 7 blue M&Ms in the bag divided by 39 because there are only 39 mm/s now there are only six blue M&Ms left in the bag the probability of getting a third blue M&M is 6 over 38 leaving five blue M&Ms left in the bag and by now you've probably grasped the pattern for how we determine the probabilities for getting a sequence of blue M&Ms once we have calculated the probabilities for getting 7 blue M&Ms in our hand we can now calculate the probability of getting 1 red M&M that's just 5 over 33 five because there are five red M&Ms divided by 33 because there are 33 M&Ms left in the bag at this point now just multiply all those probabilities together to get the probability of getting 7 blues followed by one red and that just equals a really small number that's rare but remember we don't care about order there's more work to do to get the probability of seven blues and one red in any order to calculate the probability of getting seven blues and one red we have to add together the probabilities of each possible ordering the good news is that the process of calculating the probabilities is the same as what we just did good thing we have computers because they'll do the work for us anyways the probability is still really small now what's the p-value if you'll remember from the p-value stat quest sometimes you can have very small probabilities but really large p-values and remember a p-value is the sum of the probabilities of all things equally rare or rarer this is all covered in the stat quest on p-values so that includes adding the probability of getting eight Blues in a row or seven oranges in one blue because that's equally rare and actually there are a lot of different ways you can come up with things that are equally rare or rarer too many to put on this stack quickie so we're just going to skip to the chase again good thing we have computers the p-value ends up being 0.01 so my bag is special hooray we just performed Fisher's exact test on the M&Ms enrichment for other things like does this list of genes have more involved in metabolism than normal it's done the exact same way and for any of you stat Questers that use our a programming language for doing statistics I provided the R code for doing the Fisher's exact test that we performed on the MMS in the description below hooray tune in next week for another stat quickie
Original Description
Fisher's exact test to determine if something is enriched or not. In this case, I wonder if I got an over abundance of blue m&m's.
For a complete index of all the StatQuest videos, check out:
https://statquest.org/video-index/
If you'd like to support StatQuest, please consider...
Patreon: https://www.patreon.com/statquest
...or...
YouTube Membership: https://www.youtube.com/channel/UCtYLUTtgS3k1Fg4y5tAhLbw/join
...buying one of my books, a study guide, a t-shirt or hoodie, or a song from the StatQuest store...
https://statquest.org/statquest-store/
...or just donating to StatQuest!
https://www.paypal.me/statquest
Lastly, if you want to keep up with me as I research and create new StatQuests, follow me on twitter:
https://twitter.com/joshuastarmer
Correction:
4:15 I say getting 7 oranges and 1 blue is just as rare a getting 7 blues and 1 red. This is incorrect, since there are more blues and oranges in general than there are blues and red. However, the idea that we add up rarer events is correct.
#statquest #statistics
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from StatQuest with Josh Starmer · StatQuest with Josh Starmer · 34 of 60
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
▶
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Cutting Butter
StatQuest with Josh Starmer
onion-dice
StatQuest with Josh Starmer
R-squared, Clearly Explained!!!
StatQuest with Josh Starmer
Wrapping up dumplings for pot stickers.
StatQuest with Josh Starmer
The standard error, Clearly Explained!!!
StatQuest with Josh Starmer
That Dude (in the movies)
StatQuest with Josh Starmer
How to puree garlic
StatQuest with Josh Starmer
Confidence Intervals, Clearly Explained!!!
StatQuest with Josh Starmer
RPKM, FPKM and TPM, Clearly Explained!!!
StatQuest with Josh Starmer
Principal Component Analysis (PCA) clearly explained (2015)
StatQuest with Josh Starmer
StatQuest: RNA-seq - the problem with technical replicates
StatQuest with Josh Starmer
That's Alright
StatQuest with Josh Starmer
Christmas In Rio! (now on iTunes!)
StatQuest with Josh Starmer
Drawing and Interpreting Heatmaps
StatQuest with Josh Starmer
Rachel's Song (the ballad of Hazel Motes)
StatQuest with Josh Starmer
Deal With It
StatQuest with Josh Starmer
Say Your Goodbyes
StatQuest with Josh Starmer
Another Day
StatQuest with Josh Starmer
StatQuest: Linear Discriminant Analysis (LDA) clearly explained.
StatQuest with Josh Starmer
Maybe It'll Go Away
StatQuest with Josh Starmer
Nasty Weather
StatQuest with Josh Starmer
Roses
StatQuest with Josh Starmer
p-hacking and power calculations
StatQuest with Josh Starmer
I Love You
StatQuest with Josh Starmer
The Coldest Day of the Year
StatQuest with Josh Starmer
Psycho Killer
StatQuest with Josh Starmer
False Discovery Rates, FDR, clearly explained
StatQuest with Josh Starmer
A New Song
StatQuest with Josh Starmer
StatQuickie: Thresholds for Significance
StatQuest with Josh Starmer
Logs (logarithms), Clearly Explained!!!
StatQuest with Josh Starmer
Bar Charts Are Better than Pie Charts
StatQuest with Josh Starmer
Mr Hattie
StatQuest with Josh Starmer
StatQuickie: Which t test to use
StatQuest with Josh Starmer
Fisher's Exact Test and the Hypergeometric Distribution
StatQuest with Josh Starmer
Standard Deviation vs Standard Error, Clearly Explained!!!
StatQuest with Josh Starmer
StatQuest: DESeq2, part 1, Library Normalization
StatQuest with Josh Starmer
The Rainbow
StatQuest with Josh Starmer
StatQuest: edgeR, part 1, Library Normalization
StatQuest with Josh Starmer
The Main Ideas behind Probability Distributions
StatQuest with Josh Starmer
StatQuest: One or Two Tailed P-Values
StatQuest with Josh Starmer
Evil Genius
StatQuest with Josh Starmer
Sampling from a Distribution, Clearly Explained!!!
StatQuest with Josh Starmer
StatQuest: edgeR and DESeq2, part 2 - Independent Filtering
StatQuest with Josh Starmer
The Main Ideas of Fitting a Line to Data (The Main Ideas of Least Squares and Linear Regression.)
StatQuest with Josh Starmer
The Sum of Regrets
StatQuest with Josh Starmer
Lowess and Loess, Clearly Explained!!!
StatQuest with Josh Starmer
StatQuest: Hierarchical Clustering
StatQuest with Josh Starmer
StatQuest: K-nearest neighbors, Clearly Explained
StatQuest with Josh Starmer
Your Dark Side
StatQuest with Josh Starmer
Boxplots are Awesome!!!
StatQuest with Josh Starmer
What is a (mathematical) model?
StatQuest with Josh Starmer
Linear Regression, Clearly Explained!!!
StatQuest with Josh Starmer
Linear Regression in R, Step-by-Step
StatQuest with Josh Starmer
Maximum Likelihood, clearly explained!!!
StatQuest with Josh Starmer
Brothers
StatQuest with Josh Starmer
Using Linear Models for t-tests and ANOVA, Clearly Explained!!!
StatQuest with Josh Starmer
StatQuest: How to make a Mean Pizza Crust!!!
StatQuest with Josh Starmer
StatQuest: A gentle introduction to RNA-seq
StatQuest with Josh Starmer
I'm Alive
StatQuest with Josh Starmer
StatQuest: t-SNE, Clearly Explained
StatQuest with Josh Starmer
More on: ML Maths Basics
View skill →Related AI Lessons
🎓
Tutor Explanation
DeepCamp AI