medium.com 3 min read Original Source

Understanding Maximum Likelihood Estimation Through a Visual Approach: A Guide for Data Science and…

For more articles like this: visit official website and Join the Discord community of engineers

Introduction

Maximum Likelihood Estimation (MLE) is a statistical method used for parameter estimation to find the distribution that best describes observed data. For example, if observed data closely follows the shape of a Gaussian bell curve, one might ask: What is the best-fitting Gaussian distribution for this data? The MLE method enables us to find the mean and variance of the Gaussian distribution that most accurately represents the data. In other words, it finds the center (mean) and width(variance) of this distribution.

In this article, we will explore this concept through the following visual steps:

  1. Generate synthetic Gaussian histogram data.
  2. Plot the Maximum Likelihood function for the mean.
  3. Identify the Maximum Likelihood Estimate (MLE) for the mean from the plot.
  4. Plot the Maximum Likelihood function for the variance.
  5. Identify the MLE for the variance from the plot.
  6. Finally, construct the Gaussian distribution using the two estimated parameters: mean and variance.

An Observed Gaussian Distributed Histogram

Find Likehood function for the Mean of a Gaussian Distribution:

We’ll plot this function for a range of μ values, keeping _σ_² fixed (using some initial guess ).

The vertical red dashed line represents the Maximum Likelihood Estimate (MLE) for the mean, which is approximately μ=4.91

The next step, we plot the Likelihood Function for Variance

We’ll plot this function for a range of _σ_² values, keeping μ fixed at its MLE value.

The vertical red dashed line represents the Maximum Likelihood Estimate (MLE) for the variance, which is approximately _σ_²=3.90

The last step we plot the gaussian disbtribution with estimated mean and variance

The formula for gaussian distribution is given below (Note x is function argument, u_hat and sigma_hat are the function parameters):

Now that we have our MLE estimates for the mean and variance, let’s plot the Gaussian distribution using these parameters. We’ll overlay this on the histogram of the original data to see how well our estimates fit the data.

Here’s the plot showing the Maximum Likelihood Estimates (MLE) for the Gaussian distribution overlaying the original data. The red line represents the Gaussian distribution using the MLE for the mean ( u≈4.91​) and the variance (_σ_²≈3.90). As you can see, the estimated Gaussian distribution fits quite well with the histogram of the original data.

Other Important Distributions and Parameters

This process can be used for estimating other distributions such as:

  1. Exponential Distribution: Used often for modeling time between events in a Poisson process. The parameter to estimate is the rate (λ).
  2. Poisson Distribution: Commonly used for modeling the number of times an event occurs in a fixed interval of time or space. The parameter is the rate (λ). For instance, the shot noise observed in the LiDAR receiver photodiode detector.
  3. Binomial Distribution: Used for modeling the number of successes in a fixed number of Bernoulli trials. The parameters are the number of trials (n) and the probability of success (p).
  4. Log-Normal Distribution: Used in various applications where the data is positively skewed, not least in the analysis of financial data. Parameters are the mean (μ) and standard deviation (σ) of the underlying normal distribution.