Template:Short description Template:About

In statistics, maximum likelihood estimation (MLE) is a method of estimating the parameters of an assumed probability distribution, given some observed data. This is achieved by maximizing a likelihood function so that, under the assumed statistical model, the observed data is most probable. The point in the parameter space that maximizes the likelihood function is called the maximum likelihood estimate.<ref>Template:Cite book</ref> The logic of maximum likelihood is both intuitive and flexible, and as such the method has become a dominant means of statistical inference.<ref>Template:Cite book</ref><ref>Template:Cite book</ref><ref>Template:Cite book</ref>

If the likelihood function is differentiable, the derivative test for finding maxima can be applied. In some cases, the first-order conditions of the likelihood function can be solved analytically; for instance, the ordinary least squares estimator for a linear regression model maximizes the likelihood when the random errors are assumed to have normal distributions with the same variance.<ref>Template:Cite book</ref>

From the perspective of Bayesian inference, MLE is generally equivalent to maximum a posteriori (MAP) estimation with a prior distribution that is uniform in the region of interest. In frequentist inference, MLE is a special case of an extremum estimator, with the objective function being the likelihood.

PrinciplesEdit

We model a set of observations as a random sample from an unknown joint probability distribution which is expressed in terms of a set of parameters. The goal of maximum likelihood estimation is to determine the parameters for which the observed data have the highest joint probability. We write the parameters governing the joint distribution as a vector <math>\; \theta = \left[ \theta_{1},\, \theta_2,\, \ldots,\, \theta_k \right]^{\mathsf{T}} \;</math> so that this distribution falls within a parametric family <math>\; \{ f(\cdot\,;\theta) \mid \theta \in \Theta \} \;,</math> where <math>\, \Theta \,</math> is called the parameter space, a finite-dimensional subset of Euclidean space. Evaluating the joint density at the observed data sample <math>\; \mathbf{y} = (y_1, y_2, \ldots, y_n) \;</math> gives a real-valued function, <math display="block">\mathcal{L}_{n}(\theta) = \mathcal{L}_{n}(\theta; \mathbf{y}) = f_{n}(\mathbf{y}; \theta) \;,</math> which is called the likelihood function. For independent random variables, <math>f_{n}(\mathbf{y}; \theta)</math> will be the product of univariate density functions: <math display="block">f_{n}(\mathbf{y}; \theta) = \prod_{k=1}^n \, f_k^\mathsf{univar}(y_k; \theta) ~.</math>

The goal of maximum likelihood estimation is to find the values of the model parameters that maximize the likelihood function over the parameter space,<ref name=":0">Template:Cite journal</ref> that is: <math display="block">

   \hat{\theta} = \underset{\theta\in\Theta}{\operatorname{arg\;max}}\,\mathcal{L}_{n}(\theta\,;\mathbf{y}) ~.

</math>

Intuitively, this selects the parameter values that make the observed data most probable. The specific value <math>~ \hat{\theta} = \hat{\theta}_{n}(\mathbf{y}) \in \Theta ~</math> that maximizes the likelihood function <math>\, \mathcal{L}_{n} \,</math> is called the maximum likelihood estimate. Further, if the function <math>\; \hat{\theta}_{n} : \mathbb{R}^{n} \to \Theta \;</math> so defined is measurable, then it is called the maximum likelihood estimator. It is generally a function defined over the sample space, i.e. taking a given sample as its argument. A sufficient but not necessary condition for its existence is for the likelihood function to be continuous over a parameter space <math>\, \Theta \,</math> that is compact.<ref>Template:Cite book</ref> For an open <math>\, \Theta \,</math> the likelihood function may increase without ever reaching a supremum value.

In practice, it is often convenient to work with the natural logarithm of the likelihood function, called the log-likelihood: <math display="block">

   \ell(\theta\,;\mathbf{y}) =  \ln \mathcal{L}_{n}(\theta\,;\mathbf{y}) ~.

</math> Since the logarithm is a monotonic function, the maximum of <math>\; \ell(\theta\,;\mathbf{y}) \;</math> occurs at the same value of <math>\theta</math> as does the maximum of <math>\, \mathcal{L}_{n} ~.</math><ref>Template:Cite book</ref> If <math>\ell(\theta\,;\mathbf{y})</math> is differentiable in <math>\, \Theta \,,</math> sufficient conditions for the occurrence of a maximum (or a minimum) are <math display="block">\frac{\partial \ell}{\partial \theta_{1}} = 0, \quad \frac{\partial \ell}{\partial \theta_{2}} = 0, \quad \ldots, \quad \frac{\partial \ell}{\partial \theta_{k}} = 0 ~,</math> known as the likelihood equations. For some models, these equations can be explicitly solved for <math>\, \widehat{\theta\,} \,,</math> but in general no closed-form solution to the maximization problem is known or available, and an MLE can only be found via numerical optimization. Another problem is that in finite samples, there may exist multiple roots for the likelihood equations.<ref>Template:Cite book</ref> Whether the identified root <math>\, \widehat{\theta\,} \,</math> of the likelihood equations is indeed a (local) maximum depends on whether the matrix of second-order partial and cross-partial derivatives, the so-called Hessian matrix

<math display="block">\mathbf{H}\left(\widehat{\theta\,}\right) = \begin{bmatrix}

