Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

7. Estimators and maximum likelihood

School of Engineering, Nazarbayev University

Track: advanced  ·  Prerequisites: Chapters 4 and 5, some calculus

Reading: Taylor, ch. 5.5 and 7 · Bevington & Robinson, ch. 4.1 and 10 · Fornasini, ch. 7.3 · Rouaud, ch. IV · Cowan, Statistical Data Analysis, ch. 5 and 6

Every number extracted from data, a mean, a standard deviation, a slope, is an estimator: a recipe that turns data into a value for an unknown quantity. Different recipes can be applied to the same data and give different answers, so we need criteria for judging them, and a general method for constructing good ones. This chapter provides both.

  1. Bias, variance and mean-square error measure the quality of an estimator; the familiar N−1N-1 is a bias correction, and ss is still biased.

  2. Two estimators of the same quantity can differ enormously in precision.

  3. The method of maximum likelihood constructs estimators systematically. It justifies the mean, the weighted mean and least squares.

  4. The likelihood also supplies the uncertainty: from its curvature, or, better for small samples, from the interval where it falls by a fixed amount.

7.1 Bias, variance and mean-square error

An estimator θ^\hat\theta computed from random data is itself a random variable, with a distribution over imagined repetitions of the experiment. Its quality is described by

  • the bias b=⟨θ^⟩−θb = \langle\hat\theta\rangle - \theta, a systematic error of the method;

  • the variance var⁡(θ^)\operatorname{var}(\hat\theta), its statistical uncertainty;

  • the mean-square error MSE=⟨(θ^−θ)2⟩=var⁡(θ^)+b2\mathrm{MSE} = \langle(\hat\theta - \theta)^2\rangle = \operatorname{var}(\hat\theta) + b^2, which combines the two.

An estimator is consistent if it converges to θ\theta as the amount of data grows; the bias and the variance both vanish.

The variance and the standard deviation. For NN readings with mean μ\mu and variance σ2\sigma^2,

⟨∑i(xi−xˉ)2⟩=(N−1) σ2,\Bigl\langle\sum_i (x_i - \bar x)^2\Bigr\rangle = (N-1)\,\sigma^2 ,

because ∑(xi−xˉ)2=∑(xi−μ)2−N(xˉ−μ)2\sum (x_i - \bar x)^2 = \sum (x_i - \mu)^2 - N(\bar x - \mu)^2 and the last term has expectation N⋅σ2/N=σ2N\cdot\sigma^2/N = \sigma^2. Dividing by N−1N-1 makes s2s^2 an unbiased estimator of σ2\sigma^2. Its square root is not unbiased for σ\sigma, because the square root is concave: for normal data ⟨s⟩=c4(N) σ\langle s\rangle = c_4(N)\,\sigma, with

c4(N)=2N−1  Γ(N/2)Γ((N−1)/2)≈1−14N.c_4(N) = \sqrt{\frac{2}{N-1}}\;\frac{\Gamma(N/2)}{\Gamma\bigl((N-1)/2\bigr)} \approx 1 - \frac{1}{4N} .

One teaching guide suggests dividing by N−1.5N - 1.5 instead of N−1N - 1 for small samples. This approximates the same correction well from about five readings upwards, less well for two or three.

  N    <s>/sigma (simulated)   c4(N)   implied by dividing by N - 1.5
  2          0.7968           0.7979       0.7071
  3          0.8860           0.8862       0.8660
  5          0.9396           0.9400       0.9354
 10          0.9723           0.9727       0.9718
 30          0.9917           0.9914       0.9913

The bias of ss is a few per cent for five readings, much smaller than its statistical uncertainty (≈35 %\approx 35\,\%, Section 4.3); for that reason it is usually ignored. It matters when many small samples are pooled, as in control charts, where sˉ/c4\bar s/c_4 is the standard estimate.

Dividing by NN or by N−1N-1? The estimator with NN is biased low, but it has a smaller variance. For normal data, the mean-square error of σ^2\hat\sigma^2 is actually smallest when one divides by N+1N+1. “Unbiased” is a reasonable default, not a law: what matters in the end is how far the estimate is likely to be from the truth.

divisor   bias of the variance estimate    root-mean-square error
  4             +0.0006                      0.7091
  5             -0.1995                      0.6014
  6             -0.3329                      0.5782

7.2 Not all estimators are equally good

Mean or median? Both estimate the centre of a symmetric distribution. For normal data the median scatters more: its variance is larger by the factor π/2≈1.57\pi/2 \approx 1.57 for large NN, so the median “wastes” a third of the data. For distributions with heavier tails the comparison reverses (Chapter 9).

