Misplaced Pages

Maximum likelihood estimation

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
(Redirected from Method of maximum likelihood) Method of estimating the parameters of a statistical model, given observations This article is about the statistical techniques. For computer data storage, see partial-response maximum-likelihood.

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. The logic of maximum likelihood is both intuitive and flexible, and as such the method has become a dominant means of statistical inference.

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.

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.

Principles

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 θ = [ θ 1 , θ 2 , , θ k ] T {\displaystyle \;\theta =\left^{\mathsf {T}}\;} so that this distribution falls within a parametric family { f ( ; θ ) θ Θ } , {\displaystyle \;\{f(\cdot \,;\theta )\mid \theta \in \Theta \}\;,} where Θ {\displaystyle \,\Theta \,} is called the parameter space, a finite-dimensional subset of Euclidean space. Evaluating the joint density at the observed data sample y = ( y 1 , y 2 , , y n ) {\displaystyle \;\mathbf {y} =(y_{1},y_{2},\ldots ,y_{n})\;} gives a real-valued function,

L n ( θ ) = L n ( θ ; y ) = f n ( y ; θ ) , {\displaystyle {\mathcal {L}}_{n}(\theta )={\mathcal {L}}_{n}(\theta ;\mathbf {y} )=f_{n}(\mathbf {y} ;\theta )\;,}

which is called the likelihood function. For independent and identically distributed random variables, f n ( y ; θ ) {\displaystyle f_{n}(\mathbf {y} ;\theta )} will be the product of univariate density functions:

f n ( y ; θ ) = k = 1 n f k u n i v a r ( y k ; θ )   . {\displaystyle f_{n}(\mathbf {y} ;\theta )=\prod _{k=1}^{n}\,f_{k}^{\mathsf {univar}}(y_{k};\theta )~.}

The goal of maximum likelihood estimation is to find the values of the model parameters that maximize the likelihood function over the parameter space, that is

θ ^ = a r g m a x θ Θ L n ( θ ; y )   . {\displaystyle {\hat {\theta }}={\underset {\theta \in \Theta }{\operatorname {arg\;max} }}\,{\mathcal {L}}_{n}(\theta \,;\mathbf {y} )~.}

Intuitively, this selects the parameter values that make the observed data most probable. The specific value   θ ^ = θ ^ n ( y ) Θ   {\displaystyle ~{\hat {\theta }}={\hat {\theta }}_{n}(\mathbf {y} )\in \Theta ~} that maximizes the likelihood function L n {\displaystyle \,{\mathcal {L}}_{n}\,} is called the maximum likelihood estimate. Further, if the function θ ^ n : R n Θ {\displaystyle \;{\hat {\theta }}_{n}:\mathbb {R} ^{n}\to \Theta \;} 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 Θ {\displaystyle \,\Theta \,} that is compact. For an open Θ {\displaystyle \,\Theta \,} 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:

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

Since the logarithm is a monotonic function, the maximum of ( θ ; y ) {\displaystyle \;\ell (\theta \,;\mathbf {y} )\;} occurs at the same value of θ {\displaystyle \theta } as does the maximum of L n   . {\displaystyle \,{\mathcal {L}}_{n}~.} If ( θ ; y ) {\displaystyle \ell (\theta \,;\mathbf {y} )} is differentiable in Θ , {\displaystyle \,\Theta \,,} sufficient conditions for the occurrence of a maximum (or a minimum) are

θ 1 = 0 , θ 2 = 0 , , θ k = 0   , {\displaystyle {\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~,}

known as the likelihood equations. For some models, these equations can be explicitly solved for θ ^ , {\displaystyle \,{\widehat {\theta \,}}\,,} 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. Whether the identified root θ ^ {\displaystyle \,{\widehat {\theta \,}}\,} 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

H ( θ ^ ) = [ 2 θ 1 2 | θ = θ ^ 2 θ 1 θ 2 | θ = θ ^ 2 θ 1 θ k | θ = θ ^ 2 θ 2 θ 1 | θ = θ ^ 2 θ 2 2 | θ = θ ^ 2 θ 2 θ k | θ = θ ^ 2 θ k θ 1 | θ = θ ^ 2 θ k θ 2 | θ = θ ^ 2 θ k 2 | θ = θ ^ ]   , {\displaystyle \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}}~,}

is negative semi-definite at θ ^ {\displaystyle {\widehat {\theta \,}}} , as this indicates local concavity. Conveniently, most common probability distributions – in particular the exponential family – are logarithmically concave.

Restricted parameter space

Not to be confused with restricted maximum likelihood.

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

Θ = { θ : θ R k , h ( θ ) = 0 }   , {\displaystyle \Theta =\left\{\theta :\theta \in \mathbb {R} ^{k},\;h(\theta )=0\right\}~,}

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

Theoretically, the most natural approach to this constrained optimization problem is the method of substitution, that is "filling out" the restrictions h 1 , h 2 , , h r {\displaystyle \;h_{1},h_{2},\ldots ,h_{r}\;} to a set h 1 , h 2 , , h r , h r + 1 , , h k {\displaystyle \;h_{1},h_{2},\ldots ,h_{r},h_{r+1},\ldots ,h_{k}\;} in such a way that h = [ h 1 , h 2 , , h k ] {\displaystyle \;h^{\ast }=\left\;} is a one-to-one function from R k {\displaystyle \mathbb {R} ^{k}} to itself, and reparameterize the likelihood function by setting ϕ i = h i ( θ 1 , θ 2 , , θ k )   . {\displaystyle \;\phi _{i}=h_{i}(\theta _{1},\theta _{2},\ldots ,\theta _{k})~.} Because of the equivariance of the maximum likelihood estimator, the properties of the MLE apply to the restricted estimates also. For instance, in a multivariate normal distribution the covariance matrix Σ {\displaystyle \,\Sigma \,} must be positive-definite; this restriction can be imposed by replacing Σ = Γ T Γ , {\displaystyle \;\Sigma =\Gamma ^{\mathsf {T}}\Gamma \;,} where Γ {\displaystyle \Gamma } is a real upper triangular matrix and Γ T {\displaystyle \Gamma ^{\mathsf {T}}} is its transpose.

In practice, restrictions are usually imposed using the method of Lagrange which, given the constraints as defined above, leads to the restricted likelihood equations

θ h ( θ ) T θ λ = 0 {\displaystyle {\frac {\partial \ell }{\partial \theta }}-{\frac {\partial h(\theta )^{\mathsf {T}}}{\partial \theta }}\lambda =0} and h ( θ ) = 0 , {\displaystyle h(\theta )=0\;,}