\left. \frac{\partial^2 \ell}{\partial \theta_1^2} \right|_{\theta=\widehat{\theta\,}} &
\left. \frac{\partial^2 \ell}{\partial \theta_1 \, \partial \theta_2} \right|_{\theta=\widehat{\theta\,}} &
\dots &
\left. \frac{\partial^2 \ell}{\partial \theta_1 \, \partial \theta_k} \right|_{\theta=\widehat{\theta\,}} \\
\left. \frac{\partial^2 \ell}{\partial \theta_2 \, \partial \theta_1} \right|_{\theta=\widehat{\theta\,}} &
\left. \frac{\partial^2 \ell}{\partial \theta_2^2} \right|_{\theta=\widehat{\theta\,}} &
\dots &
\left. \frac{\partial^2 \ell}{\partial \theta_2 \, \partial \theta_k} \right|_{\theta=\widehat{\theta\,}} \\
\vdots & \vdots & \ddots & \vdots \\
\left. \frac{\partial^2 \ell}{\partial \theta_k \, \partial \theta_1} \right|_{\theta=\widehat{\theta\,}} &
\left. \frac{\partial^2 \ell}{\partial \theta_k \, \partial \theta_2} \right|_{\theta=\widehat{\theta\,}} &
\dots &
\left. \frac{\partial^2 \ell}{\partial \theta_k^2} \right|_{\theta=\widehat{\theta\,}}

\end{bmatrix} ~,</math>

is negative semi-definite at <math>\widehat{\theta\,}</math>, as this indicates local concavity. Conveniently, most common probability distributions – in particular the exponential family – are logarithmically concave.<ref> Template:Cite book </ref><ref> {{#invoke:citation/CS1|citation |CitationClass=web }} </ref>

Restricted parameter spaceEdit

Template:Distinguish While the domain of the likelihood function—the parameter space—is generally a finite-dimensional subset of Euclidean space, additional restrictions sometimes need to be incorporated into the estimation process. The parameter space can be expressed as <math display="block">\Theta = \left\{ \theta : \theta \in \mathbb{R}^{k},\; h(\theta) = 0 \right\} ~,</math>

where <math>\; h(\theta) = \left[ h_{1}(\theta), h_{2}(\theta), \ldots, h_{r}(\theta) \right] \;</math> is a vector-valued function mapping <math>\, \mathbb{R}^{k} \,</math> into <math>\; \mathbb{R}^{r} ~.</math> Estimating the true parameter <math>\theta</math> belonging to <math>\Theta</math> then, as a practical matter, means to find the maximum of the likelihood function subject to the constraint <math>~h(\theta) = 0 ~.</math>

Theoretically, the most natural approach to this constrained optimization problem is the method of substitution, that is "filling out" the restrictions <math>\; h_{1}, h_{2}, \ldots, h_{r} \;</math> to a set <math>\; h_{1}, h_{2}, \ldots, h_{r}, h_{r+1}, \ldots, h_{k} \;</math> in such a way that <math>\; h^{\ast} = \left[ h_{1}, h_{2}, \ldots, h_{k} \right] \;</math> is a one-to-one function from <math>\mathbb{R}^{k}</math> to itself, and reparameterize the likelihood function by setting <math>\; \phi_{i} = h_{i}(\theta_{1}, \theta_{2}, \ldots, \theta_{k}) ~.</math><ref name="Silvey p79">Template:Cite book</ref> Because of the equivariance of the maximum likelihood estimator, the properties of the MLE apply to the restricted estimates also.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> For instance, in a multivariate normal distribution the covariance matrix <math>\, \Sigma \,</math> must be positive-definite; this restriction can be imposed by replacing <math>\; \Sigma = \Gamma^{\mathsf{T}} \Gamma \;,</math> where <math>\Gamma</math> is a real upper triangular matrix and <math>\Gamma^{\mathsf{T}}</math> is its transpose.<ref>Template:Cite journal</ref>

In practice, restrictions are usually imposed using the method of Lagrange which, given the constraints as defined above, leads to the restricted likelihood equations <math display="block">\frac{\partial \ell}{\partial \theta} - \frac{\partial h(\theta)^\mathsf{T}}{\partial \theta} \lambda = 0</math> and <math>h(\theta) = 0 \;,</math>

where <math>~ \lambda = \left[ \lambda_{1}, \lambda_{2}, \ldots, \lambda_{r}\right]^\mathsf{T} ~</math> is a column-vector of Lagrange multipliers and <math>\; \frac{\partial h(\theta)^\mathsf{T}}{\partial \theta} \;</math> is the Template:Mvar Jacobian matrix of partial derivatives.<ref name="Silvey p79"/> Naturally, if the constraints are not binding at the maximum, the Lagrange multipliers should be zero.<ref>Template:Cite book</ref> This in turn allows for a statistical test of the "validity" of the constraint, known as the Lagrange multiplier test.

Nonparametric maximum likelihood estimationEdit

Nonparametric maximum likelihood estimation can be performed using the empirical likelihood.

PropertiesEdit

A maximum likelihood estimator is an extremum estimator obtained by maximizing, as a function of θ, the objective function <math>\widehat{\ell\,}(\theta\,;x)</math>. If the data are independent and identically distributed, then we have <math display="block">

   \widehat{\ell\,}(\theta\,;x)= \sum_{i=1}^n \ln f(x_i\mid\theta),
 </math>

this being the sample analogue of the expected log-likelihood <math>\ell(\theta) = \operatorname{\mathbb E}[\, \ln f(x_i\mid\theta) \,]</math>, where this expectation is taken with respect to the true density.

Maximum-likelihood estimators have no optimum properties for finite samples, in the sense that (when evaluated on finite samples) other estimators may have greater concentration around the true parameter-value.<ref>Template:Harvtxt</ref> However, like other estimation methods, maximum likelihood estimation possesses a number of attractive limiting properties: As the sample size increases to infinity, sequences of maximum likelihood estimators have these properties:

  • Consistency: the sequence of MLEs converges in probability to the value being estimated.
  • Equivariance: If <math> \hat{\theta} </math> is the maximum likelihood estimator for <math> \theta </math>, and if <math> g(\theta) </math> is a bijective transform of <math> \theta </math>, then the maximum likelihood estimator for <math> \alpha = g(\theta) </math> is <math> \hat{\alpha} = g(\hat{\theta} ) </math>. The equivariance property can be generalized to non-bijective transforms, although it applies in that case on the maximum of an induced likelihood function which is not the true likelihood in general.
  • Efficiency, i.e. it achieves the Cramér–Rao lower bound when the sample size tends to infinity. This means that no consistent estimator has lower asymptotic mean squared error than the MLE (or other estimators attaining this bound), which also means that MLE has asymptotic normality.
  • Second-order efficiency after correction for bias.

ConsistencyEdit

Under the conditions outlined below, the maximum likelihood estimator is consistent. The consistency means that if the data were generated by <math>f(\cdot\,;\theta_0)</math> and we have a sufficiently large number of observations n, then it is possible to find the value of θ0 with arbitrary precision. In mathematical terms this means that as n goes to infinity the estimator <math>\widehat{\theta\,}</math> converges in probability to its true value: <math display="block">

   \widehat{\theta\,}_\mathrm{mle}\ \xrightarrow{\text{p}}\ \theta_0.

</math>

Under slightly stronger conditions, the estimator converges almost surely (or strongly): <math display="block">

   \widehat{\theta\,}_\mathrm{mle}\ \xrightarrow{\text{a.s.}}\ \theta_0.

</math>

In practical applications, data is never generated by <math>f(\cdot\,;\theta_0)</math>. Rather, <math>f(\cdot\,;\theta_0)</math> is a model, often in idealized form, of the process generated by the data. It is a common aphorism in statistics that all models are wrong. Thus, true consistency does not occur in practical applications. Nevertheless, consistency is often considered to be a desirable property for an estimator to have.

To establish consistency, the following conditions are sufficient.<ref>By Theorem 2.5 in Template:Cite book</ref> Template:Ordered list\ 0. </math> }}

