The maximum likelihood estimator is often compared to the least squares method. I'm struggling to see how these things are related at all. I would like to understand what the maximum likelihood estimator means in practice. Can you adapt the maximum likelihood estimator to the example below and use the example to explain it?

Let's say we are trying to predict house prices (target) from the size of the house (as the only feature). We are using Linear Regression, so we are trying to learn (optimize) parameters B0 and B1 in predicted price = B0 + B1 * size. If we are using Ordinary Least Squares, we want to minimize the sum of squared differences between prediction and real target. For example, if we predict target 1000 for some house and the actual target is 900, the difference is 100. The squared difference is 100^2 = 10000. So this house would increase the sum by 10000. We want to choose B0 and B1 in a way that minimizes the sum of these squares. Simple.

Now substitute Maximum Likelihood Estimator in place of Ordinary Least Squares. Wikipedia tells us that it's "finding the parameter values that maximize the likelihood of making the observations given the parameters". How does this relate to the example with parameters B0, B1 and a difference of 100 between predicted target and real target?


Least square fitting is an example of maximum likelihood estimation. In the linear model where you assume the noise is Gaussian, it can be proven maximising the log-likelihood function is the same as direct least square fitting.

Reference: Equivalence between least squares and MLE in Gaussian model

$$ \frac{-n}{2} \log(\sigma^{2}) - \frac{1}{2 \sigma^{2}} \sum_{i=1}^{n} (y_{i}-x_{i} \beta)^{2} $$

This is the log-likelihood function for simple linear regression. Can you see the summation? Please take a look at the reference for details.

Short answer: they are the same thing in your scenario

| cite | improve this answer | |
  • $\begingroup$ To me this looks like you took the OLS formula and added some constants to it. (I know it actually represents MLE, but I do not see how). If σ is constant and we are optimizing β, of course it's going to lead to the same solution as OLS. I do not see how that formula is expressing the "likelihood of making the observations". I know it is, I just don't see how. $\endgroup$ – Atte Juvonen Jan 30 '17 at 0:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.