Mastering Maximum Likelihood Estimation
Introduction to Maximum Likelihood Estimation
What's the Best Guess?
Imagine you find a strange coin. You flip it 10 times and get this sequence: Heads, Tails, Heads, Heads, Heads, Tails, Heads, Heads, Tails, Heads. That’s 7 heads and 3 tails. What's your best guess for the true probability of this coin landing on heads? Most people would say 7/10 or 0.7. This intuition is the heart of a powerful statistical method called Maximum Likelihood Estimation (MLE).
Maximum likelihood estimation is a method that determines values for the parameters of a model.
MLE asks a simple question: out of all possible values for a parameter (like the probability of heads), which value makes the data we actually observed the most probable? It's a way of fitting a model to data by finding the parameters that best explain what we've seen.
The Likelihood Function
To find this "best" parameter, we use something called a likelihood function. This function, written as , calculates the probability of observing our specific data, given a particular value for the parameter . Our goal is to find the value of that maximizes this function.
For a series of independent events (like our coin flips), the total likelihood is the product of the individual probabilities:
Working with products can be tricky, especially when using calculus to find a maximum. So, we make our lives easier by using the log-likelihood function. The logarithm turns products into sums, which are much simpler to work with.
Since the logarithm function is monotonically increasing, the parameter value that maximizes the likelihood is the same one that maximizes the log-likelihood.
The log-likelihood, often written as or , is just the natural log of the likelihood function:
Now, we have a function we can maximize using calculus: take the derivative with respect to the parameter, set it to zero, and solve.
Example: A Biased Coin
Let's formalize our coin flip example. A single coin flip follows a Bernoulli distribution, which has one parameter, , the probability of heads (a "success"). Let's say getting heads is and tails is . The probability of any single outcome is:
Suppose we observe flips with heads. Our data consists of ones and zeros. The log-likelihood function for all our data is the sum of the individual log-probabilities:
To find the value of that maximizes this, we take the derivative with respect to and set it to zero.
Solving this equation for gives us the maximum likelihood estimate, which we denote with a hat: .
The result is exactly what our intuition told us! The best estimate for the probability of heads is the number of heads we observed divided by the total number of flips. For our initial example, .
Example: A Normal Distribution
MLE isn't just for simple cases. Let's find the MLE for the parameters of a normal (Gaussian) distribution: the mean and the variance . The probability density function (PDF) for a single data point from a normal distribution is:
The log-likelihood for data points is the sum of the logs of their PDFs:
We have two parameters, so we need to take a partial derivative with respect to each one and set them to zero.
First, for the mean :
The MLE for the population mean is simply the sample mean. Again, this matches our intuition.
Next, for the variance :
The MLE for the variance is the average of the squared differences from the sample mean. It provides a formal justification for using common sense estimates for the parameters of a distribution.
Let's review what we've learned before you try a few problems.
Now, let's test your understanding.
What is the primary goal of Maximum Likelihood Estimation (MLE)?
In the context of MLE, why is the log-likelihood function often used instead of the likelihood function itself?
Maximum Likelihood Estimation provides a consistent and powerful framework for estimating model parameters. By finding the values that make our observed data most probable, it turns an intuitive idea into a rigorous mathematical tool.