where   λ = [ λ 1 , λ 2 , , λ r ] T   {\displaystyle ~\lambda =\left^{\mathsf {T}}~} is a column-vector of Lagrange multipliers and h ( θ ) T θ {\displaystyle \;{\frac {\partial h(\theta )^{\mathsf {T}}}{\partial \theta }}\;} is the k × r Jacobian matrix of partial derivatives. Naturally, if the constraints are not binding at the maximum, the Lagrange multipliers should be zero. This in turn allows for a statistical test of the "validity" of the constraint, known as the Lagrange multiplier test.

Nonparametric maximum likelihood estimation

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

Properties

A maximum likelihood estimator is an extremum estimator obtained by maximizing, as a function of θ, the objective function ^ ( θ ; x ) {\displaystyle {\widehat {\ell \,}}(\theta \,;x)} . If the data are independent and identically distributed, then we have

^ ( θ ; x ) = i = 1 n ln f ( x i θ ) , {\displaystyle {\widehat {\ell \,}}(\theta \,;x)=\sum _{i=1}^{n}\ln f(x_{i}\mid \theta ),}

this being the sample analogue of the expected log-likelihood ( θ ) = E [ ln f ( x i θ ) ] {\displaystyle \ell (\theta )=\operatorname {\mathbb {E} } } , 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. 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 θ ^ {\displaystyle {\hat {\theta }}} is the maximum likelihood estimator for θ {\displaystyle \theta } , and if g ( θ ) {\displaystyle g(\theta )} is a bijective transform of θ {\displaystyle \theta } , then the maximum likelihood estimator for α = g ( θ ) {\displaystyle \alpha =g(\theta )} is α ^ = g ( θ ^ ) {\displaystyle {\hat {\alpha }}=g({\hat {\theta }})} . 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.

Consistency

Under the conditions outlined below, the maximum likelihood estimator is consistent. The consistency means that if the data were generated by f ( ; θ 0 ) {\displaystyle f(\cdot \,;\theta _{0})} 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 θ ^ {\displaystyle {\widehat {\theta \,}}} converges in probability to its true value:

θ ^ m l e   p   θ 0 . {\displaystyle {\widehat {\theta \,}}_{\mathrm {mle} }\ {\xrightarrow {\text{p}}}\ \theta _{0}.}

Under slightly stronger conditions, the estimator converges almost surely (or strongly):

θ ^ m l e   a.s.   θ 0 . {\displaystyle {\widehat {\theta \,}}_{\mathrm {mle} }\ {\xrightarrow {\text{a.s.}}}\ \theta _{0}.}

In practical applications, data is never generated by f ( ; θ 0 ) {\displaystyle f(\cdot \,;\theta _{0})} . Rather, f ( ; θ 0 ) {\displaystyle f(\cdot \,;\theta _{0})} 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.

  1. Identification of the model:
    θ θ 0 f ( θ ) f ( θ 0 ) . {\displaystyle \theta \neq \theta _{0}\quad \Leftrightarrow \quad f(\cdot \mid \theta )\neq f(\cdot \mid \theta _{0}).}

    In other words, different parameter values θ correspond to different distributions within the model. If this condition did not hold, there would be some value θ1 such that θ0 and θ1 generate an identical distribution of the observable data. Then we would not be able to distinguish between these two parameters even with an infinite amount of data—these parameters would have been observationally equivalent.

    The identification condition is absolutely necessary for the ML estimator to be consistent. When this condition holds, the limiting likelihood function (θ|·) has unique global maximum at θ0.
  2. Compactness: the parameter space Θ of the model is compact.

    The identification condition establishes that the log-likelihood has a unique global maximum. Compactness implies that the likelihood cannot approach the maximum value arbitrarily close at some other point (as demonstrated for example in the picture on the right).

    Compactness is only a sufficient condition and not a necessary condition. Compactness can be replaced by some other conditions, such as:

    • both concavity of the log-likelihood function and compactness of some (nonempty) upper level sets of the log-likelihood function, or
    • existence of a compact neighborhood N of θ0 such that outside of N the log-likelihood function is less than the maximum by at least some ε > 0.
  3. Continuity: the function ln f(x | θ) is continuous in θ for almost all values of x:
    P [ ln f ( x θ ) C 0 ( Θ ) ] = 1. {\displaystyle \operatorname {\mathbb {P} } {\Bigl }=1.}
    The continuity here can be replaced with a slightly weaker condition of upper semi-continuity.
  4. Dominance: there exists D(x) integrable with respect to the distribution f(x | θ0) such that
    | ln f ( x θ ) | < D ( x )  for all  θ Θ . {\displaystyle {\Bigl |}\ln f(x\mid \theta ){\Bigr |}<D(x)\quad {\text{ for all }}\theta \in \Theta .}
    By the uniform law of large numbers, the dominance condition together with continuity establish the uniform convergence in probability of the log-likelihood:
    sup θ Θ | ^ ( θ x ) ( θ ) |   p   0. {\displaystyle \sup _{\theta \in \Theta }\left|{\widehat {\ell \,}}(\theta \mid x)-\ell (\theta )\,\right|\ {\xrightarrow {\text{p}}}\ 0.}

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 ^ ( θ x ) {\displaystyle {\widehat {\ell \,}}(\theta \mid x)} is stochastically equicontinuous. If one wants to demonstrate that the ML estimator θ ^ {\displaystyle {\widehat {\theta \,}}} converges to θ0 almost surely, then a stronger condition of uniform convergence almost surely has to be imposed:

sup θ Θ ^ ( θ x ) ( θ )   a.s.   0. {\displaystyle \sup _{\theta \in \Theta }\left\|\;{\widehat {\ell \,}}(\theta \mid x)-\ell (\theta )\;\right\|\ \xrightarrow {\text{a.s.}} \ 0.}

Additionally, if (as assumed above) the data were generated by f ( ; θ 0 ) {\displaystyle f(\cdot \,;\theta _{0})} , then under certain conditions, it can also be shown that the maximum likelihood estimator converges in distribution to a normal distribution. Specifically,

n ( θ ^ m l e θ 0 )   d   N ( 0 , I 1 ) {\displaystyle {\sqrt {n}}\left({\widehat {\theta \,}}_{\mathrm {mle} }-\theta _{0}\right)\ \xrightarrow {d} \ {\mathcal {N}}\left(0,\,I^{-1}\right)}

where I is the Fisher information matrix.

Functional invariance

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 θ ^ {\displaystyle {\widehat {\theta \,}}} is the MLE for θ {\displaystyle \theta } , and if g ( θ ) {\displaystyle g(\theta )} is any transformation of θ {\displaystyle \theta } , then the MLE for α = g ( θ ) {\displaystyle \alpha =g(\theta )} is by definition

α ^ = g ( θ ^ ) . {\displaystyle {\widehat {\alpha }}=g(\,{\widehat {\theta \,}}\,).\,}