The dominance condition can be employed in the case of i.i.d. observations. In the non-i.i.d. case, the uniform convergence in probability can be checked by showing that the sequence <math>\widehat{\ell\,}(\theta\mid x)</math> is stochastically equicontinuous.

If one wants to demonstrate that the ML estimator <math>\widehat{\theta\,}</math> converges to θ0 almost surely, then a stronger condition of uniform convergence almost surely has to be imposed: <math display="block">

   \sup_{\theta\in\Theta} \left\|\;\widehat{\ell\,}(\theta\mid x) - \ell(\theta)\;\right\| \ \xrightarrow{\text{a.s.}}\ 0.
 </math>

Additionally, if (as assumed above) the data were generated by <math>f(\cdot\,;\theta_0)</math>, then under certain conditions, it can also be shown that the maximum likelihood estimator converges in distribution to a normal distribution. Specifically,<ref name=":1">By Theorem 3.3 in Template:Cite book</ref> <math display="block">

   \sqrt{n} \left(\widehat{\theta\,}_\mathrm{mle} - \theta_0\right)\ \xrightarrow{d}\ \mathcal{N}\left(0,\, I^{-1}\right)
 </math>

where Template:Math is the Fisher information matrix.

Functional invarianceEdit

The maximum likelihood estimator selects the parameter value which gives the observed data the largest possible probability (or probability density, in the continuous case). If the parameter consists of a number of components, then we define their separate maximum likelihood estimators, as the corresponding component of the MLE of the complete parameter. Consistent with this, if <math>\widehat{\theta\,}</math> is the MLE for <math>\theta</math>, and if <math>g(\theta)</math> is any transformation of <math>\theta</math>, then the MLE for <math>\alpha=g(\theta)</math> is by definition<ref>Template:Cite book</ref>

<math display="block">\widehat{\alpha} = g(\,\widehat{\theta\,}\,). \,</math>

It maximizes the so-called profile likelihood:

<math display="block">\bar{L}(\alpha) = \sup_{\theta: \alpha = g(\theta)} L(\theta). \, </math>

The MLE is also equivariant with respect to certain transformations of the data. If <math>y=g(x)</math> where <math>g</math> is one to one and does not depend on the parameters to be estimated, then the density functions satisfy

<math display="block">f_Y(y) = f_X(g^{-1}(y)) \, |(g^{-1}(y))^{\prime}| </math>

and hence the likelihood functions for <math>X</math> and <math>Y</math> differ only by a factor that does not depend on the model parameters.

For example, the MLE parameters of the log-normal distribution are the same as those of the normal distribution fitted to the logarithm of the data. In fact, in the log-normal case if <math>X\sim\mathcal{N}(0, 1)</math>, then <math>Y=g(X)=e^{X} </math> follows a log-normal distribution. The density of Y follows with <math> f_X</math> standard Normal and <math>g^{-1}(y) = \log(y) </math>, <math>|(g^{-1}(y))^{\prime}| = \frac{1}{y} </math> for <math> y > 0</math>.

EfficiencyEdit

As assumed above, if the data were generated by <math>~f(\cdot\,;\theta_0)~,</math> then under certain conditions, it can also be shown that the maximum likelihood estimator converges in distribution to a normal distribution. It is Template:Sqrt-consistent and asymptotically efficient, meaning that it reaches the Cramér–Rao bound. Specifically,<ref name=":1"/>

<math display="block">

   \sqrt{n\,} \, \left( \widehat{\theta\,}_\text{mle} - \theta_0 \right)\ \ \xrightarrow{d}\ \ \mathcal{N} \left( 0,\ \mathcal{I}^{-1} \right) ~,
 </math>

where <math>~\mathcal{I}~</math> is the Fisher information matrix: <math display="block">

   \mathcal{I}_{jk} = \operatorname{\mathbb E} \, \biggl[ \; -{ \frac{\partial^2\ln f_{\theta_0}(X_t)}{\partial\theta_j\,\partial\theta_k } } 
            \; \biggr] ~.
 </math>

In particular, it means that the bias of the maximum likelihood estimator is equal to zero up to the order Template:Sfrac.

Second-order efficiency after correction for biasEdit

