Maximum Likelihood for the Binomial Distribution, Clearly Explained!!!

StatQuest with Josh Starmer · Beginner ·🔢 Mathematical Foundations ·7y ago

Key Takeaways

This video explains how to calculate the maximum likelihood estimate for the binomial distribution, building on previous StatQuests on maximum likelihood and probability versus likelihood. It covers the formulas and steps to calculate the maximum likelihood estimate for P, the probability of success, given the number of successes and trials.

Full Transcript

maximum likelihood the binomial distribution that's what we'll talk about today stat quest hello I'm Josh stormer and welcome to stat quest today we're going to talk about maximum likelihood for the binomial distribution and it's gonna be clearly explained note this stat quest follows up on the stat quest maximum likelihood clearly explained as well as the stat quest probability versus likelihood and lastly this stat quest assumes you are already familiar with the binomial distribution if not check out the stat quest the binomial distribution and test clearly explained in the stat quest on the binomial distribution and test we use the binomial distribution aka this nasty-looking thing to determine if in general people like orange Fanta more than grape Fanta in the context of this problem X is the number of people who preferred orange Fanta in this case x equals 4 n is the total number of people we asked about whether they preferred orange Fanta or grape Fanta in this case in equals 7 and P is the probability somebody would randomly choose orange Fanta over grape Fanta in this case P equals 0.5 all together the left side of the equation reads the probability of X the number of people who say they prefer orange Fanta given in the number of people we asked and P the probability of picking orange Fanta then we just plug the numbers in and chugged away at the math and the probability that 4 out of 7 people would randomly prefer orange Fanta is zero point 2 7 3 now if we want to calculate the likelihood of P equals 0.5 then all we need to do is rearrange the left side of the equation that is to say we change this to this now the left side of the equation reads the likelihood of P the probability of picking orange Fanta given in the number of people we asked and X the number of people who say they prefer orange Fanta the right side of the equation however stays the same and this is now the likelihood of P equals 0.5 given that four out of seven people would randomly prefer orange Fanta just a reminder when we calculate likelihoods for P we can plug in different values for it while the observed data in equals 7 and x equals four remains fixed in other words we can calculate the likelihoods for different values of P given that four out of seven people said they preferred orange Fanta for example the likelihood of P equals 0.25 given that four out of seven people said they prefer two orange Fanta is plug and chug plug and chug plug and chug 0.058 the likelihood of P equals 0.25 given that four out of seven people would randomly prefer orange Fanta is less than 0.2 7/3 the likelihood when P equals 0.5 we can also calculate the likelihood of P equals 0.57 given that four out of seven people said they preferred orange Fanta plug and chug plug and chug plug and chug and we get zero point two nine four the likelihood of P equals zero point five seven given that four out of seven people would randomly prefer orange Fanta is greater than zero point two seven three the likelihood when P equals zero point five we can plot the likelihood with a bunch of different values for P between zero and one tada this peak is the maximum likelihood the slope of the curve at the peak is zero that means we can solve for the value for P that results in the maximum likelihood by finding where the derivative I II the slope is equal to 0 so let's do it here's the original likelihood function with n equals 7 and x equals 4 the first thing we do is take the log of the likelihood function we do this because the original likelihood function and its log will both reach the maximum using the same value for P and it's way easier to take the derivative of the log of the likelihood function compared to the original function to see this here is a plot of the likelihood function and here is the log of the likelihood function both have peaks at the same value for P the log function turns the multiplication into addition and it turns the exponents into multiplication if this log stuff is freaking you out well don't freak out just watch the stat quest on logs now we're ready to take the derivative but first because we are running out of room we'll move this to the top of the screen okay now we take the derivative with respect to P this first part doesn't contain P at all so it's derivative equals zero the derivative of the second part is just four times one over P the derivative of this last part is a little tricky since we need to apply the chain rule so we start with 7 minus 4 times the derivative of the log of 1 minus P and we multiply that by the derivative of 1 minus P then we simplify and plug it in BAM [Music] now we set the derivative to zero because we want to find the peak where the slope of the curve equals zero and that will tell us which value for P gives the maximum likelihood now multiply both sides by P times 1 minus P now multiply out 4 times 1 minus P now combine negative 4 P and negative 3p then just solve for P the maximum likelihood estimate for P is for the number of people who preferred orange Fanta divided by 7 the total number of people we asked double bam okay we just solved for the maximum likelihood estimate for P when we have data for X and n however we don't actually need data to determine a general formula for the maximum likelihood for P this formula will give us the maximum likelihood estimate for P when there are X successes in n trials that's how you say it using fancy statistics lingo we'll start with the original likelihood function however this time all of the variables P X and n are unknown just like before we take the log of the likelihood function because it will make solving for the derivative way easier and just like before the log function turns the multiplication into addition and the exponents into multiplication now we're ready to take the derivative and just like before because we are running out of room we will move this to the top of the screen okay now we take the derivative with respect to P the first part does not contain P so it's derivative is zero the derivative of the second part is just x times 1 over P and just like before we have to use the chain rule to figure out the derivative of this last part so we start with n minus x times the derivative of the log of 1 minus P and we multiply that by the derivative of 1 minus P then we simplify and plug it in then just like before we set the derivative to zero note different values for n and X will result in different curves but the slope is still zero at the maximum likelihood now multiply both sides by P times 1 minus P now multiply out x times 1 minus P and now negative XP and positive XP cancel each other out then just solve for P in this case the maximum likelihood estimate for P is X the number of successes divided by n the total number of trials BAM some of you may be saying to yourself duh what's the big deal the maximum likelihood estimate for P is just the average that's obvious well I agree once you know the solution it's pretty obvious but now we also have a mathematical proof that backs up our intuition and to me that's a very comforting thing triple bail hooray we've made it to the end of another exciting stat quest if you liked this tech quest and want to see more of them please subscribe and if you want to support stat quest well click the like button below and consider buying one or two of my original songs alright until next time quest on