It maximizes the so-called profile likelihood:

L ¯ ( α ) = sup θ : α = g ( θ ) L ( θ ) . {\displaystyle {\bar {L}}(\alpha )=\sup _{\theta :\alpha =g(\theta )}L(\theta ).\,}

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

f Y ( y ) = f X ( g 1 ( y ) ) | ( g 1 ( y ) ) | {\displaystyle f_{Y}(y)=f_{X}(g^{-1}(y))\,|(g^{-1}(y))^{\prime }|}

and hence the likelihood functions for X {\displaystyle X} and Y {\displaystyle Y} 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 X N ( 0 , 1 ) {\displaystyle X\sim {\mathcal {N}}(0,1)} , then Y = g ( X ) = e X {\displaystyle Y=g(X)=e^{X}} follows a log-normal distribution. The density of Y follows with f X {\displaystyle f_{X}} standard Normal and g 1 ( y ) = log ( y ) {\displaystyle g^{-1}(y)=\log(y)} , | ( g 1 ( y ) ) | = 1 y {\displaystyle |(g^{-1}(y))^{\prime }|={\frac {1}{y}}} for y > 0 {\displaystyle y>0} .

Efficiency

As assumed above, if the data were generated by   f ( ; θ 0 )   , {\displaystyle ~f(\cdot \,;\theta _{0})~,} then under certain conditions, it can also be shown that the maximum likelihood estimator converges in distribution to a normal distribution. It is √n -consistent and asymptotically efficient, meaning that it reaches the Cramér–Rao bound. Specifically,

n ( θ ^ mle θ 0 )     d     N ( 0 ,   I 1 )   , {\displaystyle {\sqrt {n\,}}\,\left({\widehat {\theta \,}}_{\text{mle}}-\theta _{0}\right)\ \ \xrightarrow {d} \ \ {\mathcal {N}}\left(0,\ {\mathcal {I}}^{-1}\right)~,}

where   I   {\displaystyle ~{\mathcal {I}}~} is the Fisher information matrix:

I j k = E [ 2 ln f θ 0 ( X t ) θ j θ k ]   . {\displaystyle {\mathcal {I}}_{jk}=\operatorname {\mathbb {E} } \,{\biggl }~.}

In particular, it means that the bias of the maximum likelihood estimator is equal to zero up to the order ⁠1/√n ⁠.

Second-order efficiency after correction for bias

However, when we consider the higher-order terms in the expansion of the distribution of this estimator, it turns out that θmle has bias of order 1⁄n. This bias is equal to (componentwise)

b h E [ ( θ ^ m l e θ 0 ) h ] = 1 n i , j , k = 1 m I h i I j k ( 1 2 K i j k + J j , i k ) {\displaystyle b_{h}\;\equiv \;\operatorname {\mathbb {E} } {\biggl }\;=\;{\frac {1}{\,n\,}}\,\sum _{i,j,k=1}^{m}\;{\mathcal {I}}^{hi}\;{\mathcal {I}}^{jk}\left({\frac {1}{\,2\,}}\,K_{ijk}\;+\;J_{j,ik}\right)}

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

1 2 K i j k + J j , i k = E [ 1 2 3 ln f θ 0 ( X t ) θ i θ j θ k + ln f θ 0 ( X t ) θ j 2 ln f θ 0 ( X t ) θ i θ k ]   . {\displaystyle {\frac {1}{\,2\,}}\,K_{ijk}\;+\;J_{j,ik}\;=\;\operatorname {\mathbb {E} } \,{\biggl }~.}

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:

θ ^ mle = θ ^ mle b ^   . {\displaystyle {\widehat {\theta \,}}_{\text{mle}}^{*}={\widehat {\theta \,}}_{\text{mle}}-{\widehat {b\,}}~.}

This estimator is unbiased up to the terms of order ⁠1/ n ⁠, and is called the bias-corrected maximum likelihood estimator.

This bias-corrected estimator is second-order efficient (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 ⁠1/ n ⁠ . 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.

Relation to Bayesian inference

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 θ that maximizes the probability of θ given the data, given by Bayes' theorem:

P ( θ x 1 , x 2 , , x n ) = f ( x 1 , x 2 , , x n θ ) P ( θ ) P ( x 1 , x 2 , , x n ) {\displaystyle \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})}}}

where P ( θ ) {\displaystyle \operatorname {\mathbb {P} } (\theta )} is the prior distribution for the parameter θ and where P ( x 1 , x 2 , , x n ) {\displaystyle \operatorname {\mathbb {P} } (x_{1},x_{2},\ldots ,x_{n})} is the probability of the data averaged over all parameters. Since the denominator is independent of θ, the Bayesian estimator is obtained by maximizing f ( x 1 , x 2 , , x n θ ) P ( θ ) {\displaystyle f(x_{1},x_{2},\ldots ,x_{n}\mid \theta )\operatorname {\mathbb {P} } (\theta )} with respect to θ. If we further assume that the prior P ( θ ) {\displaystyle \operatorname {\mathbb {P} } (\theta )} is a uniform distribution, the Bayesian estimator is obtained by maximizing the likelihood function f ( x 1 , x 2 , , x n θ ) {\displaystyle f(x_{1},x_{2},\ldots ,x_{n}\mid \theta )} . Thus the Bayesian estimator coincides with the maximum likelihood estimator for a uniform prior distribution P ( θ ) {\displaystyle \operatorname {\mathbb {P} } (\theta )} .

Application of maximum-likelihood estimation in Bayes decision theory

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.

Thus, the Bayes Decision Rule is stated as

"decide w 1 {\displaystyle \;w_{1}\;} if   P ( w 1 | x ) > P ( w 2 | x )   ;   {\displaystyle ~\operatorname {\mathbb {P} } (w_{1}|x)\;>\;\operatorname {\mathbb {P} } (w_{2}|x)~;~} otherwise decide w 2 {\displaystyle \;w_{2}\;} "

where w 1 , w 2 {\displaystyle \;w_{1}\,,w_{2}\;} are predictions of different classes. From a perspective of minimizing error, it can also be stated as

w = a r g m a x w P (  error x ) P ( x ) d x   {\displaystyle w={\underset {w}{\operatorname {arg\;max} }}\;\int _{-\infty }^{\infty }\operatorname {\mathbb {P} } ({\text{ error}}\mid x)\operatorname {\mathbb {P} } (x)\,\operatorname {d} x~}

where

P (  error x ) = P ( w 1 x )   {\displaystyle \operatorname {\mathbb {P} } ({\text{ error}}\mid x)=\operatorname {\mathbb {P} } (w_{1}\mid x)~}