However, when we consider the higher-order terms in the expansion of the distribution of this estimator, it turns out that Template:Math has bias of order Template:Frac. This bias is equal to (componentwise)<ref>See formula 20 in Template:Cite journal </ref>

<math display="block">

   b_h \; \equiv \; \operatorname{\mathbb E} \biggl[ \; \left( \widehat\theta_\mathrm{mle} - \theta_0 \right)_h \; \biggr]
      \; = \; \frac{1}{\,n\,} \, \sum_{i, j, k = 1}^m \; \mathcal{I}^{h i} \; \mathcal{I}^{j k} \left( \frac{1}{\,2\,} \, K_{i j k} \; + \; J_{j,i k} \right)
 </math>

where <math>\mathcal{I}^{j k}</math> (with superscripts) denotes the (j,k)-th component of the inverse Fisher information matrix <math>\mathcal{I}^{-1}</math>, and

<math display="block">

    \frac{1}{\,2\,} \, K_{i j k} \; + \; J_{j,i k} \; = \; \operatorname{\mathbb E}\,\biggl[\;
            \frac12 \frac{\partial^3 \ln f_{\theta_0}(X_t)}{\partial\theta_i\;\partial\theta_j\;\partial\theta_k} +
            \frac{\;\partial\ln f_{\theta_0}(X_t)\;}{\partial\theta_j}\,\frac{\;\partial^2\ln f_{\theta_0}(X_t)\;}{\partial\theta_i \, \partial\theta_k}
            \; \biggr] ~ .
 </math>

Using these formulae it is possible to estimate the second-order bias of the maximum likelihood estimator, and correct for that bias by subtracting it: <math display="block">

   \widehat{\theta\,}^*_\text{mle} = \widehat{\theta\,}_\text{mle} - \widehat{b\,} ~ .
 </math>

This estimator is unbiased up to the terms of order Template:Sfrac, and is called the bias-corrected maximum likelihood estimator.

This bias-corrected estimator is Template:Em (at least within the curved exponential family), meaning that it has minimal mean squared error among all second-order bias-corrected estimators, up to the terms of the order Template:Sfrac . It is possible to continue this process, that is to derive the third-order bias-correction term, and so on. However, the maximum likelihood estimator is not third-order efficient.<ref> Template:Cite journal </ref>

Relation to Bayesian inferenceEdit

A maximum likelihood estimator coincides with the most probable Bayesian estimator given a uniform prior distribution on the parameters. Indeed, the maximum a posteriori estimate is the parameter Template:Mvar that maximizes the probability of Template:Mvar given the data, given by Bayes' theorem:

<math display="block">

   \operatorname{\mathbb P}(\theta\mid x_1,x_2,\ldots,x_n) = \frac{f(x_1,x_2,\ldots,x_n\mid\theta)\operatorname{\mathbb P}(\theta)}{\operatorname{\mathbb P}(x_1,x_2,\ldots,x_n)}
 </math>

where <math>\operatorname{\mathbb P}(\theta)</math> is the prior distribution for the parameter Template:Mvar and where <math>\operatorname{\mathbb P}(x_1,x_2,\ldots,x_n)</math> is the probability of the data averaged over all parameters. Since the denominator is independent of Template:Mvar, the Bayesian estimator is obtained by maximizing <math>f(x_1,x_2,\ldots,x_n\mid\theta)\operatorname{\mathbb P}(\theta)</math> with respect to Template:Mvar. If we further assume that the prior <math>\operatorname{\mathbb P}(\theta)</math> is a uniform distribution, the Bayesian estimator is obtained by maximizing the likelihood function <math>f(x_1,x_2,\ldots,x_n\mid\theta)</math>. Thus the Bayesian estimator coincides with the maximum likelihood estimator for a uniform prior distribution <math>\operatorname{\mathbb P}(\theta)</math>.

Application of maximum-likelihood estimation in Bayes decision theoryEdit

In many practical applications in machine learning, maximum-likelihood estimation is used as the model for parameter estimation.

The Bayesian Decision theory is about designing a classifier that minimizes total expected risk, especially, when the costs (the loss function) associated with different decisions are equal, the classifier is minimizing the error over the whole distribution.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

Thus, the Bayes Decision Rule is stated as

"decide <math>\;w_1\;</math> if <math>~\operatorname{\mathbb P}(w_1|x) \; > \; \operatorname{\mathbb P}(w_2|x)~;~</math> otherwise decide <math>\;w_2\;</math>"

where <math>\;w_1\,, w_2\;</math> are predictions of different classes. From a perspective of minimizing error, it can also be stated as <math display="block">w = \underset{ w }{\operatorname{arg\;max}} \; \int_{-\infty}^\infty \operatorname{\mathbb P}(\text{ error}\mid x)\operatorname{\mathbb P}(x)\,\operatorname{d}x~</math> where <math display="block">\operatorname{\mathbb P}(\text{ error}\mid x) = \operatorname{\mathbb P}(w_1\mid x)~</math> if we decide <math>\;w_2\;</math> and <math>\;\operatorname{\mathbb P}(\text{ error}\mid x) = \operatorname{\mathbb P}(w_2\mid x)\;</math> if we decide <math>\;w_1\;.</math>

By applying Bayes' theorem <math display="block">\operatorname{\mathbb P}(w_i \mid x) = \frac{\operatorname{\mathbb P}(x \mid w_i) \operatorname{\mathbb P}(w_i)}{\operatorname{\mathbb P}(x)}</math>, and if we further assume the zero-or-one loss function, which is a same loss for all errors, the Bayes Decision rule can be reformulated as: <math display="block">h_\text{Bayes} = \underset{ w }{\operatorname{arg\;max}} \, \bigl[\, \operatorname{\mathbb P}(x\mid w)\,\operatorname{\mathbb P}(w) \,\bigr]\;,</math> where <math>h_\text{Bayes}</math> is the prediction and <math>\;\operatorname{\mathbb P}(w)\;</math> is the prior probability.

