If the likelihood function isdifferentiable, thederivative test for finding maxima can be applied. In some cases, the first-order conditions of the likelihood function can be solved analytically; for instance, theordinary least squares estimator for alinear regression model maximizes the likelihood when the random errors are assumed to havenormal distributions with the same variance.[5]
The goal of maximum likelihood estimation is to find the values of the model parameters that maximize the likelihood function over the parameter space,[6] that is:
Intuitively, this selects the parameter values that make the observed data most probable. The specific value that maximizes the likelihood function is called the maximum likelihood estimate. Further, if the function so defined ismeasurable, then it is called the maximum likelihoodestimator. It is generally a function defined over thesample space, i.e. taking a given sample as its argument. Asufficient but not necessary condition for its existence is for the likelihood function to becontinuous over a parameter space that iscompact.[7] For anopen the likelihood function may increase without ever reaching a supremum value.
In practice, it is often convenient to work with thenatural logarithm of the likelihood function, called thelog-likelihood:Since the logarithm is amonotonic function, the maximum of occurs at the same value of as does the maximum of[8] If isdifferentiable insufficient conditions for the occurrence of a maximum (or a minimum) areknown as the likelihood equations. For some models, these equations can be explicitly solved for but in general no closed-form solution to the maximization problem is known or available, and an MLE can only be found vianumerical optimization. Another problem is that in finite samples, there may exist multipleroots for the likelihood equations.[9] Whether the identified root of the likelihood equations is indeed a (local) maximum depends on whether the matrix of second-order partial and cross-partial derivatives, the so-calledHessian matrix
While the domain of the likelihood function—theparameter space—is generally a finite-dimensional subset ofEuclidean space, additionalrestrictions sometimes need to be incorporated into the estimation process. The parameter space can be expressed as
where is avector-valued function mapping into Estimating the true parameter belonging to then, as a practical matter, means to find the maximum of the likelihood function subject to theconstraint
Theoretically, the most natural approach to thisconstrained optimization problem is the method of substitution, that is "filling out" the restrictions to a set in such a way that is aone-to-one function from to itself, and reparameterize the likelihood function by setting[12] Because of the equivariance of the maximum likelihood estimator, the properties of the MLE apply to the restricted estimates also.[13] For instance, in amultivariate normal distribution thecovariance matrix must bepositive-definite; this restriction can be imposed by replacing where is a realupper triangular matrix and is itstranspose.[14]
In practice, restrictions are usually imposed using the method of Lagrange which, given the constraints as defined above, leads to therestricted likelihood equations and
where is a column-vector ofLagrange multipliers and is thek × rJacobian matrix of partial derivatives.[12] Naturally, if the constraints are not binding at the maximum, the Lagrange multipliers should be zero.[15] This in turn allows for a statistical test of the "validity" of the constraint, known as theLagrange multiplier test.
A maximum likelihood estimator is anextremum estimator obtained by maximizing, as a function ofθ, theobjective function. If the data areindependent and identically distributed, then we havethis being the sample analogue of the expected log-likelihood, 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.[16] However, like other estimation methods, maximum likelihood estimation possesses a number of attractivelimiting 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 is the maximum likelihood estimator for, and if is a bijective transform of, then the maximum likelihood estimator for is. 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 theCramér–Rao lower bound when the sample size tends to infinity. This means that no consistent estimator has lower asymptoticmean squared error than the MLE (or other estimators attaining this bound), which also means that MLE hasasymptotic normality.
Second-order efficiency after correction for bias.
Under the conditions outlined below, the maximum likelihood estimator isconsistent. The consistency means that if the data were generated by and we have a sufficiently large number of observationsn, then it is possible to find the value ofθ0 with arbitrary precision. In mathematical terms this means that asn goes to infinity the estimatorconverges in probability to its true value:
Under slightly stronger conditions, the estimator convergesalmost surely (orstrongly):
In practical applications, data is never generated by. Rather, is a model, often in idealized form, of the process generated by the data. It is a common aphorism in statistics thatall 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.[17]
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 beenobservationally 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.
Compactness: the parameter space Θ of the model iscompact.
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:
bothconcavity of the log-likelihood function and compactness of some (nonempty) upperlevel sets of the log-likelihood function, or
existence of a compactneighborhoodN ofθ0 such that outside ofN the log-likelihood function is less than the maximum by at least someε > 0.
Continuity: the functionlnf(x |θ) is continuous inθ for almost all values ofx:
The continuity here can be replaced with a slightly weaker condition ofupper semi-continuity.
Dominance: there existsD(x) integrable with respect to the distributionf(x | θ0) such thatBy theuniform law of large numbers, the dominance condition together with continuity establish the uniform convergence in probability of the log-likelihood:
The dominance condition can be employed in the case ofi.i.d. observations. In the non-i.i.d. case, the uniform convergence in probability can be checked by showing that the sequence isstochastically equicontinuous.
If one wants to demonstrate that the ML estimator converges toθ0almost surely, then a stronger condition of uniform convergence almost surely has to be imposed:
Additionally, if (as assumed above) the data were generated by, then under certain conditions, it can also be shown that the maximum likelihood estimatorconverges in distribution to a normal distribution. Specifically,[18]whereI is theFisher information matrix.
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 is the MLE for, and if is any transformation of, then the MLE for is by definition[19]
The MLE is also equivariant with respect to certain transformations of the data. If where is one to one and does not depend on the parameters to be estimated, then the density functions satisfy
and hence the likelihood functions for and 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, then follows alog-normal distribution. The density of Y follows with standardNormal and, for.
As assumed above, if the data were generated by then under certain conditions, it can also be shown that the maximum likelihood estimatorconverges in distribution to a normal distribution. It is√n-consistent and asymptotically efficient, meaning that it reaches theCramér–Rao bound. Specifically,[18]
However, when we consider the higher-order terms in theexpansion of the distribution of this estimator, it turns out thatθmle has bias of order1⁄n. This bias is equal to (componentwise)[20]
where (with superscripts) denotes the (j,k)-th component of theinverse Fisher information matrix, and
Using these formulae it is possible to estimate the second-order bias of the maximum likelihood estimator, andcorrect for that bias by subtracting it:This estimator is unbiased up to the terms of order1/n, and is called thebias-corrected maximum likelihood estimator.
This bias-corrected estimator issecond-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 order1/n2 . 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 isnot third-order efficient.[21]
where is the prior distribution for the parameterθ and where is the probability of the data averaged over all parameters. Since the denominator is independent ofθ, the Bayesian estimator is obtained by maximizing with respect toθ. If we further assume that the prior is a uniform distribution, the Bayesian estimator is obtained by maximizing the likelihood function. Thus the Bayesian estimator coincides with the maximum likelihood estimator for a uniform prior distribution.
Application of maximum-likelihood estimation in Bayes decision theory
In many practical applications inmachine 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.[22]
Thus, the Bayes Decision Rule is stated as
"decide if otherwise decide"
where are predictions of different classes. From a perspective of minimizing error, it can also be stated aswhereif we decide and if we decide
By applyingBayes' theorem,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:where is the prediction and is theprior probability.
Relation to minimizing Kullback–Leibler divergence and cross entropy
Finding that maximizes the likelihood is asymptotically equivalent to finding the that defines a probability distribution () that has a minimal distance, in terms ofKullback–Leibler divergence, to the real probability distribution from which our data were generated (i.e., generated by).[23] In an ideal world, P and Q are the same (and the only thing unknown is 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) to the real distribution.[24]
Proof.
For simplicity of notation, let's assume that P=Q. Let there beni.i.d data samples from some probability, that we try to estimate by finding that will maximize the likelihood using, then:
Where. Usingh helps see how we are using thelaw of large numbers to move from the average ofh(x) to theexpectancy of it using thelaw of the unconscious statistician. The first several transitions have to do with laws oflogarithm and that finding that maximizes some function will also be the one that maximizes some monotonic transformation of that function (i.e.: adding/multiplying by a constant).
Sincecross entropy is justShannon's entropy plus KL divergence, and since the entropy of is constant, then the MLE is also asymptotically minimizing cross entropy.[25]
Consider a case wheren tickets numbered from 1 ton are placed in a box and one is selected at random (seeuniform distribution); thus, the sample size is 1. Ifn is unknown, then the maximum likelihood estimator ofn is the numberm on the drawn ticket. (The likelihood is 0 forn < m,1⁄n forn ≥ m, and this is greatest whenn = m. Note that the maximum likelihood estimate ofn occurs at the lower extreme of possible values {m, m + 1, ...}, rather than somewhere in the "middle" of the range of possible values, which would result in less bias.) Theexpected value of the numberm on the drawn ticket, and therefore the expected value of, is (n + 1)/2. As a result, with a sample size of 1, the maximum likelihood estimator forn will systematically underestimaten by (n − 1)/2.
Suppose one wishes to determine just how biased anunfair coin is. Call the probability of tossing a 'head'p. The goal then becomes to determinep.
Suppose the coin is tossed 80 times: i.e. the sample might be something likex1 = H,x2 = T, ...,x80 = T, and the count of the number ofheads "H" is observed.
The probability of tossingtails is 1 − p (so herep 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 probabilityp = 1⁄3, one which gives heads with probabilityp = 1⁄2 and another which gives heads with probabilityp = 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 theprobability mass function of thebinomial distribution with sample size equal to 80, number successes equal to 49 but for different values ofp (the "probability of success"), the likelihood function (defined below) takes one of three values:
The likelihood is maximized whenp = 2⁄3, and so this is themaximum likelihood estimate for p.
Now suppose that there was only one coin but itsp could have been any value 0 ≤p ≤ 1 . The likelihood function to be maximised is
and the maximisation is over all possible values0 ≤p ≤ 1 .
Likelihood function for proportion value of a binomial process (n = 10)
One way to maximize this function is bydifferentiating with respect top and setting to zero:
This is a product of three terms. The first term is 0 whenp = 0. The second is 0 whenp = 1. The third is zero whenp = 49⁄80. The solution that maximizes the likelihood is clearlyp = 49⁄80 (sincep = 0 andp = 1 result in a likelihood of 0). Thus themaximum likelihood estimator forp is49⁄80.
This result is easily generalized by substituting a letter such ass in the place of 49 to represent the observed number of 'successes' of ourBernoulli trials, and a letter such asn in the place of 80 to represent the number of Bernoulli trials. Exactly the same calculation yieldss⁄n which is the maximum likelihood estimator for any sequence ofn Bernoulli trials resulting ins 'successes'.
Continuous distribution, continuous parameter space
This family of distributions has two parameters:θ = (μ, σ); so we maximize the likelihood,, over both parameters simultaneously, or if possible, individually.
Since thelogarithm function itself is acontinuousstrictly increasing function over therange 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:
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. Itsexpected value is equal to the parameterμ of the given distribution,
which means that the maximum likelihood estimator is unbiased.
Similarly we differentiate the log-likelihood with respect toσ and equate to zero:
which is solved by
Inserting the estimate we obtain
To calculate its expected value, it is convenient to rewrite the expression in terms of zero-mean random variables (statistical error). Expressing the estimate in these variables yields
Simplifying the expression above, utilizing the facts that and, allows us to obtain
This means that the estimator is biased for. It can also be shown that is biased for, but that both and are consistent.
Formally we say that themaximum likelihood estimator for is
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:
This maximum log-likelihood can be shown to be the same for more generalleast squares, even fornon-linear least squares. This is often used in determining likelihood-based approximateconfidence intervals andconfidence regions, which are generally more accurate than those using the asymptotic normality discussed above.
It may be the case that variables are correlated, or more generally, not independent. Two random variables and are independent only if their joint probability density function is the product of the individual probability density functions, i.e.
Suppose one constructs an order-n Gaussian vector out of random variables, where each variable has means given by. Furthermore, let thecovariance matrix be denoted by. The joint probability density function of thesen random variables then follows amultivariate normal distribution given by:
In thebivariate case, the joint probability density function is given by:
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.
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:. The probability of each box is, with a constraint:. This is a case in which thes are not independent, the joint probability of a vector is called the multinomial and has the form:
Each box taken separately against all the other boxes is a binomial and this is an extension thereof.
The log-likelihood of this is:
The constraint has to be taken into account and use the Lagrange multipliers:
By posing all the derivatives to be 0, the most natural estimate is derived
Maximizing log likelihood, with and without constraints, can be an unsolvable problem in closed form, then we have to use iterative procedures.
Except for special cases, the likelihood equations
cannot be solved explicitly for an estimator. Instead, they need to be solvediteratively: starting from an initial guess of (say), one seeks to obtain a convergent sequence. Many methods for this kind ofoptimization problem are available,[26][27] but the most commonly used ones are algorithms based on an updating formula of the form
(Note: here it is a maximization problem, so the sign before gradient is flipped)
that is small enough for convergence and
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.
BFGS also gives a solution that is symmetric and positive-definite:
where
BFGS method is not guaranteed to converge unless the function has a quadraticTaylor expansion near an optimum. However, BFGS can have acceptable performance even for non-smooth optimization instances
Another popular method is to replace the Hessian with theFisher information matrix,, giving us the Fisher scoring algorithm. This procedure is standard in the estimation of many methods, such asgeneralized linear models.
Although popular, quasi-Newton methods may converge to astationary point that is not necessarily a local or global maximum,[33] but rather a local minimum or asaddle 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 bothnegative definite andwell-conditioned.[34]
Maximum-likelihood estimation finally transcendedheuristic justification in a proof published bySamuel S. Wilks in 1938, now calledWilks' theorem.[39] 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 aconfidence region around any estimate of the parameters. The only difficult part of Wilks' proof depends on the expected value of theFisher information matrix, which is provided by a theorem proven by Fisher.[40] Wilks continued to improve on the generality of the theorem throughout his life, with his most general proof published in 1962.[41]
Reviews of the development of maximum likelihood estimation have been provided by a number of authors.[42][43][44][45][46][47][48][49]
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 containsoutliers
Rao–Blackwell theorem: yields a process for finding the best possible unbiased estimator (in the sense of having minimalmean 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 achi-squared distribution
^Rossi, Richard J. (2018).Mathematical Statistics: An Introduction to Likelihood Based Inference. New York: John Wiley & Sons. p. 227.ISBN978-1-118-77104-4.
^Chambers, Raymond L.; Steel, David G.; Wang, Suojin; Welsh, Alan (2012).Maximum Likelihood Estimation for Sample Surveys. Boca Raton: CRC Press.ISBN978-1-58488-632-7.
^Ward, Michael Don; Ahlquist, John S. (2018).Maximum Likelihood for Social Science: Strategies for Analysis. New York: Cambridge University Press.ISBN978-1-107-18582-1.
^Small, Christoper G.; Wang, Jinfang (2003)."Working with roots".Numerical Methods for Nonlinear Estimating Equations. Oxford University Press. pp. 74–124.ISBN0-19-850688-0.
^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.
^Magnus, Jan R. (2017).Introduction to the Theory of Econometrics. Amsterdam: VU University Press. pp. 64–65.ISBN978-90-8659-766-6.
^By Theorem 2.5 inNewey, 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.ISBN978-0-444-88766-5.
^abBy Theorem 3.3 inNewey, 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.ISBN978-0-444-88766-5.
^Zacks, Shelemyahu (1971).The Theory of Statistical Inference. New York: John Wiley & Sons. p. 223.ISBN0-471-98103-6.
^Daganzo, Carlos (1979).Multinomial Probit: The Theory and its Application to Demand Forecasting. New York: Academic Press. pp. 61–78.ISBN0-12-201150-3.
^Gould, William; Pitblado, Jeffrey; Poi, Brian (2010).Maximum Likelihood Estimation with Stata (Fourth ed.). College Station: Stata Press. pp. 13–20.ISBN978-1-59718-078-8.
Magnus, Jan R. (2017). "Maximum Likelihood".Introduction to the Theory of Econometrics. Amsterdam, NL: VU University Press. pp. 53–68.ISBN978-90-8659-766-6.
Millar, Russell B. (2011).Maximum Likelihood Estimation and Inference. Hoboken, NJ: Wiley.ISBN978-0-470-09482-2.
Severini, Thomas A. (2000).Likelihood Methods in Statistics. New York, NY: Oxford University Press.ISBN0-19-850650-3.
Ward, Michael D.; Ahlquist, John S. (2018).Maximum Likelihood for Social Science: Strategies for Analysis. Cambridge University Press.ISBN978-1-316-63682-4.