if we decide w 2 {\displaystyle \;w_{2}\;} and P (  error x ) = P ( w 2 x ) {\displaystyle \;\operatorname {\mathbb {P} } ({\text{ error}}\mid x)=\operatorname {\mathbb {P} } (w_{2}\mid x)\;} if we decide w 1 . {\displaystyle \;w_{1}\;.}

By applying Bayes' theorem

P ( w i x ) = P ( x w i ) P ( w i ) P ( x ) {\displaystyle \operatorname {\mathbb {P} } (w_{i}\mid x)={\frac {\operatorname {\mathbb {P} } (x\mid w_{i})\operatorname {\mathbb {P} } (w_{i})}{\operatorname {\mathbb {P} } (x)}}} ,

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:

h Bayes = a r g m a x w [ P ( x w ) P ( w ) ] , {\displaystyle h_{\text{Bayes}}={\underset {w}{\operatorname {arg\;max} }}\,{\bigl }\;,}

where h Bayes {\displaystyle h_{\text{Bayes}}} is the prediction and P ( w ) {\displaystyle \;\operatorname {\mathbb {P} } (w)\;} is the prior probability.

Relation to minimizing Kullback–Leibler divergence and cross entropy

Finding θ ^ {\displaystyle {\hat {\theta }}} that maximizes the likelihood is asymptotically equivalent to finding the θ ^ {\displaystyle {\hat {\theta }}} that defines a probability distribution ( Q θ ^ {\displaystyle Q_{\hat {\theta }}} ) 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 P θ 0 {\displaystyle P_{\theta _{0}}} ). In an ideal world, P and Q are the same (and the only thing unknown is θ {\displaystyle \theta } 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 θ ^ {\displaystyle {\hat {\theta }}} ) to the real distribution P θ 0 {\displaystyle P_{\theta _{0}}} .

Proof.

For simplicity of notation, let's assume that P=Q. Let there be n i.i.d data samples y = ( y 1 , y 2 , , y n ) {\displaystyle \mathbf {y} =(y_{1},y_{2},\ldots ,y_{n})} from some probability y P θ 0 {\displaystyle y\sim P_{\theta _{0}}} , that we try to estimate by finding θ ^ {\displaystyle {\hat {\theta }}} that will maximize the likelihood using P θ {\displaystyle P_{\theta }} , then:

θ ^ = a r g m a x θ L P θ ( y ) = a r g m a x θ P θ ( y ) = a r g m a x θ P ( y θ ) = a r g m a x θ i = 1 n P ( y i θ ) = a r g m a x θ i = 1 n log P ( y i θ ) = a r g m a x θ ( i = 1 n log P ( y i θ ) i = 1 n log P ( y i θ 0 ) ) = a r g m a x θ i = 1 n ( log P ( y i θ ) log P ( y i θ 0 ) ) = a r g m a x θ i = 1 n log P ( y i θ ) P ( y i θ 0 ) = a r g m i n θ i = 1 n log P ( y i θ 0 ) P ( y i θ ) = a r g m i n θ 1 n i = 1 n log P ( y i θ 0 ) P ( y i θ ) = a r g m i n θ 1 n i = 1 n h θ ( y i ) n a r g m i n θ E [ h θ ( y ) ] = a r g m i n θ P θ 0 ( y ) h θ ( y ) d y = a r g m i n θ P θ 0 ( y ) log P ( y θ 0 ) P ( y θ ) d y = a r g m i n θ D KL ( P θ 0 P θ ) {\displaystyle {\begin{aligned}{\hat {\theta }}&={\underset {\theta }{\operatorname {arg\,max} }}\,L_{P_{\theta }}(\mathbf {y} )={\underset {\theta }{\operatorname {arg\,max} }}\,P_{\theta }(\mathbf {y} )={\underset {\theta }{\operatorname {arg\,max} }}\,P(\mathbf {y} \mid \theta )\\&={\underset {\theta }{\operatorname {arg\,max} }}\,\prod _{i=1}^{n}P(y_{i}\mid \theta )={\underset {\theta }{\operatorname {arg\,max} }}\,\sum _{i=1}^{n}\log P(y_{i}\mid \theta )\\&={\underset {\theta }{\operatorname {arg\,max} }}\,\left(\sum _{i=1}^{n}\log P(y_{i}\mid \theta )-\sum _{i=1}^{n}\log P(y_{i}\mid \theta _{0})\right)={\underset {\theta }{\operatorname {arg\,max} }}\,\sum _{i=1}^{n}\left(\log P(y_{i}\mid \theta )-\log P(y_{i}\mid \theta _{0})\right)\\&={\underset {\theta }{\operatorname {arg\,max} }}\,\sum _{i=1}^{n}\log {\frac {P(y_{i}\mid \theta )}{P(y_{i}\mid \theta _{0})}}={\underset {\theta }{\operatorname {arg\,min} }}\,\sum _{i=1}^{n}\log {\frac {P(y_{i}\mid \theta _{0})}{P(y_{i}\mid \theta )}}={\underset {\theta }{\operatorname {arg\,min} }}\,{\frac {1}{n}}\sum _{i=1}^{n}\log {\frac {P(y_{i}\mid \theta _{0})}{P(y_{i}\mid \theta )}}\\&={\underset {\theta }{\operatorname {arg\,min} }}\,{\frac {1}{n}}\sum _{i=1}^{n}h_{\theta }(y_{i})\quad {\underset {n\to \infty }{\longrightarrow }}\quad {\underset {\theta }{\operatorname {arg\,min} }}\,E\\&={\underset {\theta }{\operatorname {arg\,min} }}\,\int P_{\theta _{0}}(y)h_{\theta }(y)dy={\underset {\theta }{\operatorname {arg\,min} }}\,\int P_{\theta _{0}}(y)\log {\frac {P(y\mid \theta _{0})}{P(y\mid \theta )}}dy\\&={\underset {\theta }{\operatorname {arg\,min} }}\,D_{\text{KL}}(P_{\theta _{0}}\parallel P_{\theta })\end{aligned}}}

Where h θ ( x ) = log P ( x θ 0 ) P ( x θ ) {\displaystyle h_{\theta }(x)=\log {\frac {P(x\mid \theta _{0})}{P(x\mid \theta )}}} . Using h helps see how we are using the law of large numbers to move from the average of h(x) to the expectancy of it using the law of the unconscious statistician. The first several transitions have to do with laws of logarithm and that finding θ ^ {\displaystyle {\hat {\theta }}} that maximizes some function will also be the one that maximizes some monotonic transformation of that function (i.e.: adding/multiplying by a constant).

Since cross entropy is just Shannon's entropy plus KL divergence, and since the entropy of P θ 0 {\displaystyle P_{\theta _{0}}} is constant, then the MLE is also asymptotically minimizing cross entropy.