Relation to minimizing Kullback–Leibler divergence and cross entropyEdit

Finding <math>\hat \theta</math> that maximizes the likelihood is asymptotically equivalent to finding the <math>\hat \theta</math> that defines a probability distribution (<math>Q_{\hat \theta}</math>) that has a minimal distance, in terms of Kullback–Leibler divergence, to the real probability distribution from which our data were generated (i.e., generated by <math>P_{\theta_0}</math>).<ref>cmplx96 (https://stats.stackexchange.com/users/177679/cmplx96), Kullback–Leibler divergence, URL (version: 2017-11-18): https://stats.stackexchange.com/q/314472 (at the youtube video, look at minutes 13 to 25)</ref> In an ideal world, P and Q are the same (and the only thing unknown is <math>\theta</math> that defines P), but even if they are not and the model we use is misspecified, still the MLE will give us the "closest" distribution (within the restriction of a model Q that depends on <math>\hat \theta</math>) to the real distribution <math>P_{\theta_0}</math>.<ref>Introduction to Statistical Inference | Stanford (Lecture 16 — MLE under model misspecification)</ref>

ExamplesEdit

Discrete uniform distributionEdit

{{#invoke:Labelled list hatnote|labelledList|Main article|Main articles|Main page|Main pages}} 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); thus, the sample size is 1. If n is unknown, then the maximum likelihood estimator <math>\widehat{n}</math> of n is the number m on the drawn ticket. (The likelihood is 0 for n < m, Template:Frac for n ≥ m, and this is greatest when n = m. Note that the maximum likelihood estimate of n occurs at the lower extreme of possible values {mm + 1, ...}, rather than somewhere in the "middle" of the range of possible values, which would result in less bias.) The expected value of the number m on the drawn ticket, and therefore the expected value of <math>\widehat{n}</math>, is (n + 1)/2. As a result, with a sample size of 1, the maximum likelihood estimator for n will systematically underestimate n by (n − 1)/2.

Discrete distribution, finite parameter spaceEdit

Suppose one wishes to determine just how biased an unfair coin is. Call the probability of tossing a 'head' p. The goal then becomes to determine p.

Suppose the coin is tossed 80 times: i.e. the sample might be something like x1 = H, x2 = T, ..., x80 = T, and the count of the number of heads "H" is observed.

The probability of tossing tails is 1 − p (so here p is θ above). Suppose the outcome is 49 heads and 31 tails, and suppose the coin was taken from a box containing three coins: one which gives heads with probability p = Template:Frac, one which gives heads with probability p = Template:Frac and another which gives heads with probability p = Template:Frac. The coins have lost their labels, so which one it was is unknown. Using maximum likelihood estimation, the coin that has the largest likelihood can be found, given the data that were observed. By using the probability mass function of the binomial distribution with sample size equal to 80, number successes equal to 49 but for different values of p (the "probability of success"), the likelihood function (defined below) takes one of three values:

<math display="block">\begin{align} \operatorname{\mathbb P}\bigl[\;\mathrm{H} = 49 \mid p=\tfrac{1}{3}\;\bigr] & = \binom{80}{49}(\tfrac{1}{3})^{49}(1-\tfrac{1}{3})^{31} \approx 0.000, \\[6pt] \operatorname{\mathbb P}\bigl[\;\mathrm{H} = 49 \mid p=\tfrac{1}{2}\;\bigr] & = \binom{80}{49}(\tfrac{1}{2})^{49}(1-\tfrac{1}{2})^{31} \approx 0.012, \\[6pt] \operatorname{\mathbb P}\bigl[\;\mathrm{H} = 49 \mid p=\tfrac{2}{3}\;\bigr] & = \binom{80}{49}(\tfrac{2}{3})^{49}(1-\tfrac{2}{3})^{31} \approx 0.054~. \end{align}</math>

The likelihood is maximized when Template:Mvar = Template:Frac, and so this is the maximum likelihood estimate for Template:Mvar.

Discrete distribution, continuous parameter spaceEdit

Now suppose that there was only one coin but its Template:Mvar could have been any value Template:Nowrap The likelihood function to be maximised is <math display="block"> L(p) = f_D(\mathrm{H} = 49 \mid p) = \binom{80}{49} p^{49}(1 - p)^{31}~, </math>

and the maximisation is over all possible values Template:Nowrap

File:MLfunctionbinomial-en.svg
Likelihood function for proportion value of a binomial process (Template:Mvar = 10)

One way to maximize this function is by differentiating with respect to Template:Mvar and setting to zero:

<math display="block">\begin{align} 0 & = \frac{\partial}{\partial p} \left( \binom{80}{49} p^{49}(1-p)^{31} \right)~, \\[8pt] 0 & = 49 p^{48}(1-p)^{31} - 31 p^{49}(1-p)^{30} \\[8pt]

 & = p^{48}(1-p)^{30}\left[ 49 (1-p) - 31 p \right]  \\[8pt]
 & = p^{48}(1-p)^{30}\left[ 49 - 80 p \right]~.

\end{align}</math>

This is a product of three terms. The first term is 0 when Template:Mvar = 0. The second is 0 when Template:Mvar = 1. The third is zero when Template:Mvar = Template:Frac. The solution that maximizes the likelihood is clearly Template:Mvar = Template:Frac (since Template:Mvar = 0 and Template:Mvar = 1 result in a likelihood of 0). Thus the maximum likelihood estimator for Template:Mvar is Template:Frac.

This result is easily generalized by substituting a letter such as Template:Mvar in the place of 49 to represent the observed number of 'successes' of our Bernoulli trials, and a letter such as Template:Mvar in the place of 80 to represent the number of Bernoulli trials. Exactly the same calculation yields Template:Frac which is the maximum likelihood estimator for any sequence of Template:Mvar Bernoulli trials resulting in Template:Mvar 'successes'.

Continuous distribution, continuous parameter spaceEdit

For the normal distribution <math>\mathcal{N}(\mu, \sigma^2)</math> which has probability density function

<math display="block">f(x\mid \mu,\sigma^2) = \frac{1}{\sqrt{2\pi\sigma^2}\ }

                              \exp\left(-\frac {(x-\mu)^2}{2\sigma^2} \right), </math>

the corresponding probability density function for a sample of Template:Mvar independent identically distributed normal random variables (the likelihood) is

<math display="block">f(x_1,\ldots,x_n \mid \mu,\sigma^2) = \prod_{i=1}^n f( x_i\mid \mu, \sigma^2) = \left( \frac{1}{2\pi\sigma^2} \right)^{n/2} \exp\left( -\frac{ \sum_{i=1}^n (x_i-\mu)^2}{2\sigma^2}\right).</math>

This family of distributions has two parameters: Template:Math; so we maximize the likelihood, <math>\mathcal{L} (\mu,\sigma^2) = f(x_1,\ldots,x_n \mid \mu, \sigma^2)</math>, over both parameters simultaneously, or if possible, individually.

Since the logarithm function itself is a continuous strictly increasing function over the range of the likelihood, the values which maximize the likelihood will also maximize its logarithm (the log-likelihood itself is not necessarily strictly increasing). The log-likelihood can be written as follows:

<math display="block">

  \log\Bigl( \mathcal{L} (\mu,\sigma^2)\Bigr) = -\frac{\,n\,}{2} \log(2\pi\sigma^2)
  - \frac{1}{2\sigma^2} \sum_{i=1}^n (\,x_i-\mu\,)^2

</math>

(Note: the log-likelihood is closely related to information entropy and Fisher information.)

We now compute the derivatives of this log-likelihood as follows.

<math display="block">\begin{align} 0 & = \frac{\partial}{\partial \mu} \log\Bigl( \mathcal{L} (\mu,\sigma^2)\Bigr) =

0 - \frac{\;-2 n(\bar{x}-\mu)\;}{2\sigma^2}.

\end{align}</math> where <math> \bar{x} </math> is the sample mean. This is solved by

<math display="block">\widehat\mu = \bar{x} = \sum^n_{i=1} \frac{\,x_i\,}{n}. </math>

This is indeed the maximum of the function, since it is the only turning point in Template:Mvar and the second derivative is strictly less than zero. Its expected value is equal to the parameter Template:Mvar of the given distribution,

<math display="block">\operatorname{\mathbb E}\bigl[\;\widehat\mu\;\bigr] = \mu, \, </math>

which means that the maximum likelihood estimator <math>\widehat\mu</math> is unbiased.

Similarly we differentiate the log-likelihood with respect to Template:Mvar and equate to zero:

<math display="block">\begin{align} 0 & = \frac{\partial}{\partial \sigma} \log\Bigl( \mathcal{L} (\mu,\sigma^2)\Bigr) = -\frac{\,n\,}{\sigma}

  + \frac{1}{\sigma^3} \sum_{i=1}^{n} (\,x_i-\mu\,)^2.

\end{align}</math>

which is solved by

<math display="block">\widehat\sigma^2 = \frac{1}{n} \sum_{i=1}^n(x_i-\mu)^2.</math>

Inserting the estimate <math>\mu = \widehat\mu</math> we obtain

<math display="block">\widehat\sigma^2 = \frac{1}{n} \sum_{i=1}^n (x_i - \bar{x})^2 = \frac{1}{n}\sum_{i=1}^n x_i^2 -\frac{1}{n^2}\sum_{i=1}^n\sum_{j=1}^n x_i x_j.</math>

To calculate its expected value, it is convenient to rewrite the expression in terms of zero-mean random variables (statistical error) <math>\delta_i \equiv \mu - x_i</math>. Expressing the estimate in these variables yields

<math display="block">\widehat\sigma^2 = \frac{1}{n} \sum_{i=1}^n (\mu - \delta_i)^2 -\frac{1}{n^2}\sum_{i=1}^n\sum_{j=1}^n (\mu - \delta_i)(\mu - \delta_j).</math>

Simplifying the expression above, utilizing the facts that <math>\operatorname{\mathbb E}\bigl[\;\delta_i\;\bigr] = 0 </math> and <math>\operatorname{E}\bigl[\;\delta_i^2\;\bigr] = \sigma^2 </math>, allows us to obtain

<math display="block">\operatorname{\mathbb E}\bigl[\;\widehat\sigma^2\;\bigr]= \frac{\,n-1\,}{n}\sigma^2.</math>

This means that the estimator <math>\widehat\sigma^2</math> is biased for <math>\sigma^2</math>. It can also be shown that <math>\widehat\sigma</math> is biased for <math>\sigma</math>, but that both <math>\widehat\sigma^2</math> and <math>\widehat\sigma</math> are consistent.

Formally we say that the maximum likelihood estimator for <math>\theta=(\mu,\sigma^2)</math> is

<math display="block">\widehat{\theta\,} = \left(\widehat{\mu},\widehat{\sigma}^2\right).</math>

In this case the MLEs could be obtained individually. In general this may not be the case, and the MLEs would have to be obtained simultaneously.

The normal log-likelihood at its maximum takes a particularly simple form:

<math display="block">

  \log\Bigl( \mathcal{L}(\widehat\mu,\widehat\sigma)\Bigr) = \frac{\,-n\;\;}{2} \bigl(\,\log(2\pi\widehat\sigma^2) +1\,\bigr)

</math>

This maximum log-likelihood can be shown to be the same for more general least squares, even for non-linear least squares. This is often used in determining likelihood-based approximate confidence intervals and confidence regions, which are generally more accurate than those using the asymptotic normality discussed above.

Non-independent variablesEdit

It may be the case that variables are correlated, or more generally, not independent. Two random variables <math>y_1</math> and <math>y_2</math> are independent only if their joint probability density function is the product of the individual probability density functions, i.e.

<math display="block">f(y_1,y_2) = f(y_1) f(y_2)\,</math>

Suppose one constructs an order-n Gaussian vector out of random variables <math>(y_1,\ldots,y_n)</math>, where each variable has means given by <math>(\mu_1, \ldots, \mu_n)</math>. Furthermore, let the covariance matrix be denoted by <math>\mathit\Sigma</math>. The joint probability density function of these n random variables then follows a multivariate normal distribution given by:

<math display="block">f(y_1,\ldots,y_n) = \frac{1}{(2\pi)^{n/2}\sqrt{\det(\mathit\Sigma)}} \exp\left( -\frac{1}{2} \left[y_1-\mu_1,\ldots,y_n-\mu_n\right]\mathit\Sigma^{-1} \left[y_1-\mu_1,\ldots,y_n-\mu_n\right]^\mathrm{T} \right)</math>

In the bivariate case, the joint probability density function is given by:

<math display="block"> f(y_1,y_2) = \frac{1}{2\pi \sigma_{1} \sigma_2 \sqrt{1-\rho^2}} \exp\left[ -\frac{1}{2(1-\rho^2)} \left(\frac{(y_1-\mu_1)^2}{\sigma_1^2} - \frac{2\rho(y_1-\mu_1)(y_2-\mu_2)}{\sigma_1\sigma_2} + \frac{(y_2-\mu_2)^2}{\sigma_2^2}\right) \right] </math>

In this and other cases where a joint density function exists, the likelihood function is defined as above, in the section "principles," using this density.

ExampleEdit

<math>X_1,\ X_2,\ldots,\ X_m</math> are counts in cells / boxes 1 up to m; each box has a different probability (think of the boxes being bigger or smaller) and we fix the number of balls that fall to be <math>n</math>:<math>x_1+x_2+\cdots+x_m=n</math>. The probability of each box is <math>p_i</math>, with a constraint: <math>p_1+p_2+\cdots+p_m=1</math>. This is a case in which the <math>X_i</math> s are not independent, the joint probability of a vector <math>x_1,\ x_2,\ldots,x_m</math> is called the multinomial and has the form:

<math display="block">f(x_1,x_2,\ldots,x_m\mid p_1,p_2,\ldots,p_m)=\frac{n!}{\prod x_i!}\prod p_i^{x_i}= \binom{n}{x_1,x_2,\ldots,x_m} p_1^{x_1} p_2^{x_2} \cdots p_m^{x_m}</math>

Each box taken separately against all the other boxes is a binomial and this is an extension thereof.

The log-likelihood of this is:

<math display="block">\ell(p_1,p_2,\ldots,p_m)=\log n!-\sum_{i=1}^m \log x_i!+\sum_{i=1}^m x_i\log p_i</math>

The constraint has to be taken into account and use the Lagrange multipliers:

<math display="block">L(p_1,p_2,\ldots,p_m,\lambda)=\ell(p_1,p_2,\ldots,p_m)+\lambda\left(1-\sum_{i=1}^m p_i\right)</math>

By posing all the derivatives to be 0, the most natural estimate is derived

<math display="block">\hat{p}_i=\frac{x_i}{n}</math>

Maximizing log likelihood, with and without constraints, can be an unsolvable problem in closed form, then we have to use iterative procedures.

Iterative proceduresEdit

Except for special cases, the likelihood equations <math display="block">\frac{\partial \ell(\theta;\mathbf{y})}{\partial \theta} = 0</math>

cannot be solved explicitly for an estimator <math>\widehat{\theta} = \widehat{\theta}(\mathbf{y})</math>. Instead, they need to be solved iteratively: starting from an initial guess of <math>\theta</math> (say <math>\widehat{\theta}_{1}</math>), one seeks to obtain a convergent sequence <math>\left\{ \widehat{\theta}_{r} \right\}</math>. Many methods for this kind of optimization problem are available,<ref> Template:Cite book </ref><ref> Template:Cite book </ref> but the most commonly used ones are algorithms based on an updating formula of the form <math display="block">\widehat{\theta}_{r+1} = \widehat{\theta}_{r} + \eta_{r} \mathbf{d}_r\left(\widehat{\theta}\right)</math>

where the vector <math>\mathbf{d}_{r}\left(\widehat{\theta}\right)</math> indicates the descent direction of the rth "step," and the scalar <math>\eta_{r}</math> captures the "step length,"<ref>Template:Cite book</ref><ref>Template:Cite book</ref> also known as the learning rate.<ref>Template:Cite book</ref>

Gradient descent methodEdit

(Note: here it is a maximization problem, so the sign before gradient is flipped)

<math display="block">\eta_r\in \R^+</math> that is small enough for convergence and <math>\mathbf{d}_r\left(\widehat{\theta}\right) = \nabla\ell\left(\widehat{\theta}_r;\mathbf{y}\right)</math>

Gradient descent method requires to calculate the gradient at the rth iteration, but no need to calculate the inverse of second-order derivative, i.e., the Hessian matrix. Therefore, it is computationally faster than Newton-Raphson method.

Newton–Raphson methodEdit

<math display="block">\eta_r = 1</math> and <math>\mathbf{d}_r\left(\widehat{\theta}\right) = -\mathbf{H}^{-1}_r\left(\widehat{\theta}\right) \mathbf{s}_r\left(\widehat{\theta}\right)</math>

where <math>\mathbf{s}_{r}(\widehat{\theta})</math> is the score and <math>\mathbf{H}^{-1}_r \left(\widehat{\theta}\right)</math> is the inverse of the Hessian matrix of the log-likelihood function, both evaluated the rth iteration.<ref>Template:Cite book</ref><ref>Template:Cite book</ref> But because the calculation of the Hessian matrix is computationally costly, numerous alternatives have been proposed. The popular Berndt–Hall–Hall–Hausman algorithm approximates the Hessian with the outer product of the expected gradient, such that

<math display="block">\mathbf{d}_r\left(\widehat{\theta}\right) = - \left[ \frac{1}{n} \sum_{t=1}^n \frac{\partial \ell(\theta;\mathbf{y})}{\partial \theta} \left( \frac{\partial \ell(\theta;\mathbf{y})}{\partial \theta} \right)^{\mathsf{T}} \right]^{-1} \mathbf{s}_r \left(\widehat{\theta}\right)</math>

Quasi-Newton methodsEdit

Other quasi-Newton methods use more elaborate secant updates to give approximation of Hessian matrix.

Davidon–Fletcher–Powell formulaEdit

DFP formula finds a solution that is symmetric, positive-definite and closest to the current approximate value of second-order derivative: <math display="block">\mathbf{H}_{k+1} =

 \left(I - \gamma_k y_k s_k^\mathsf{T}\right) \mathbf{H}_k \left(I - \gamma_k s_k y_k^\mathsf{T}\right) + \gamma_k y_k y_k^\mathsf{T},

</math>

where

<math display="block">y_k = \nabla\ell(x_k + s_k) - \nabla\ell(x_k),</math> <math display="block">\gamma_k = \frac{1}{y_k^T s_k},</math> <math display="block">s_k = x_{k+1} - x_k.</math>

Broyden–Fletcher–Goldfarb–Shanno algorithmEdit

BFGS also gives a solution that is symmetric and positive-definite:

<math display="block">B_{k+1} = B_k + \frac{y_k y_k^\mathsf{T}}{y_k^\mathsf{T} s_k} - \frac{B_k s_k s_k^\mathsf{T} B_k^\mathsf{T}}{s_k^\mathsf{T} B_k s_k}\ ,</math>

where

<math display="block">y_k = \nabla\ell(x_k + s_k) - \nabla\ell(x_k),</math> <math display="block">s_k = x_{k+1} - x_k.</math>

BFGS method is not guaranteed to converge unless the function has a quadratic Taylor expansion near an optimum. However, BFGS can have acceptable performance even for non-smooth optimization instances

Fisher's scoringEdit

Another popular method is to replace the Hessian with the Fisher information matrix, <math>\mathcal{I}(\theta) = \operatorname{\mathbb E}\left[\mathbf{H}_r \left(\widehat{\theta}\right)\right]</math>, giving us the Fisher scoring algorithm. This procedure is standard in the estimation of many methods, such as generalized linear models.

Although popular, quasi-Newton methods may converge to a stationary point that is not necessarily a local or global maximum,<ref>See theorem 10.1 in Template:Cite book </ref> but rather a local minimum or a saddle point. Therefore, it is important to assess the validity of the obtained solution to the likelihood equations, by verifying that the Hessian, evaluated at the solution, is both negative definite and well-conditioned.<ref> Template:Cite book </ref>

HistoryEdit

Early users of maximum likelihood include Carl Friedrich Gauss, Pierre-Simon Laplace, Thorvald N. Thiele, and Francis Ysidro Edgeworth.<ref> Template:Cite journal</ref><ref>Template:Cite journal </ref> It was Ronald Fisher however, between 1912 and 1922, who singlehandedly created the modern version of the method.<ref name="Pfanzagl"> Template:Cite book</ref><ref>Template:Cite journal</ref>

Maximum-likelihood estimation finally transcended heuristic justification in a proof published by Samuel S. Wilks in 1938, now called Wilks' theorem.<ref>Template:Cite journal</ref> The theorem shows that the error in the logarithm of likelihood values for estimates from multiple independent observations is asymptotically χ 2-distributed, which enables convenient determination of a confidence region around any estimate of the parameters. The only difficult part of Wilks' proof depends on the expected value of the Fisher information matrix, which is provided by a theorem proven by Fisher.<ref> Template:Cite book </ref> Wilks continued to improve on the generality of the theorem throughout his life, with his most general proof published in 1962.<ref> Template:Cite book </ref>

Reviews of the development of maximum likelihood estimation have been provided by a number of authors.<ref> Template:Cite journal </ref><ref> Template:Cite journal </ref><ref> Template:Cite journal </ref><ref> Template:Cite book </ref><ref> Template:Cite book</ref><ref>Template:Cite book </ref><ref> Template:Cite journal </ref><ref> Template:Cite journal </ref>

See alsoEdit

Template:Portal

Related conceptsEdit

  • Akaike information criterion: a criterion to compare statistical models, based on MLE
  • Extremum estimator: a more general class of estimators to which MLE belongs
  • Fisher information: information matrix, its relationship to covariance matrix of ML estimates
  • Mean squared error: a measure of how 'good' an estimator of a distributional parameter is (be it the maximum likelihood estimator or some other estimator)
  • RANSAC: a method to estimate parameters of a mathematical model given data that contains outliers
  • Rao–Blackwell theorem: yields a process for finding the best possible unbiased estimator (in the sense of having minimal mean squared error); the MLE is often a good starting place for the process
  • Wilks' theorem: provides a means of estimating the size and shape of the region of roughly equally-probable estimates for the population's parameter values, using the information from a single sample, using a chi-squared distribution

Other estimation methodsEdit

ReferencesEdit

Template:Reflist

Further readingEdit

External linksEdit

|CitationClass=web }}

  • {{#invoke:citation/CS1|citation

|CitationClass=web }}

  • {{#invoke:citation/CS1|citation

|CitationClass=web }}

  • {{#invoke:citation/CS1|citation

|CitationClass=web }}

Template:Statistics