The Method of Maximum Likelihood
Statement
Given a dataset x = (x1, …, xn) modelled as independent draws from a density (or mass function) f(x; θ) indexed by a parameter θ, the likelihood is the joint density read as a function of θ with the data held fixed, L(θ) = ∏i f(xi; θ). The maximum-likelihood estimator θ̂ maximises L, equivalently the log-likelihood ℓ(θ) = ∑i ln f(xi; θ), and for a regular interior maximum it solves the estimating (score) equation ∑i ∂ ln f(xi; θ)/∂θ = 0.
Why it matters
Maximum likelihood is the default engine of statistical inference in physics: it turns a probabilistic model plus a finite dataset into a single best-fit parameter, with a principled recipe rather than an ad-hoc curve fit. Least-squares fitting, the sample mean, and the sample variance all fall out of it as special cases.
It also comes with a companion error theory. The curvature of ℓ at its peak — the observed information — gives the estimator's variance, so maximum likelihood delivers not just θ̂ but its uncertainty, and under regularity it attains the smallest variance any unbiased estimator can have (the Cramér–Rao bound).
Assumptions
Derivation
Result
Reading. The maximum-likelihood estimate is the parameter value at which the total score — the summed sensitivity of each data point's log-density to θ — cancels to zero. Each observation "pulls" θ in the direction that would make that observation more probable; the MLE is the balance point where all the pulls sum to nothing. A negative second derivative confirms it is a peak, and its magnitude sets the estimator's precision.
Units check. ln f is dimensionless (or carries only the fixed [1/x] of a density, independent of θ), so ∂ ln f/∂θ has units of [θ]−1. The sum of n such terms still has units [θ]−1, and setting a quantity of units [θ]−1 to zero is dimensionally consistent. The observed information d2ℓ/dθ2 then has units [θ]−2, so its reciprocal correctly has units [θ]2 — a variance.
Limiting cases
- Large n: by the law of large numbers ℓ(θ)/n → E[ln f(X; θ)], whose maximiser is the true θ0 (minimum KL divergence). Hence θ̂ → θ0 (consistency).
- Gaussian model with known variance: the score equation reduces to ∑(xi − μ) = 0, giving μ̂ = x̄, the ordinary sample mean.
- Exponential-family models: the score is linear in the sufficient statistic, so the estimating equation reads "model mean = sample mean" and MLE coincides with the method of moments.
- Flat prior: the Bayesian posterior mode (MAP estimate) equals the MLE, since posterior ∝ likelihood when the prior is constant.
- Independent-Gaussian errors with common variance: maximising ℓ is identical to minimising ∑(xi − model)2 — least squares emerges as a special case.
Breaks when
- The likelihood is unbounded. In a Gaussian mixture, letting one component's variance σ2 → 0 while its mean sits on a data point sends L → ∞. No global maximum exists; the score equation has spurious solutions and naive optimisation diverges.
- The support depends on the parameter. For uniform(0, θ), L(θ) = θ−n for θ ≥ max xi and 0 below it. It is decreasing wherever it is nonzero, so dℓ/dθ = −n/θ is never zero; the MLE is the boundary value θ̂ = max xi, not a stationary point.
- The true parameter is on the boundary. Testing whether a variance component is zero, or a mixing weight is zero, places θ0 on the edge of the allowed set; the derivative need not vanish there and the usual asymptotic distribution of θ̂ is no longer Gaussian.
- The sample is too small. The MLE can be badly biased (e.g. the MLE of Gaussian variance divides by n, not n−1, underestimating σ2) and the curvature-based error bars, which are asymptotic, are unreliable.
Failure modes
- Maximising L directly and underflowing. A product of thousands of small densities rounds to zero in floating point; always work with the log-likelihood sum.
- Skipping the second-order check. Solving dℓ/dθ = 0 and reporting the root without verifying d2ℓ/dθ2 < 0 — the stationary point may be a minimum or a saddle.
- Confusing likelihood with probability. Writing "the probability that θ equals …" — L(θ) is not a density in θ, does not integrate to 1 over θ, and cannot be interpreted as P(θ) without a prior.
- Applying the score equation to a θ-dependent support. Differentiating uniform(0, θ) and setting it to zero, missing that the answer is the boundary max xi.
- Reporting the MLE variance as unbiased. Using σ̂2 = (1/n)∑(xi−x̄)2 where an unbiased estimate needs 1/(n−1).
- Trusting a single local optimum. Multimodal likelihoods (mixtures, latent-variable models) need multiple starting points; a single gradient ascent may land on the wrong peak.
Discussion
The conceptual pivot of the method is the reinterpretation in step 2. The very same expression ∏ f(xi; θ) is a probability density when θ is fixed and x varies (it integrates to 1 over the data space), but a likelihood when x is fixed and θ varies (it need not integrate to anything in particular over θ). Fisher's insight was that this second reading is the natural quantity to optimise: we choose the parameter under which the data we actually observed were most probable.
The score s(X; θ) has a beautiful property. Because ∫f dx = 1 for every θ, differentiating gives ∫∂f/∂θ dx = 0, and rewriting ∂f/∂θ = f ∂ln f/∂θ shows E[s] = 0 at the true θ0. The MLE is thus a sample analogue of this population identity: it sets the observed average score to zero. The variance of the score is the Fisher information I(θ) = E[s2] = −E[∂s/∂θ], and it controls everything downstream.
The asymptotic theory follows from a Taylor expansion of the score about θ0. To leading order θ̂ − θ0 ≈ (1/n ∑ si) / I(θ0), and the numerator is a mean of n zero-mean terms. The central limit theorem then gives √n(θ̂ − θ0) → N(0, I(θ0)−1). Equivalently var(θ̂) ≈ 1/[n I(θ0)], which is precisely the Cramér–Rao lower bound: the MLE is asymptotically efficient, achieving the smallest variance any consistent estimator can. This is why maximum likelihood, not some competitor, is the workhorse of parameter estimation.
Two further virtues matter in practice. First, invariance: if θ̂ maximises the likelihood, then g(θ̂) is the MLE of g(θ) for any function g — one can estimate a rate and read off the mean lifetime as its reciprocal without redoing the fit. Second, maximising the log-likelihood is asymptotically the same as minimising the Kullback–Leibler divergence between the true distribution and the fitted model, so ML is choosing the model closest to reality in an information-theoretic sense.
Common misconceptions. The likelihood is not the probability of the parameter — statements like "θ̂ is 95% likely to be correct" mix up frequentist likelihood with Bayesian posterior probability, which additionally requires a prior. A higher likelihood value does not by itself mean a better model unless the number of parameters is held fixed; comparing models of different dimension requires a penalty (AIC, BIC) or a proper test. And the curvature-based error bars are asymptotic — for small samples or near boundaries they can be wildly optimistic.
Worked examples
Example 1 — Poisson rate from event counts. A detector records the number of decays in five equal one-second windows: 2, 4, 3, 5, 6. Model each count as Poisson(λ) and estimate λ.
Reading. The best-fit Poisson rate is just the average count. The standard error is √(λ̂/n) = √(4/5) ≈ 0.89 s−1, from I(λ) = n/λ.
Example 2 — Gaussian mean and variance from measurements. Four independent length measurements (metres): 1.70, 1.75, 1.80, 1.65. Model as N(μ, σ2) and estimate both parameters.
Reading. The mean estimate is the sample average; the MLE variance divides by n and is biased low — the unbiased value would be 0.0125/3 = 0.00417 m2 (σ = 0.065 m), the familiar n−1 correction.
Problems
- A coin is flipped 10 times, giving 7 heads. Treating each flip as Bernoulli(p), find the MLE of p from the score equation.
Solution
For k successes in n trials, ℓ(p) = k ln p + (n−k) ln(1−p). Then dℓ/dp = k/p − (n−k)/(1−p) = 0. Cross-multiplying: k(1−p) = (n−k)p ⇒ k = np ⇒ p̂ = k/n. With k = 7, n = 10: p̂ = 0.70. Second derivative −k/p2 − (n−k)/(1−p)2 < 0, a maximum. - Waiting times between five events (hours): 2.1, 1.8, 3.2, 2.5, 2.9. Model as exponential with density f(x; λ) = λe−λx. Find the MLE of the rate λ.
Solution
ℓ(λ) = ∑(ln λ − λxi) = n ln λ − λ ∑ xi. Score: dℓ/dλ = n/λ − ∑ xi = 0 ⇒ λ̂ = n/∑ xi = 1/x̄. Sum = 2.1+1.8+3.2+2.5+2.9 = 12.5 h, x̄ = 2.5 h. λ̂ = 5/12.5 = 0.40 per hour (mean waiting time 1/λ̂ = 2.5 h, consistent with invariance). - Prove that the score has zero expectation at the true parameter, E[∂ ln f/∂θ] = 0, stating where regularity is used.
Solution
Normalisation holds for every θ: ∫f(x; θ) dx = 1. Differentiate both sides in θ and interchange ∂/∂θ with the integral (this is the regularity / dominated-convergence step, valid only when the support does not depend on θ): ∫∂f/∂θ dx = 0. Now ∂f/∂θ = f · ∂ ln f/∂θ, so ∫f (∂ ln f/∂θ) dx = E[∂ ln f/∂θ] = 0. This underlies the consistency of the MLE, which matches the sample-average score to this population value. - Three measurements with a known instrument noise σ = 2.0 (units): 5, 7, 9. Assuming N(μ, σ2) with σ fixed, find the MLE of μ and its standard error.
Solution
With σ known, ℓ(μ) = const − ∑(xi−μ)2/(2σ2). Score ∑(xi−μ)/σ2 = 0 ⇒ μ̂ = x̄ = (5+7+9)/3 = 7.0. Fisher information I = n/σ2 = 3/4, so var(μ̂) = σ2/n = 4/3 and the standard error is √(4/3) ≈ 1.15. Result: μ̂ = 7.0 ± 1.2. - (Non-regular.) Data 1.2, 3.7, 4.8, 2.9 are modelled as uniform(0, θ). Show the score equation gives no interior solution and find θ̂ directly; comment on its bias.
Solution
The density is f = 1/θ for 0 ≤ x ≤ θ, else 0. The likelihood is L(θ) = θ−n provided θ ≥ max xi (otherwise some point falls outside the support and L = 0). Where nonzero, dℓ/dθ = −n/θ, which is never zero — the score equation has no solution. Since L decreases in θ, it is maximised at the smallest permitted value: θ̂ = max xi = 4.8. This is the boundary MLE, illustrating the support-dependence failure mode. It is biased downward: E[θ̂] = nθ/(n+1) < θ, so an unbiased version multiplies by (n+1)/n = 5/4, giving 6.0.