Examples

Discrete uniform distribution

Main article: German tank problem

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 n ^ {\displaystyle {\widehat {n}}} of n is the number m on the drawn ticket. (The likelihood is 0 for n < m, 1⁄n 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 n ^ {\displaystyle {\widehat {n}}} , 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 space

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 = 1⁄3, one which gives heads with probability p = 1⁄2 and another which gives heads with probability p = 2⁄3. 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:

P [ H = 49 p = 1 3 ] = ( 80 49 ) ( 1 3 ) 49 ( 1 1 3 ) 31 0.000 , P [ H = 49 p = 1 2 ] = ( 80 49 ) ( 1 2 ) 49 ( 1 1 2 ) 31 0.012 , P [ H = 49 p = 2 3 ] = ( 80 49 ) ( 2 3 ) 49 ( 1 2 3 ) 31 0.054   . {\displaystyle {\begin{aligned}\operatorname {\mathbb {P} } {\bigl }&={\binom {80}{49}}({\tfrac {1}{3}})^{49}(1-{\tfrac {1}{3}})^{31}\approx 0.000,\\\operatorname {\mathbb {P} } {\bigl }&={\binom {80}{49}}({\tfrac {1}{2}})^{49}(1-{\tfrac {1}{2}})^{31}\approx 0.012,\\\operatorname {\mathbb {P} } {\bigl }&={\binom {80}{49}}({\tfrac {2}{3}})^{49}(1-{\tfrac {2}{3}})^{31}\approx 0.054~.\end{aligned}}}

The likelihood is maximized when p = 2⁄3, and so this is the maximum likelihood estimate for p.

Discrete distribution, continuous parameter space

Now suppose that there was only one coin but its p could have been any value 0 ≤ p ≤ 1 . The likelihood function to be maximised is

L ( p ) = f D ( H = 49 p ) = ( 80 49 ) p 49 ( 1 p ) 31   , {\displaystyle L(p)=f_{D}(\mathrm {H} =49\mid p)={\binom {80}{49}}p^{49}(1-p)^{31}~,}

and the maximisation is over all possible values 0 ≤ p ≤ 1 .

Likelihood function for proportion value of a binomial process (n = 10)

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

0 = p ( ( 80 49 ) p 49 ( 1 p ) 31 )   , 0 = 49 p 48 ( 1 p ) 31 31 p 49 ( 1 p ) 30 = p 48 ( 1 p ) 30 [ 49 ( 1 p ) 31 p ] = p 48 ( 1 p ) 30 [ 49 80 p ]   . {\displaystyle {\begin{aligned}0&={\frac {\partial }{\partial p}}\left({\binom {80}{49}}p^{49}(1-p)^{31}\right)~,\\0&=49p^{48}(1-p)^{31}-31p^{49}(1-p)^{30}\\&=p^{48}(1-p)^{30}\left\\&=p^{48}(1-p)^{30}\left~.\end{aligned}}}

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

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

Continuous distribution, continuous parameter space

For the normal distribution N ( μ , σ 2 ) {\displaystyle {\mathcal {N}}(\mu ,\sigma ^{2})} which has probability density function

f ( x μ , σ 2 ) = 1 2 π σ 2   exp ( ( x μ ) 2 2 σ 2 ) , {\displaystyle f(x\mid \mu ,\sigma ^{2})={\frac {1}{{\sqrt {2\pi \sigma ^{2}}}\ }}\exp \left(-{\frac {(x-\mu )^{2}}{2\sigma ^{2}}}\right),}

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

f ( x 1 , , x n μ , σ 2 ) = i = 1 n f ( x i μ , σ 2 ) = ( 1 2 π σ 2 ) n / 2 exp ( i = 1 n ( x i μ ) 2 2 σ 2 ) . {\displaystyle 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).}

This family of distributions has two parameters: θ = (μσ); so we maximize the likelihood, L ( μ , σ 2 ) = f ( x 1 , , x n μ , σ 2 ) {\displaystyle {\mathcal {L}}(\mu ,\sigma ^{2})=f(x_{1},\ldots ,x_{n}\mid \mu ,\sigma ^{2})} , 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:

log ( L ( μ , σ 2 ) ) = n 2 log ( 2 π σ 2 ) 1 2 σ 2 i = 1 n ( x i μ ) 2 {\displaystyle \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}}

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

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

0 = μ log ( L ( μ , σ 2 ) ) = 0 2 n ( x ¯ μ ) 2 σ 2 . {\displaystyle {\begin{aligned}0&={\frac {\partial }{\partial \mu }}\log {\Bigl (}{\mathcal {L}}(\mu ,\sigma ^{2}){\Bigr )}=0-{\frac {\;-2n({\bar {x}}-\mu )\;}{2\sigma ^{2}}}.\end{aligned}}}

where x ¯ {\displaystyle {\bar {x}}} is the sample mean. This is solved by

μ ^ = x ¯ = i = 1 n x i n . {\displaystyle {\widehat {\mu }}={\bar {x}}=\sum _{i=1}^{n}{\frac {\,x_{i}\,}{n}}.}

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. Its expected value is equal to the parameter μ of the given distribution,

E [ μ ^ ] = μ , {\displaystyle \operatorname {\mathbb {E} } {\bigl }=\mu ,\,}

which means that the maximum likelihood estimator μ ^ {\displaystyle {\widehat {\mu }}} is unbiased.

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

0 = σ log ( L ( μ , σ 2 ) ) = n σ + 1 σ 3 i = 1 n ( x i μ ) 2 . {\displaystyle {\begin{aligned}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{aligned}}}

which is solved by

σ ^ 2 = 1 n i = 1 n ( x i μ ) 2 . {\displaystyle {\widehat {\sigma }}^{2}={\frac {1}{n}}\sum _{i=1}^{n}(x_{i}-\mu )^{2}.}

Inserting the estimate μ = μ ^ {\displaystyle \mu ={\widehat {\mu }}} we obtain

σ ^ 2 = 1 n i = 1 n ( x i x ¯ ) 2 = 1 n i = 1 n x i 2 1 n 2 i = 1 n j = 1 n x i x j . {\displaystyle {\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}.}

To calculate its expected value, it is convenient to rewrite the expression in terms of zero-mean random variables (statistical error) δ i μ x i {\displaystyle \delta _{i}\equiv \mu -x_{i}} . Expressing the estimate in these variables yields

σ ^ 2 = 1 n i = 1 n ( μ δ i ) 2 1 n 2 i = 1 n j = 1 n ( μ δ i ) ( μ δ j ) . {\displaystyle {\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}).}

