# Maximum likelihood

**Maximum likelihood estimation (MLE)** is a popular statistical method used to make inferences about parameters of the underlying probability distribution of a given data set.

The method was pioneered by geneticist and statistician Sir Ronald A. Fisher between 1912 and 1922 (see external resources below for more information on the history of MLE).

## Prerequisites

The following discussion assumes that the reader is familiar with basic notions in probability theory such as probability distributions, probability density functions, random variables and expectation. It also assumes s/he is familiar with standard basic techniques of maximising continuous real-valued functions, such as using differentiation to find a function's maxima.

## The philosophy of MLE

Given a probability distribution , associated with either a known probability density function (continuous distribution) or a known probability mass function (discrete distribution), denoted as , and distributional parameter , we may draw a sample of values from this distribution and then using we may compute the probability associated with our observed data:

However, it may be that we don't know the value of the parameter despite knowing (or believing) that our data comes from the distribution . How should we estimate ? It is a sensible idea to draw a sample of values and use this data to help us make an estimate.

Once we have our sample , we may seek an estimate of the value of from that sample. MLE seeks the most likely value of the parameter (i.e., we maximise the *likelihood* of the observed data set over all possible values of ). This is in contrast to seeking other estimators, such as an unbiased estimator of , which may not necessarily yield the most likely value of but which will yield a value that (on average) will neither tend to over-estimate nor under-estimate the true value of .

To implement the MLE method mathematically, we define the *likelihood*:

and maximise this function over all possible values of the parameter . The value which maximises the likelihood is known as the **maximum likelihood estimator** (MLE) for .

### Notes

- The likelihood is a function of for fixed values of .
- The maximum likelihood estimator may not be unique, or indeed may not even exist.

## Examples

### Discrete distribution, discrete and finite parameter space

Consider tossing an unfair coin 80 times (i.e., we sample something like , , , and count the number of HEADS observed). Call the probability of tossing a HEAD , and the probability of tossing TAILS (so here is the parameter which we referred to as above). Suppose we toss 49 HEADS and 31 TAILS, and suppose the coin was taken from a box containing three coins: one which gives HEADS with probability , one which gives HEADS with probability and another which gives heads with probability . The coins have lost their labels, so we don't know which one it was. Using **maximum likelihood estimation** we can calculate which coin it was most likely to have been, given the data that we observed. The likelihood function (defined above) takes one of three values:

We see that the likelihood is maximised by parameter , and so this is our *maximum likelihood estimate* for .

### Discrete distribution, continuous parameter space

Now suppose our special box of coins from example 1 contains an infinite number of coins: one for every possible value . We must maximise the likelihood function:

over all possible values .

One may maximise this function by differentiating with respect to and setting to zero:

which has solutions , , and . The solution which maximises the likelihood is clearly (since and result in a likelihood of zero). Thus we say the *maximum likelihood estimator* for is .

This result is easily generalised by substituting a letter such as in the place of 49 to represent the observed number of 'successes' of our Bernoulli trials, and a letter such as in the place of 80 to represent the number of Bernoulli trials. Exactly the same calculation yields the *maximum likelihood estimator*:

for any sequence of Bernoulli trials resulting in 'successes'.

### Continuous distribution, continuous parameter space

One of the most common continuous probability distributions is the Normal distribution which has probability density function:

The corresponding density function for a sample of independent identically distributed normal random variables is:

or more conveniently:

This distribution has two parameters: . This may be alarming to some, given that in the discussion above we only talked about maximising over a single parameter. However there is no need for alarm: we simply maximise the likelihood over each parameter separately, which of course is more work but no more complicated. In the above notation we would write .

When maximising the likelihood, we may equivalently maximise the log of the likelihood, since log is a continuous strictly increasing function over the range of the likelihood. [Note: the log-likelihood is closely related to information entropy and Fisher information ]. This often simplifies the algebra somewhat, and indeed does so in this case:

which is solved by . This is indeed the maximum of the function since it is the only turning point in and the second derivative is strictly less than zero.

Similarly we differentiate with respect to and equate to zero.

which is solved by .

Formally we say that the *maximum likelihood estimator* for is:

- .

## Properties

### Functional invariance

If is the maximum likelihood estimator (MLE) for , then the MLE for is . The function *g* need not be one-to-one. For detail, please refer to the proof of Theorem 7.2.10 of *Statistical Inference* by George Casella and Roger L. Berger.

### Asymptotic behaviour

Maximum likelihood estimators achieve minimum variance (as given by the Cramer-Rao lower bound) in the limit as the sample size tends to infinity. When the MLE is unbiased, we may equivalently say that it has minimum mean squared error in the limit.

For independent observations, the maximum likelihood estimator often follows an asymptotic normal distribution.

### Bias

The bias of maximum-likelihood estimators can be substantial. Consider a case where *n* tickets numbered from 1 to *n* are placed in a box and one is selected at random (*see uniform distribution*). If *n* is unknown, then the maximum-likelihood estimator of *n* is the value on the drawn ticket, even though the expectation is only . In estimating the highest number *n*, we can only be certain that it is greater than or equal to the drawn ticket number.

## See also

- The mean squared error is a measure of how 'good' an estimator of a distributional parameter is (be it the maximum likelihood estimator or some other estimator).

- The article on the Rao-Blackwell theorem for a discussion on finding the best possible unbiased estimator (in the sense of having minimal mean squared error) by a process called Rao-Blackwellisation. The MLE is often a good starting place for the process.

- The reader may be intrigued to learn that the MLE (if it exists) will always be a function of a sufficient statistic for the parameter in question.