A striking case: the width of a uniform distribution. Readings are known to be uniformly distributed between 0 and an unknown upper limit aa; examples are the phase of an unsynchronised signal or a position known only to lie on a segment. The method of moments matches the sample mean to the distribution mean a/2a/2, giving a^MM=2xˉ\hat a_\text{MM} = 2\bar x. A second estimator uses the largest reading, corrected for its bias, a^max=N+1Nmax⁡ixi\hat a_\text{max} = \tfrac{N+1}{N}\max_i x_i. Both are unbiased.

  N    std of 2*mean     std of (N+1)/N*max    ratio
   2      0.4079            0.3528            1.2
   5      0.2583            0.1691            1.5
  10      0.1828            0.0910            2.0
  20      0.1291            0.0476            2.7
  50      0.0817            0.0196            4.2
 100      0.0578            0.0099            5.9
 200      0.0409            0.0050            8.2

The uncertainty of 2xˉ2\bar x falls as 1/N1/\sqrt N, that of the corrected maximum as 1/N1/N. With 100 readings the second is six times more precise, equivalent to having 36 times as much data. The reason is that the largest reading carries almost all the information about the upper edge; the mean dilutes it with readings that say nothing about where the edge is. The recipe that seems natural is not always the efficient one, and a systematic method is needed.

7.3 The principle of maximum likelihood

Suppose the readings x1,…,xNx_1, \dots, x_N are independent with a probability density p(x;θ)p(x;\theta) that depends on an unknown parameter θ\theta. The probability (density) of obtaining the observed data, regarded as a function of θ\theta, is the likelihood

L(θ)=∏i=1Np(xi;θ),ln⁡L(θ)=∑i=1Nln⁡p(xi;θ).L(\theta) = \prod_{i=1}^{N} p(x_i;\theta), \qquad \ln L(\theta) = \sum_{i=1}^{N} \ln p(x_i;\theta) .

The maximum-likelihood estimate is the value of θ\theta that makes the observed data most probable. Under broad conditions it is consistent and, for large samples, unbiased, normally distributed, and as precise as any unbiased estimator can be (it attains the Cramér–Rao bound below).

Three familiar results.

Normal readings with a common σ\sigma. ln⁡L=−∑(xi−μ)2/2σ2+const\ln L = -\sum (x_i - \mu)^2/2\sigma^2 + \text{const}. Maximising over μ\mu gives μ^=xˉ\hat\mu = \bar x: the mean is the maximum-likelihood estimate (Taylor, ch. 5.5).

Normal readings with different uncertainties σi\sigma_i. ln⁡L=−∑(xi−μ)2/2σi2+const\ln L = -\sum (x_i - \mu)^2/2\sigma_i^2 + \text{const}, maximised by the weighted mean with weights 1/σi21/\sigma_i^2 (Section 4.6).

Data yiy_i with normal errors around a model f(xi;θ)f(x_i;\boldsymbol\theta). ln⁡L=−12∑(yi−f(xi;θ))2/σi2+const=−12χ2+const\ln L = -\tfrac12\sum (y_i - f(x_i;\boldsymbol\theta))^2/\sigma_i^2 + \text{const} = -\tfrac12\chi^2 + \text{const}. Maximising the likelihood is minimising χ2\chi^2: least squares is maximum likelihood for normally distributed errors. That is its justification, and also its limitation. For errors that are not normal (counts, outliers, skewed noise), least squares is no longer the best method, and the likelihood with the right distribution should be maximised instead (Chapter 15).

For the uniform distribution of Section 7.2, L(a)=a−NL(a) = a^{-N} for a≥max⁡xia \ge \max x_i and zero otherwise, so the likelihood is largest at a^=max⁡xi\hat a = \max x_i: the maximum-likelihood estimate is the efficient one, though biased (by the factor N/(N+1)N/(N+1)) for small samples.

7.4 Uncertainty from the likelihood

Near its maximum, ln⁡L\ln L is approximately a parabola,

ln⁡L(θ)≈ln⁡Lmax−(θ−θ^)22σθ^2,with1σθ^2=−∂2ln⁡L∂θ2∣θ^.\ln L(\theta) \approx \ln L_\text{max} - \frac{(\theta - \hat\theta)^2}{2\sigma_{\hat\theta}^2} , \qquad\text{with}\qquad \frac{1}{\sigma_{\hat\theta}^2} = -\left.\frac{\partial^2\ln L}{\partial\theta^2}\right|_{\hat\theta} .

The sharper the peak, the better determined the parameter. This gives two ways to quote an uncertainty:

  1. from the curvature at the maximum, as above;

  2. from the likelihood interval: the values of θ\theta for which ln⁡L\ln L is within 12\tfrac12 of its maximum (for a 68.3 % interval; 12×1.962=1.92\tfrac12 \times 1.96^2 = 1.92 for 95 %).