Simplifying the expression above, utilizing the facts that E [ δ i ] = 0 {\displaystyle \operatorname {\mathbb {E} } {\bigl }=0} and E [ δ i 2 ] = σ 2 {\displaystyle \operatorname {E} {\bigl }=\sigma ^{2}} , allows us to obtain

E [ σ ^ 2 ] = n 1 n σ 2 . {\displaystyle \operatorname {\mathbb {E} } {\bigl }={\frac {\,n-1\,}{n}}\sigma ^{2}.}

This means that the estimator σ ^ 2 {\displaystyle {\widehat {\sigma }}^{2}} is biased for σ 2 {\displaystyle \sigma ^{2}} . It can also be shown that σ ^ {\displaystyle {\widehat {\sigma }}} is biased for σ {\displaystyle \sigma } , but that both σ ^ 2 {\displaystyle {\widehat {\sigma }}^{2}} and σ ^ {\displaystyle {\widehat {\sigma }}} are consistent.

Formally we say that the maximum likelihood estimator for θ = ( μ , σ 2 ) {\displaystyle \theta =(\mu ,\sigma ^{2})} is

θ ^ = ( μ ^ , σ ^ 2 ) . {\displaystyle {\widehat {\theta \,}}=\left({\widehat {\mu }},{\widehat {\sigma }}^{2}\right).}

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:

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

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 variables

It may be the case that variables are correlated, that is, not independent. Two random variables y 1 {\displaystyle y_{1}} and y 2 {\displaystyle y_{2}} are independent only if their joint probability density function is the product of the individual probability density functions, i.e.

f ( y 1 , y 2 ) = f ( y 1 ) f ( y 2 ) {\displaystyle f(y_{1},y_{2})=f(y_{1})f(y_{2})\,}

Suppose one constructs an order-n Gaussian vector out of random variables ( y 1 , , y n ) {\displaystyle (y_{1},\ldots ,y_{n})} , where each variable has means given by ( μ 1 , , μ n ) {\displaystyle (\mu _{1},\ldots ,\mu _{n})} . Furthermore, let the covariance matrix be denoted by Σ {\displaystyle {\mathit {\Sigma }}} . The joint probability density function of these n random variables then follows a multivariate normal distribution given by:

f ( y 1 , , y n ) = 1 ( 2 π ) n / 2 det ( Σ ) exp ( 1 2 [ y 1 μ 1 , , y n μ n ] Σ 1 [ y 1 μ 1 , , y n μ n ] T ) {\displaystyle f(y_{1},\ldots ,y_{n})={\frac {1}{(2\pi )^{n/2}{\sqrt {\det({\mathit {\Sigma }})}}}}\exp \left(-{\frac {1}{2}}\left{\mathit {\Sigma }}^{-1}\left^{\mathrm {T} }\right)}

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

f ( y 1 , y 2 ) = 1 2 π σ 1 σ 2 1 ρ 2 exp [ 1 2 ( 1 ρ 2 ) ( ( y 1 μ 1 ) 2 σ 1 2 2 ρ ( y 1 μ 1 ) ( y 2 μ 2 ) σ 1 σ 2 + ( y 2 μ 2 ) 2 σ 2 2 ) ] {\displaystyle f(y_{1},y_{2})={\frac {1}{2\pi \sigma _{1}\sigma _{2}{\sqrt {1-\rho ^{2}}}}}\exp \left}

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.

Example

X 1 ,   X 2 , ,   X m {\displaystyle X_{1},\ X_{2},\ldots ,\ X_{m}} 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 n {\displaystyle n} : x 1 + x 2 + + x m = n {\displaystyle x_{1}+x_{2}+\cdots +x_{m}=n} . The probability of each box is p i {\displaystyle p_{i}} , with a constraint: p 1 + p 2 + + p m = 1 {\displaystyle p_{1}+p_{2}+\cdots +p_{m}=1} . This is a case in which the X i {\displaystyle X_{i}} s are not independent, the joint probability of a vector x 1 ,   x 2 , , x m {\displaystyle x_{1},\ x_{2},\ldots ,x_{m}} is called the multinomial and has the form:

f ( x 1 , x 2 , , x m p 1 , p 2 , , p m ) = n ! x i ! p i x i = ( n x 1 , x 2 , , x m ) p 1 x 1 p 2 x 2 p m x m {\displaystyle 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}}}

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

The log-likelihood of this is:

( p 1 , p 2 , , p m ) = log n ! i = 1 m log x i ! + i = 1 m x i log p i {\displaystyle \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}}

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

L ( p 1 , p 2 , , p m , λ ) = ( p 1 , p 2 , , p m ) + λ ( 1 i = 1 m p i ) {\displaystyle 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)}

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

p ^ i = x i n {\displaystyle {\hat {p}}_{i}={\frac {x_{i}}{n}}}

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

Iterative procedures

Except for special cases, the likelihood equations

( θ ; y ) θ = 0 {\displaystyle {\frac {\partial \ell (\theta ;\mathbf {y} )}{\partial \theta }}=0}

cannot be solved explicitly for an estimator θ ^ = θ ^ ( y ) {\displaystyle {\widehat {\theta }}={\widehat {\theta }}(\mathbf {y} )} . Instead, they need to be solved iteratively: starting from an initial guess of θ {\displaystyle \theta } (say θ ^ 1 {\displaystyle {\widehat {\theta }}_{1}} ), one seeks to obtain a convergent sequence { θ ^ r } {\displaystyle \left\{{\widehat {\theta }}_{r}\right\}} . Many methods for this kind of optimization problem are available, but the most commonly used ones are algorithms based on an updating formula of the form

θ ^ r + 1 = θ ^ r + η r d r ( θ ^ ) {\displaystyle {\widehat {\theta }}_{r+1}={\widehat {\theta }}_{r}+\eta _{r}\mathbf {d} _{r}\left({\widehat {\theta }}\right)}

where the vector d r ( θ ^ ) {\displaystyle \mathbf {d} _{r}\left({\widehat {\theta }}\right)} indicates the descent direction of the rth "step," and the scalar η r {\displaystyle \eta _{r}} captures the "step length," also known as the learning rate.

Gradient descent method

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

η r R + {\displaystyle \eta _{r}\in \mathbb {R} ^{+}} that is small enough for convergence and d r ( θ ^ ) = ( θ ^ r ; y ) {\displaystyle \mathbf {d} _{r}\left({\widehat {\theta }}\right)=\nabla \ell \left({\widehat {\theta }}_{r};\mathbf {y} \right)}

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 method

η r = 1 {\displaystyle \eta _{r}=1} and d r ( θ ^ ) = H r 1 ( θ ^ ) s r ( θ ^ ) {\displaystyle \mathbf {d} _{r}\left({\widehat {\theta }}\right)=-\mathbf {H} _{r}^{-1}\left({\widehat {\theta }}\right)\mathbf {s} _{r}\left({\widehat {\theta }}\right)}