Original Description

Calculating the maximum likelihood estimate for the binomial distribution is pretty easy! This StatQuest takes you through the formulas one step at a time. This StatQuest follows up and builds on the following StatQuests: Maximum Likelihood, Clearly Explained: https://youtu.be/XepXtl9YKwc Probability vs Likelihood: https://youtu.be/pYxNSUDSFH4 Logs, Clearly Explained!!!: https://youtu.be/VSi0Z04fWj0 The Binomial Distribution and Test, Clearly Explained!!! https://youtu.be/J8jNoF-K8E8 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 #statquest #MLE #binomial
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 · 0 of 60

← Previous Next →
1 Cutting Butter
Cutting Butter
StatQuest with Josh Starmer
2 onion-dice
onion-dice
StatQuest with Josh Starmer
3 R-squared, Clearly Explained!!!
R-squared, Clearly Explained!!!
StatQuest with Josh Starmer
4 Wrapping up dumplings for pot stickers.
Wrapping up dumplings for pot stickers.
StatQuest with Josh Starmer
5 The standard error, Clearly Explained!!!
The standard error, Clearly Explained!!!
StatQuest with Josh Starmer
6 That Dude (in the movies)
That Dude (in the movies)
StatQuest with Josh Starmer
7 How to puree garlic
How to puree garlic
StatQuest with Josh Starmer
8 Confidence Intervals, Clearly Explained!!!
Confidence Intervals, Clearly Explained!!!
StatQuest with Josh Starmer
9 RPKM, FPKM and TPM, Clearly Explained!!!
RPKM, FPKM and TPM, Clearly Explained!!!
StatQuest with Josh Starmer
10 Principal Component Analysis (PCA) clearly explained (2015)
Principal Component Analysis (PCA) clearly explained (2015)
StatQuest with Josh Starmer
11 StatQuest: RNA-seq - the problem with technical replicates
StatQuest: RNA-seq - the problem with technical replicates
StatQuest with Josh Starmer
12 That's Alright
That's Alright
StatQuest with Josh Starmer
13 Christmas In Rio! (now on iTunes!)
Christmas In Rio! (now on iTunes!)
StatQuest with Josh Starmer
14 Drawing and Interpreting Heatmaps
Drawing and Interpreting Heatmaps
StatQuest with Josh Starmer
15 Rachel's Song (the ballad of Hazel Motes)
Rachel's Song (the ballad of Hazel Motes)
StatQuest with Josh Starmer
16 Deal With It
Deal With It
StatQuest with Josh Starmer
17 Say Your Goodbyes
Say Your Goodbyes
StatQuest with Josh Starmer
18 Another Day
Another Day
StatQuest with Josh Starmer
19 StatQuest: Linear Discriminant Analysis (LDA) clearly explained.
StatQuest: Linear Discriminant Analysis (LDA) clearly explained.
StatQuest with Josh Starmer
20 Maybe It'll Go Away
Maybe It'll Go Away
StatQuest with Josh Starmer
21 Nasty Weather
Nasty Weather
StatQuest with Josh Starmer
22 Roses
Roses
StatQuest with Josh Starmer
23 p-hacking and power calculations
p-hacking and power calculations
StatQuest with Josh Starmer
24 I Love You
I Love You
StatQuest with Josh Starmer
25 The Coldest Day of the Year
The Coldest Day of the Year
StatQuest with Josh Starmer
26 Psycho Killer
Psycho Killer
StatQuest with Josh Starmer
27 False Discovery Rates, FDR, clearly explained
False Discovery Rates, FDR, clearly explained
StatQuest with Josh Starmer
28 A New Song
A New Song
StatQuest with Josh Starmer
29 StatQuickie: Thresholds for Significance
StatQuickie: Thresholds for Significance
StatQuest with Josh Starmer
30 Logs (logarithms), Clearly Explained!!!
Logs (logarithms), Clearly Explained!!!
StatQuest with Josh Starmer
31 Bar Charts Are Better than Pie Charts
Bar Charts Are Better than Pie Charts
StatQuest with Josh Starmer
32 Mr  Hattie
Mr Hattie
StatQuest with Josh Starmer
33 StatQuickie: Which t test to use
StatQuickie: Which t test to use
StatQuest with Josh Starmer
34 Fisher's Exact Test and the Hypergeometric Distribution
Fisher's Exact Test and the Hypergeometric Distribution
StatQuest with Josh Starmer
35 Standard Deviation vs Standard Error, Clearly Explained!!!
Standard Deviation vs Standard Error, Clearly Explained!!!
StatQuest with Josh Starmer
36 StatQuest: DESeq2, part 1, Library Normalization
StatQuest: DESeq2, part 1, Library Normalization
StatQuest with Josh Starmer
37 The Rainbow
The Rainbow
StatQuest with Josh Starmer
38 StatQuest: edgeR, part 1, Library Normalization
StatQuest: edgeR, part 1, Library Normalization
StatQuest with Josh Starmer
39 The Main Ideas behind Probability Distributions
The Main Ideas behind Probability Distributions
StatQuest with Josh Starmer
40 StatQuest:  One or Two Tailed P-Values
StatQuest: One or Two Tailed P-Values
StatQuest with Josh Starmer
41 Evil Genius
Evil Genius
StatQuest with Josh Starmer
42 Sampling from a Distribution, Clearly Explained!!!
Sampling from a Distribution, Clearly Explained!!!
StatQuest with Josh Starmer
43 StatQuest: edgeR and DESeq2, part 2 - Independent Filtering
StatQuest: edgeR and DESeq2, part 2 - Independent Filtering
StatQuest with Josh Starmer
44 The Main Ideas of Fitting a Line to Data (The Main Ideas of Least Squares and Linear Regression.)
The Main Ideas of Fitting a Line to Data (The Main Ideas of Least Squares and Linear Regression.)
StatQuest with Josh Starmer
45 The Sum of Regrets
The Sum of Regrets
StatQuest with Josh Starmer
46 Lowess and Loess, Clearly Explained!!!
Lowess and Loess, Clearly Explained!!!
StatQuest with Josh Starmer
47 StatQuest: Hierarchical Clustering
StatQuest: Hierarchical Clustering
StatQuest with Josh Starmer
48 StatQuest: K-nearest neighbors, Clearly Explained
StatQuest: K-nearest neighbors, Clearly Explained
StatQuest with Josh Starmer
49 Your Dark Side
Your Dark Side
StatQuest with Josh Starmer
50 Boxplots are Awesome!!!
Boxplots are Awesome!!!
StatQuest with Josh Starmer
51 What is a (mathematical) model?
What is a (mathematical) model?
StatQuest with Josh Starmer
52 Linear Regression, Clearly Explained!!!
Linear Regression, Clearly Explained!!!
StatQuest with Josh Starmer
53 Linear Regression in R, Step-by-Step
Linear Regression in R, Step-by-Step
StatQuest with Josh Starmer
54 Maximum Likelihood, clearly explained!!!
Maximum Likelihood, clearly explained!!!
StatQuest with Josh Starmer
55 Brothers
Brothers
StatQuest with Josh Starmer
56 Using Linear Models for t-tests and ANOVA, Clearly Explained!!!
Using Linear Models for t-tests and ANOVA, Clearly Explained!!!
StatQuest with Josh Starmer
57 StatQuest: How to make a Mean Pizza Crust!!!
StatQuest: How to make a Mean Pizza Crust!!!
StatQuest with Josh Starmer
58 StatQuest: A gentle introduction to RNA-seq
StatQuest: A gentle introduction to RNA-seq
StatQuest with Josh Starmer
59 I'm Alive
I'm Alive
StatQuest with Josh Starmer
60 StatQuest: t-SNE, Clearly Explained
StatQuest: t-SNE, Clearly Explained
StatQuest with Josh Starmer

This video explains how to calculate the maximum likelihood estimate for the binomial distribution. It covers the formulas and steps to calculate the maximum likelihood estimate for P, the probability of success, given the number of successes and trials. The video provides a mathematical proof for the maximum likelihood estimate and shows how to derive it using the log likelihood function and its derivative.

Key Takeaways
  1. Understand the binomial distribution and its parameters
  2. Calculate the likelihood function for the binomial distribution
  3. Take the log of the likelihood function to simplify calculations
  4. Take the derivative of the log likelihood function with respect to P
  5. Set the derivative to zero and solve for P
  6. Derive the maximum likelihood estimate for P using the formula X/n
💡 The maximum likelihood estimate for P is X/n, which is the average number of successes divided by the total number of trials.

Related Reads

Up next
Solve Any Math Problem Step by Step — Free (Type or Snap a Photo)
Zariga Tongy
Watch →