For a parabolic ln⁡L\ln L the two agree exactly. When the likelihood is asymmetric, as it is for small samples, the second gives an asymmetric interval with better coverage. The expected curvature also sets a limit for any unbiased estimator: its variance cannot be smaller than 1/⟨−∂2ln⁡L/∂θ2⟩1/\langle -\partial^2 \ln L/\partial\theta^2\rangle, the Cramér–Rao bound.

Example: a lifetime from a few decays. Decay times tit_i of an unstable state follow p(t;τ)=e−t/τ/τp(t;\tau) = e^{-t/\tau}/\tau. Then ln⁡L=−Nln⁡τ−∑ti/τ\ln L = -N\ln\tau - \sum t_i/\tau; setting the derivative to zero gives τ^=tˉ\hat\tau = \bar t, and the curvature gives στ^=τ^/N\sigma_{\hat\tau} = \hat\tau/\sqrt N. With five decays the likelihood is far from parabolic.

decay times: [0.35 0.49 1.09 1.52 2.85]
tau = 1.26;  curvature: +/- 0.56;  likelihood interval: [0.83, 2.04] = -0.43 / +0.78

         tau_hat +/- tau_hat/sqrt(N)          Delta lnL = 1/2 interval
  N    coverage  true above  true below    coverage  true above  true below
   2    0.661     0.330       0.009       0.664     0.228       0.108
   3    0.677     0.295       0.028       0.669     0.212       0.119
   5    0.682     0.265       0.054       0.674     0.198       0.128
  10    0.681     0.239       0.080       0.676     0.192       0.132
  30    0.681     0.203       0.116       0.681     0.174       0.145
 100    0.682     0.182       0.136       0.681     0.167       0.152

The likelihood interval is asymmetric: it extends further above τ^\hat\tau than below, because with few decays a long lifetime is harder to rule out than a short one. Both kinds of interval contain the true value in about 68 % of experiments, but they fail differently. The symmetric interval almost never lies above the true lifetime and lies below it in a quarter to a third of all experiments with few decays: it systematically understates how long the lifetime might be. The likelihood interval errs on both sides, much closer to the ideal 16 % each. For large NN the two agree, as they must.

The likelihood interval has a further advantage: it does not depend on how the parameter is expressed. The interval for the decay rate λ=1/τ\lambda = 1/\tau is simply the reciprocal of the interval for τ\tau, whereas curvature intervals for τ\tau and for λ\lambda are inconsistent with each other.

<Figure size 1012x792 with 4 Axes>

(a) Distribution of the sample standard deviation for N=3N = 3, 5 and 20 normal readings with σ=1\sigma = 1: skewed for small NN, with its mean (dashed) below σ\sigma. (b) Precision of two unbiased estimators of the width of a uniform distribution (dotted lines: 1/3N1/\sqrt{3N} and 1/N1/N). (c) Log-likelihood of the lifetime for 5 and 50 decays; the intersections with the dashed line give the likelihood intervals. (d) How often each kind of 68 % interval misses the true lifetime on either side; ideally 15.9 % each (dotted line).

Summary

  • Judge an estimator by its bias and variance, or by their combination, the mean-square error.

  • s2s^2 is unbiased for σ2\sigma^2; ss is low by the factor c4(N)c_4(N), a few per cent for small NN.

  • Natural-looking estimators can be very inefficient; maximum likelihood constructs efficient ones systematically.

  • The mean, the weighted mean and least squares are all maximum-likelihood estimators for normal errors.

  • Uncertainties follow from the curvature of ln⁡L\ln L or, for small samples and asymmetric cases, from the interval Δln⁡L=12\Delta\ln L = \tfrac12.

References

  • G. Cowan, Statistical Data Analysis (Oxford University Press, 1998).

  • F. James, Statistical Methods in Experimental Physics, 2nd ed. (World Scientific, 2006).

Exercises

  1. Show that for normal data the mean-square error of ∑(xi−xˉ)2/d\sum(x_i - \bar x)^2/d is smallest for d=N+1d = N+1.

  2. Derive the maximum-likelihood estimate of the mean of a Poisson distribution from nn counts, and its uncertainty from the curvature.

  3. For normally distributed readings with unknown μ\mu and σ\sigma, find the maximum-likelihood estimate of σ2\sigma^2. Is it biased?

  4. Readings from a uniform distribution on [θ,θ+1][\theta, \theta + 1] are given. Construct an estimator of θ\theta from the smallest and largest readings and compare its precision with that of xˉ−12\bar x - \tfrac12.

  5. Find the likelihood interval for the decay rate λ=1/τ\lambda = 1/\tau from the five decays of Section 7.4 and verify that it is the reciprocal of the interval for τ\tau. Is the same true of the curvature intervals?