where s r ( θ ^ ) {\displaystyle \mathbf {s} _{r}({\widehat {\theta }})} is the score and H r 1 ( θ ^ ) {\displaystyle \mathbf {H} _{r}^{-1}\left({\widehat {\theta }}\right)} is the inverse of the Hessian matrix of the log-likelihood function, both evaluated the rth iteration. 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

d r ( θ ^ ) = [ 1 n t = 1 n ( θ ; y ) θ ( ( θ ; y ) θ ) T ] 1 s r ( θ ^ ) {\displaystyle \mathbf {d} _{r}\left({\widehat {\theta }}\right)=-\left^{-1}\mathbf {s} _{r}\left({\widehat {\theta }}\right)}

Quasi-Newton methods

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

Davidon–Fletcher–Powell formula

DFP formula finds a solution that is symmetric, positive-definite and closest to the current approximate value of second-order derivative:

H k + 1 = ( I γ k y k s k T ) H k ( I γ k s k y k T ) + γ k y k y k T , {\displaystyle \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}},}

where

y k = ( x k + s k ) ( x k ) , {\displaystyle y_{k}=\nabla \ell (x_{k}+s_{k})-\nabla \ell (x_{k}),}
γ k = 1 y k T s k , {\displaystyle \gamma _{k}={\frac {1}{y_{k}^{T}s_{k}}},}
s k = x k + 1 x k . {\displaystyle s_{k}=x_{k+1}-x_{k}.}

Broyden–Fletcher–Goldfarb–Shanno algorithm

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

B k + 1 = B k + y k y k T y k T s k B k s k s k T B k T s k T B k s k   , {\displaystyle 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}}}\ ,}

where

y k = ( x k + s k ) ( x k ) , {\displaystyle y_{k}=\nabla \ell (x_{k}+s_{k})-\nabla \ell (x_{k}),}
s k = x k + 1 x k . {\displaystyle s_{k}=x_{k+1}-x_{k}.}

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 scoring

Another popular method is to replace the Hessian with the Fisher information matrix, I ( θ ) = E [ H r ( θ ^ ) ] {\displaystyle {\mathcal {I}}(\theta )=\operatorname {\mathbb {E} } \left} , 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, 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.

History

Ronald Fisher in 1913

Early users of maximum likelihood include Carl Friedrich Gauss, Pierre-Simon Laplace, Thorvald N. Thiele, and Francis Ysidro Edgeworth. It was Ronald Fisher however, between 1912 and 1922, who singlehandedly created the modern version of the method.

Maximum-likelihood estimation finally transcended heuristic justification in a proof published by Samuel S. Wilks in 1938, now called Wilks' theorem. The theorem shows that the error in the logarithm of likelihood values for estimates from multiple independent observations is asymptotically χ-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. Wilks continued to improve on the generality of the theorem throughout his life, with his most general proof published in 1962.

Reviews of the development of maximum likelihood estimation have been provided by a number of authors.

See also

Related concepts

  • 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 methods

References

  1. Rossi, Richard J. (2018). Mathematical Statistics: An Introduction to Likelihood Based Inference. New York: John Wiley & Sons. p. 227. ISBN 978-1-118-77104-4.
  2. Hendry, David F.; Nielsen, Bent (2007). Econometric Modeling: A Likelihood Approach. Princeton: Princeton University Press. ISBN 978-0-691-13128-3.
  3. Chambers, Raymond L.; Steel, David G.; Wang, Suojin; Welsh, Alan (2012). Maximum Likelihood Estimation for Sample Surveys. Boca Raton: CRC Press. ISBN 978-1-58488-632-7.
  4. Ward, Michael Don; Ahlquist, John S. (2018). Maximum Likelihood for Social Science: Strategies for Analysis. New York: Cambridge University Press. ISBN 978-1-107-18582-1.
  5. Press, W.H.; Flannery, B.P.; Teukolsky, S.A.; Vetterling, W.T. (1992). "Least Squares as a Maximum Likelihood Estimator". Numerical Recipes in FORTRAN: The Art of Scientific Computing (2nd ed.). Cambridge: Cambridge University Press. pp. 651–655. ISBN 0-521-43064-X.
  6. Myung, I.J. (2003). "Tutorial on maximum likelihood Estimation". Journal of Mathematical Psychology. 47 (1): 90–100. doi:10.1016/S0022-2496(02)00028-7.
  7. Gourieroux, Christian; Monfort, Alain (1995). Statistics and Econometrics Models. Cambridge University Press. p. 161. ISBN 0-521-40551-3.
  8. Kane, Edward J. (1968). Economic Statistics and Econometrics. New York, NY: Harper & Row. p. 179.
  9. Small, Christoper G.; Wang, Jinfang (2003). "Working with roots". Numerical Methods for Nonlinear Estimating Equations. Oxford University Press. pp. 74–124. ISBN 0-19-850688-0.
  10. Kass, Robert E.; Vos, Paul W. (1997). Geometrical Foundations of Asymptotic Inference. New York, NY: John Wiley & Sons. p. 14. ISBN 0-471-82668-5.
  11. Papadopoulos, Alecos (25 September 2013). "Why we always put log() before the joint pdf when we use MLE (Maximum likelihood Estimation)?". Stack Exchange.
  12. ^ Silvey, S. D. (1975). Statistical Inference. London, UK: Chapman and Hall. p. 79. ISBN 0-412-13820-4.
  13. Olive, David (2004). "Does the MLE maximize the likelihood?" (PDF). Southern Illinois University.
  14. Schwallie, Daniel P. (1985). "Positive definite maximum likelihood covariance estimators". Economics Letters. 17 (1–2): 115–117. doi:10.1016/0165-1765(85)90139-9.
  15. Magnus, Jan R. (2017). Introduction to the Theory of Econometrics. Amsterdam: VU University Press. pp. 64–65. ISBN 978-90-8659-766-6.
  16. Pfanzagl (1994, p. 206)
  17. By Theorem 2.5 in Newey, Whitney K.; McFadden, Daniel (1994). "Chapter 36: Large sample estimation and hypothesis testing". In Engle, Robert; McFadden, Dan (eds.). Handbook of Econometrics, Vol.4. Elsevier Science. pp. 2111–2245. ISBN 978-0-444-88766-5.
  18. ^ By Theorem 3.3 in Newey, Whitney K.; McFadden, Daniel (1994). "Chapter 36: Large sample estimation and hypothesis testing". In Engle, Robert; McFadden, Dan (eds.). Handbook of Econometrics, Vol.4. Elsevier Science. pp. 2111–2245. ISBN 978-0-444-88766-5.
  19. Zacks, Shelemyahu (1971). The Theory of Statistical Inference. New York: John Wiley & Sons. p. 223. ISBN 0-471-98103-6.
  20. See formula 20 in Cox, David R.; Snell, E. Joyce (1968). "A general definition of residuals". Journal of the Royal Statistical Society, Series B. 30 (2): 248–275. JSTOR 2984505.
  21. Kano, Yutaka (1996). "Third-order efficiency implies fourth-order efficiency". Journal of the Japan Statistical Society. 26: 101–117. doi:10.14490/jjss1995.26.101.
  22. Christensen, Henrikt I. "Pattern Recognition" (PDF) (lecture). Bayesian Decision Theory - CS 7616. Georgia Tech.
  23. 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)
  24. Introduction to Statistical Inference | Stanford (Lecture 16 — MLE under model misspecification)
  25. Sycorax says Reinstate Monica (https://stats.stackexchange.com/users/22311/sycorax-says-reinstate-monica), the relationship between maximizing the likelihood and minimizing the cross-entropy, URL (version: 2019-11-06): https://stats.stackexchange.com/q/364237
  26. Fletcher, R. (1987). Practical Methods of Optimization (Second ed.). New York, NY: John Wiley & Sons. ISBN 0-471-91547-5.
  27. Nocedal, Jorge; Wright, Stephen J. (2006). Numerical Optimization (Second ed.). New York, NY: Springer. ISBN 0-387-30303-0.
  28. Daganzo, Carlos (1979). Multinomial Probit: The Theory and its Application to Demand Forecasting. New York: Academic Press. pp. 61–78. ISBN 0-12-201150-3.
  29. Gould, William; Pitblado, Jeffrey; Poi, Brian (2010). Maximum Likelihood Estimation with Stata (Fourth ed.). College Station: Stata Press. pp. 13–20. ISBN 978-1-59718-078-8.
  30. Murphy, Kevin P. (2012). Machine Learning: A Probabilistic Perspective. Cambridge: MIT Press. p. 247. ISBN 978-0-262-01802-9.
  31. Amemiya, Takeshi (1985). Advanced Econometrics. Cambridge: Harvard University Press. pp. 137–138. ISBN 0-674-00560-0.
  32. Sargan, Denis (1988). "Methods of Numerical Optimization". Lecture Notes on Advanced Econometric Theory. Oxford: Basil Blackwell. pp. 161–169. ISBN 0-631-14956-2.
  33. See theorem 10.1 in Avriel, Mordecai (1976). Nonlinear Programming: Analysis and Methods. Englewood Cliffs, NJ: Prentice-Hall. pp. 293–294. ISBN 978-0-486-43227-4.
  34. Gill, Philip E.; Murray, Walter; Wright, Margaret H. (1981). Practical Optimization. London, UK: Academic Press. pp. 312–313. ISBN 0-12-283950-1.
  35. Edgeworth, Francis Y. (Sep 1908). "On the probable errors of frequency-constants". Journal of the Royal Statistical Society. 71 (3): 499–512. doi:10.2307/2339293. JSTOR 2339293.
  36. Edgeworth, Francis Y. (Dec 1908). "On the probable errors of frequency-constants". Journal of the Royal Statistical Society. 71 (4): 651–678. doi:10.2307/2339378. JSTOR 2339378.
  37. Pfanzagl, Johann (1994). Parametric Statistical Theory. Walter de Gruyter. pp. 207–208. doi:10.1515/9783110889765. ISBN 978-3-11-013863-4. MR 1291393.
  38. Hald, Anders (1999). "On the History of Maximum Likelihood in Relation to Inverse Probability and Least Squares". Statistical Science. 14 (2): 214–222. ISSN 0883-4237.
  39. Wilks, S.S. (1938). "The large-sample distribution of the likelihood ratio for testing composite hypotheses". Annals of Mathematical Statistics. 9: 60–62. doi:10.1214/aoms/1177732360.
  40. Owen, Art B. (2001). Empirical Likelihood. London, UK; Boca Raton, FL: Chapman & Hall; CRC Press. ISBN 978-1-58488-071-4.
  41. Wilks, Samuel S. (1962). Mathematical Statistics. New York, NY: John Wiley & Sons. ISBN 978-0-471-94650-2.
  42. Savage, Leonard J. (1976). "On rereading R.A. Fisher". The Annals of Statistics. 4 (3): 441–500. doi:10.1214/aos/1176343456. JSTOR 2958221.
  43. Pratt, John W. (1976). "F. Y. Edgeworth and R. A. Fisher on the efficiency of maximum likelihood estimation". The Annals of Statistics. 4 (3): 501–514. doi:10.1214/aos/1176343457. JSTOR 2958222.
  44. Stigler, Stephen M. (1978). "Francis Ysidro Edgeworth, statistician". Journal of the Royal Statistical Society, Series A. 141 (3): 287–322. doi:10.2307/2344804. JSTOR 2344804.
  45. Stigler, Stephen M. (1986). The history of statistics: the measurement of uncertainty before 1900. Harvard University Press. ISBN 978-0-674-40340-6.
  46. Stigler, Stephen M. (1999). Statistics on the table: the history of statistical concepts and methods. Harvard University Press. ISBN 978-0-674-83601-3.
  47. Hald, Anders (1998). A history of mathematical statistics from 1750 to 1930. New York, NY: Wiley. ISBN 978-0-471-17912-2.
  48. Hald, Anders (1999). "On the history of maximum likelihood in relation to inverse probability and least squares". Statistical Science. 14 (2): 214–222. doi:10.1214/ss/1009212248. JSTOR 2676741.
  49. Aldrich, John (1997). "R.A. Fisher and the making of maximum likelihood 1912–1922". Statistical Science. 12 (3): 162–176. doi:10.1214/ss/1030037906. MR 1617519.

Further reading

External links

Statistics
Descriptive statistics
Continuous data
Center
Dispersion
Shape
Count data
Summary tables
Dependence
Graphics
Data collection
Study design
Survey methodology
Controlled experiments
Adaptive designs
Observational studies
Statistical inference
Statistical theory
Frequentist inference
Point estimation
Interval estimation
Testing hypotheses
Parametric tests
Specific tests
Goodness of fit
Rank statistics
Bayesian inference
Correlation
Regression analysis
Linear regression
Non-standard predictors
Generalized linear model
Partition of variance
Categorical / Multivariate / Time-series / Survival analysis
Categorical
Multivariate
Time-series
General
Specific tests
Time domain
Frequency domain
Survival
Survival function
Hazard function
Test
Applications
Biostatistics
Engineering statistics
Social statistics
Spatial statistics
Categories: