Mathematical Methods Handbook

Statistical inference

Estimation, fitting and testing.

In this chapter 8

Tick a unit to add it to your PDF basket.

  1. Estimation and testing

Estimation and testing

8

Definition

Sampling distributions

Adapted

Defines a statistic and its sampling distribution, fixes the two rival conventions for the sample variance, and proves that for a normal sample the sample mean and the sample variance are independent with laws N(μ,σ2/n)N(\mu,\sigma^2/n) and σ2χ2(n−1)/(n−1)\sigma^2\chi^2(n-1)/(n-1), from which the Student tt and Fisher FF densities follow; worked on an eight-point sample giving t=1.063t=1.063 and χ2=5.731\chi^2=5.731.

Prerequisites: The multivariate normal distribution, Expectation, variance and covariance, Joint distributions and transformations, The central limit theorem, Unitary and orthogonal matrices, Multiple integrals and change of variables, The Gamma function, The Beta function

Note(What this unit is for)Original

Every number computed from data - a mean, a variance, a fitted slope - is a function of random variables and is therefore itself random. It has a distribution, and that distribution, not the number, is what licences any statement about the quantity being measured. The distribution of a statistic is called its sampling distribution, and the whole of estimation, interval construction and testing is bookkeeping on sampling distributions.

For one parent population - the normal - the sampling distributions of the two statistics a physicist computes first, the sample mean and the sample variance, are known exactly, for every sample size, in closed form. That is the content of this unit. Three named distributions appear: chi-squared for the sample variance, Student's tt for the mean divided by its own estimated error, and Fisher's FF for the ratio of two sample variances. Their appearance is not a coincidence of calculus; it comes from one geometric fact, that the standard normal law on Rn\mathbb{R}^n is invariant under rotations.

Definition(Sample, statistic, sampling distribution)AdaptedAdapted from Riley, Hobson & Bence (2006), §31.3, the set-up on pp. 1229-1230; Grimmett & Stirzaker (2020), §4.10, the opening paragraph, p. 135

A random sample of size nn from a distribution FF is a list X1,…,XnX_1, \dots, X_n of independent random variables each with distribution FF. Riley, Hobson and Bence call FF the population and write it P(x∣a)P(x\mid a) when it is known up to a list a=(a1,…,am)a = (a_1,\dots,a_m) of unknown parameters; independence then makes the joint density of the sample

P(x∣a)  =  ∏i=1nP(xi∣a),x=(x1,…,xn)∈Rn.P(x \mid a) \;=\; \prod_{i=1}^{n} P(x_i \mid a) , \qquad x = (x_1,\dots,x_n) \in \mathbb{R}^{n} .

A statistic is any function T(X1,…,Xn)T(X_1,\dots,X_n) of the sample alone - it may not involve the unknown aa, because it has to be computable from the data. Being a function of random variables, TT is a random variable, and its distribution is the sampling distribution of TT. Riley, Hobson and Bence specify it by the transformation rule P(a^∣a) da^=P(x∣a) dnxP(\hat a \mid a)\,d\hat a = P(x\mid a)\,d^{n}x, where dnxd^{n}x is the volume between the surfaces T(x)=a^T(x) = \hat a and T(x)=a^+da^T(x) = \hat a + d\hat a; this is the change-of-variables formula of Multiple integrals and change of variables written for one coordinate of the image. The sampling distribution depends on the parent FF, on the function TT and on nn, and in general on the true values aa as well - which is exactly why a statistic can carry information about aa.

Definition(Sample mean and sample variance, and the two conventions)AdaptedAdapted from Grimmett & Stirzaker (2020), §4.10, the definitions of $\overline X$ and $S^2$ with the footnote, p. 135; Riley, Hobson & Bence (2006), §31.2.2, eqs. (31.6)-(31.8), pp. 1224-1225; Arfken, Weber & Harris (2013), §23.7, eqs. (23.94)-(23.95), p. 1168

For a sample X1,…,XnX_1,\dots,X_n the sample mean is

X‾  =  1n∑i=1nXi,\overline X \;=\; \frac1n \sum_{i=1}^{n} X_i ,

on which all our sources agree. For the spread there are two conventions in the library, and they differ by a factor n/(n−1)n/(n-1):

S2  =  1n−1∑i=1n(Xi−X‾)2(Grimmett and Stirzaker),S^{2} \;=\; \frac{1}{n-1}\sum_{i=1}^{n}\bigl(X_i - \overline X\bigr)^{2} \qquad\text{(Grimmett and Stirzaker)} ,s2  =  1n∑i=1n(Xi−X‾)2(Riley, Hobson and Bence).s^{2} \;=\; \frac{1}{n}\sum_{i=1}^{n}\bigl(X_i - \overline X\bigr)^{2} \qquad\text{(Riley, Hobson and Bence)} .

This unit uses S2S^{2}, with the divisor n−1n-1. Grimmett and Stirzaker leave the reasons for this choice to statistics texts, note that with it E(S2)=σ2\mathbb{E}(S^{2}) = \sigma^{2} exactly, and record the rival convention in a footnote. Arfken, Weber and Harris reach the same divisor by a first-order argument: estimating the variance of xˉ\bar x by S2/nS^{2}/n, the deviations ej=xj−xˉe_j = x_j - \bar x satisfy e2‾=S2(1−1/n)\overline{e^{2}} = S^{2}(1 - 1/n) (their sample standard deviation ss is our SS). The n−1n-1 that results, they say, allows for the probable error in xˉ\bar x, and they call it Bessel's correction. In the language of the proof below, one degree of freedom has been spent on estimating the mean. Note that S2S^{2} is undefined at n=1n = 1, as it should be: one reading says nothing about spread. Both multiply out to the same sum of squared deviations, so the conversion between them is

(n−1) S2  =  n s2  =  ∑i=1n(Xi−X‾)2,(n-1)\,S^{2} \;=\; n\,s^{2} \;=\; \sum_{i=1}^{n}\bigl(X_i-\overline X\bigr)^{2} ,

and every formula below can be rewritten in the other convention by that identity. Riley, Hobson and Bence also give the computing form s2=x2‾−xˉ2s^{2} = \overline{x^{2}} - \bar x^{2}, which needs one pass through the data instead of two.

Two facts hold for any parent population with finite mean μ\mu and variance σ2\sigma^{2}, normal or not, and are proved in Expectation, variance and covariance from linearity and the additivity of variances over independent summands:

E(X‾)=μ,var⁡(X‾)=σ2n.\mathbb{E}\bigl(\overline X\bigr) = \mu , \qquad \operatorname{var}\bigl(\overline X\bigr) = \frac{\sigma^{2}}{n} .

Everything else below needs normality.

Definition(The chi-squared, tt and FF distributions)AdaptedAdapted from Grimmett & Stirzaker (2020), §4.4, Examples (4.4.6) and (4.4.8), p. 108, §4.7, Example (4.7.1), p. 122, and §4.10, the definitions of $t(r)$ and $F(r,s)$ with their densities, pp. 136-137; Riley, Hobson & Bence (2006), §30.9.4, eqs. (30.122)-(30.123) and the moments, p. 1193

Let d,r,sd, r, s be positive integers.

Chi-squared. XX has the chi-squared distribution with dd degrees of freedom, written χ2(d)\chi^{2}(d), if it is a gamma variate with parameters λ=12\lambda = \tfrac12 and t=12dt = \tfrac12 d, that is if it has density

f(x)  =  12d/2 Γ(d/2) xd/2−1e−x/2,x>0,f(x) \;=\; \frac{1}{2^{d/2}\,\Gamma(d/2)}\, x^{d/2 - 1} e^{-x/2} , \qquad x > 0 ,

with Γ\Gamma the gamma function of The Gamma function. Its mean is dd and its variance 2d2d. Equivalently, and this is the form used throughout statistics, χ2(d)\chi^{2}(d) is the law of Z12+⋯+Zd2Z_1^{2} + \cdots + Z_d^{2} for independent standard normal ZiZ_i: the gamma moment generating function is multiplicative in the shape parameter, so a sum of independent χ2(d1)\chi^{2}(d_1) and χ2(d2)\chi^{2}(d_2) variates is χ2(d1+d2)\chi^{2}(d_1+d_2), and one standard normal square is χ2(1)\chi^{2}(1): for y>0y > 0, Pr⁡(Z2≤y)=Pr⁡(−y≤Z≤y)\Pr(Z^{2} \le y) = \Pr(-\sqrt y \le Z \le \sqrt y), whose derivative is (2πy)−1/2e−y/2(2\pi y)^{-1/2}e^{-y/2}, the density above with d=1d = 1 (Grimmett and Stirzaker, Example (4.7.1), p. 122). Riley, Hobson and Bence write the same object as χn2=∑i(Xi−μi)2/σi2\chi_n^{2} = \sum_i (X_i - \mu_i)^{2}/\sigma_i^{2} for independent Xi∼N(μi,σi2)X_i \sim N(\mu_i, \sigma_i^{2}), and state that if the XiX_i are subject to mm independent linear constraints then the order drops to n−mn - m. The theorem below is the leading instance of that rule.

Student's tt. If V∼N(0,1)V \sim N(0,1) and U∼χ2(r)U \sim \chi^{2}(r) are independent, then

T  =  VU/rT \;=\; \frac{V}{\sqrt{U/r}}

has the tt distribution with rr degrees of freedom, written t(r)t(r), with density

fT(t)  =  Γ(12(r+1))πr  Γ(12r)(1+t2r)−12(r+1),−∞<t<∞.f_T(t) \;=\; \frac{\Gamma\bigl(\tfrac12(r+1)\bigr)}{\sqrt{\pi r}\;\Gamma\bigl(\tfrac12 r\bigr)} \left(1 + \frac{t^{2}}{r}\right)^{-\frac12 (r+1)} , \qquad -\infty < t < \infty .

It is symmetric about 00; t(1)t(1) is the Cauchy distribution, which has no mean, and for r≥2r \ge 2 the mean is 00. As r→∞r \to \infty the density tends to (2π)−1/2e−t2/2(2\pi)^{-1/2}e^{-t^{2}/2}, since (1+t2/r)−r/2→e−t2/2(1+t^{2}/r)^{-r/2} \to e^{-t^{2}/2}.

Fisher's FF. If U∼χ2(r)U \sim \chi^{2}(r) and V∼χ2(s)V \sim \chi^{2}(s) are independent, then

F  =  U/rV/sF \;=\; \frac{U/r}{V/s}

has the FF distribution with rr and ss degrees of freedom, written F(r,s)F(r,s), with density

fF(x)  =  r Γ(12(r+s))s Γ(12r)Γ(12s)⋅(rx/s)12r−1[1+(rx/s)]12(r+s),x>0.f_F(x) \;=\; \frac{r\,\Gamma\bigl(\tfrac12(r+s)\bigr)}{s\,\Gamma\bigl(\tfrac12 r\bigr)\Gamma\bigl(\tfrac12 s\bigr)} \cdot \frac{(rx/s)^{\frac12 r - 1}}{\bigl[1 + (rx/s)\bigr]^{\frac12 (r+s)}} , \qquad x > 0 .

Grimmett and Stirzaker note two consequences that are immediate from the definition: F−1∼F(s,r)F^{-1} \sim F(s,r), by exchanging the roles of UU and VV; and T2∼F(1,r)T^{2} \sim F(1,r) when T∼t(r)T \sim t(r), because V2∼χ2(1)V^{2} \sim \chi^{2}(1). The mean of F(r,s)F(r,s) is s/(s−2)s/(s-2) when s>2s > 2. Riley, Hobson and Bence write the normalising factor through the beta function B(12r,12s)=Γ(12r)Γ(12s)/Γ(12(r+s))B\bigl(\tfrac12 r, \tfrac12 s\bigr) = \Gamma(\tfrac12 r)\Gamma(\tfrac12 s)/\Gamma(\tfrac12(r+s)) of The Beta function; the two forms are the same.

Definition(The sampling distributions of a normal sample)AdaptedAdapted from Grimmett & Stirzaker (2020), §4.10, Theorem (4.10.1) and the discussion of $U$, $V$, $T$ and $F$ that follows it, pp. 135-137

Let X1,…,XnX_1, \dots, X_n be independent, each with the N(μ,σ2)N(\mu, \sigma^{2}) distribution, n≥2n \ge 2, and let X‾\overline X and S2S^{2} be the sample mean and the sample variance with divisor n−1n-1. Then:

  1. X‾\overline X and S2S^{2} are independent random variables;
  2. X‾∼N(μ, σ2/n)\overline X \sim N\bigl(\mu,\ \sigma^{2}/n\bigr);
  3. (n−1)S2/σ2∼χ2(n−1)(n-1)S^{2}/\sigma^{2} \sim \chi^{2}(n-1).

Consequently, writing

U=(n−1)S2σ2∼χ2(n−1),V=n (X‾−μ)σ∼N(0,1),U = \frac{(n-1)S^{2}}{\sigma^{2}} \sim \chi^{2}(n-1) , \qquad V = \frac{\sqrt n\,(\overline X - \mu)}{\sigma} \sim N(0,1) ,

neither of which depends on σ\sigma once it is formed, the ratio

T  =  VU/(n−1)  =  X‾−μS/nT \;=\; \frac{V}{\sqrt{U/(n-1)}} \;=\; \frac{\overline X - \mu}{S/\sqrt n}

has the t(n−1)t(n-1) distribution. The unknown σ\sigma has cancelled: TT is computable from the data and μ\mu alone, and its distribution involves no unknown parameter.

If, further, Y1,…,YmY_1,\dots,Y_m is a second sample, independent of the first, drawn from N(ν,σ2)N(\nu, \sigma^{2}) with the same variance, and SY2S_Y^{2} is its sample variance, then (m−1)SY2/σ2∼χ2(m−1)(m-1)S_Y^{2}/\sigma^{2} \sim \chi^{2}(m-1) independently of (n−1)S2/σ2(n-1)S^{2}/\sigma^{2}, so the variance ratio

SY2S2  =  [(m−1)SY2/σ2]/(m−1)[(n−1)S2/σ2]/(n−1) ∼ F(m−1, n−1),\frac{S_Y^{2}}{S^{2}} \;=\; \frac{\bigl[(m-1)S_Y^{2}/\sigma^{2}\bigr]/(m-1)}{\bigl[(n-1)S^{2}/\sigma^{2}\bigr]/(n-1)} \ \sim\ F(m-1,\, n-1) ,

again free of σ\sigma.

Idea of the proofOriginal

Only one idea is needed, and it is geometric. Write Yi=(Xi−μ)/σY_i = (X_i-\mu)/\sigma; then the vector Y=(Y1,…,Yn)Y = (Y_1,\dots,Y_n) has density proportional to exp⁡(−12∥y∥2)\exp\bigl(-\tfrac12 \lVert y\rVert^{2}\bigr), which depends on yy only through its length. So the law of YY is unchanged by any rotation of Rn\mathbb{R}^{n}, and the coordinates of YY in any orthonormal frame are again independent standard normals.

Now choose the frame to suit the question. Let the first axis be the diagonal direction n−1/2(1,1,…,1)n^{-1/2}(1,1,\dots,1). The first coordinate in that frame is Z1=n Y‾Z_1 = \sqrt n\,\overline Y, which carries the sample mean; the remaining n−1n-1 coordinates are orthogonal to the diagonal, and because the length is preserved, the sum of their squares is ∥Y∥2−Z12=∑i(Yi−Y‾)2\lVert Y\rVert^{2} - Z_1^{2} = \sum_i (Y_i - \overline Y)^{2}, which is the sample variance up to a factor. So the mean lives on one axis and the variance on the orthogonal complement of that axis: independence of X‾\overline X and S2S^{2} is the independence of coordinates in a rotated frame, and the n−1n-1 degrees of freedom are literally the dimension of the complement.

The tt and FF laws then cost nothing beyond a change of variables: tt is the law of a normal divided by the root of an independent chi-squared, FF the law of a ratio of two independent chi-squareds, and both densities come out of the standard two-variable transformation formula followed by one gamma integral.

Proof(Independence, and the three laws)AdaptedAdapted from Grimmett & Stirzaker (2020), §4.10, proof of Theorem (4.10.1), eqs. (2)-(4), p. 136, and the two density calculations, pp. 136-137

Step 1: standardise. Put Yi=(Xi−μ)/σY_i = (X_i - \mu)/\sigma. Each YiY_i is N(0,1)N(0,1) and they are independent, so the joint density of Y=(Y1,…,Yn)Y = (Y_1,\dots,Y_n) is

f(y)  =  (2π)−n/2exp⁡(−12∑i=1nyi2)  =  (2π)−n/2e−∥y∥2/2.f(y) \;=\; (2\pi)^{-n/2}\exp\Bigl(-\tfrac12 \textstyle\sum_{i=1}^{n} y_i^{2}\Bigr) \;=\; (2\pi)^{-n/2} e^{-\lVert y\rVert^{2}/2} .

Also Y‾=(X‾−μ)/σ\overline Y = (\overline X - \mu)/\sigma and

∑i=1n(Yi−Y‾)2  =  1σ2∑i=1n(Xi−X‾)2  =  (n−1)S2σ2,\sum_{i=1}^{n}\bigl(Y_i - \overline Y\bigr)^{2} \;=\; \frac{1}{\sigma^{2}}\sum_{i=1}^{n}\bigl(X_i-\overline X\bigr)^{2} \;=\; \frac{(n-1)S^{2}}{\sigma^{2}} ,

because the shift by μ\mu cancels inside the bracket and the factor σ\sigma comes out squared. So the theorem is a statement about a standard normal vector.

Step 2: rotate. Let AA be any real orthogonal n×nn\times n matrix and let ZZ be the coordinates of YY in the rotated frame, so that Yi=∑jZjajiY_i = \sum_{j} Z_j a_{ji} and, because AA preserves lengths (Unitary and orthogonal matrices), ∑iYi2=∑iZi2\sum_i Y_i^{2} = \sum_i Z_i^{2}. The Jacobian of an orthogonal map has modulus 11, so by the change-of-variables formula the density of ZZ is (2π)−n/2e−∥z∥2/2(2\pi)^{-n/2}e^{-\lVert z\rVert^{2}/2}: the same function. It factorises into nn standard normal densities, hence Z1,…,ZnZ_1,\dots,Z_n are independent N(0,1)N(0,1) variables. This is the only place normality is used, and it is used essentially: no other law on Rn\mathbb{R}^{n} with independent identically distributed coordinates has a rotation-invariant density.

Step 3: choose the rotation. Take the first row of AA to be n−1/2(1,1,…,1)n^{-1/2}(1,1,\dots,1), a unit vector, and complete it to an orthonormal basis of Rn\mathbb{R}^{n} (possible by Gram-Schmidt; the rows 2,…,n2,\dots,n are then any orthonormal basis of the hyperplane ∑iyi=0\sum_i y_i = 0). With this choice

Z1  =  1n∑i=1nYi  =  n Y‾,Z_1 \;=\; \frac{1}{\sqrt n}\sum_{i=1}^{n} Y_i \;=\; \sqrt n\, \overline Y ,

and Z1∼N(0,1)Z_1 \sim N(0,1) by Step 2 - which says exactly that Y‾∼N(0,1/n)\overline Y \sim N(0,1/n), that is X‾∼N(μ,σ2/n)\overline X \sim N(\mu, \sigma^{2}/n). That is conclusion 2.

Step 4: identify the rest of the length. Subtracting the first square from the total,

∑j=2nZj2  =  ∑i=1nYi2−Z12  =  ∑i=1nYi2−n Y‾2  =  ∑i=1n(Yi−Y‾)2  =  (n−1)S2σ2,\sum_{j=2}^{n} Z_j^{2} \;=\; \sum_{i=1}^{n} Y_i^{2} - Z_1^{2} \;=\; \sum_{i=1}^{n} Y_i^{2} - n\,\overline Y^{2} \;=\; \sum_{i=1}^{n}\bigl(Y_i - \overline Y\bigr)^{2} \;=\; \frac{(n-1)S^{2}}{\sigma^{2}} ,

the third equality being the identity ∑i(Yi−Y‾)2=∑iYi2−nY‾2\sum_i (Y_i-\overline Y)^{2} = \sum_i Y_i^{2} - n\overline Y^{2}, got by expanding the square and using ∑i(Yi−Y‾)=0\sum_i (Y_i - \overline Y) = 0.

Step 5: read off independence and the chi-squared law. By Step 2 the variable Z1Z_1 is independent of the block (Z2,…,Zn)(Z_2,\dots,Z_n). By Step 3, X‾\overline X is a function of Z1Z_1 alone; by Step 4, S2S^{2} is a function of Z2,…,ZnZ_2,\dots,Z_n alone. Functions of independent variables are independent, so X‾\overline X and S2S^{2} are independent: conclusion 1. And by Step 4, (n−1)S2/σ2(n-1)S^{2}/\sigma^{2} is a sum of the squares of n−1n-1 independent standard normal variables, hence χ2(n−1)\chi^{2}(n-1) by the additivity of chi-squared recorded in the definition: conclusion 3. The order is n−1n-1, not nn, because one linear constraint has been imposed - the residuals Yi−Y‾Y_i - \overline Y sum to zero and so lie in a hyperplane.

Step 6: the tt density. With UU and VV as in the statement and r=n−1r = n-1, UU and VV are independent by conclusion 1, so their joint density is the product

f(u,v)  =  (12)r/2Γ(12r) u12r−1e−u/2⋅12π e−v2/2,u>0.f(u,v) \;=\; \frac{(\tfrac12)^{r/2}}{\Gamma(\tfrac12 r)}\,u^{\frac12 r - 1}e^{-u/2} \cdot \frac{1}{\sqrt{2\pi}}\, e^{-v^{2}/2} , \qquad u > 0 .

Change variables to (w,t)(w,t) with w=uw = u and t=vr/ut = v\sqrt{r/u}, so v=tw/rv = t\sqrt{w/r} and, at fixed ww, dv=w/r dtdv = \sqrt{w/r}\,dt. The Jacobian is therefore w/r\sqrt{w/r} and

fU,T(w,t)  =  w/r  f(w, tw/r)  =  (12)r/2Γ(12r)2πr  w12(r−1)exp⁡[−w2(1+t2r)].f_{U,T}(w,t) \;=\; \sqrt{w/r}\; f\bigl(w,\, t\sqrt{w/r}\bigr) \;=\; \frac{(\tfrac12)^{r/2}}{\Gamma(\tfrac12 r)\sqrt{2\pi r}}\; w^{\frac12(r-1)}\exp\Bigl[-\frac{w}{2}\Bigl(1+\frac{t^{2}}{r}\Bigr)\Bigr] .

Integrate out ww over (0,∞)(0,\infty). Substituting ξ=w2(1+t2/r)\xi = \tfrac{w}{2}(1+t^{2}/r) turns the integral into Γ(12(r+1))\Gamma\bigl(\tfrac12(r+1)\bigr) times [12(1+t2/r)]−12(r+1)\bigl[\tfrac12(1+t^{2}/r)\bigr]^{-\frac12(r+1)}, by the definition of the gamma function. The powers of 12\tfrac12 do not quite cancel: (12)r/2 (12)−12(r+1)=2(\tfrac12)^{r/2}\,(\tfrac12)^{-\frac12(r+1)} = \sqrt2, and this factor turns 2πr\sqrt{2\pi r} into πr\sqrt{\pi r}, leaving

fT(t)  =  Γ(12(r+1))πr Γ(12r)(1+t2r)−12(r+1),f_T(t) \;=\; \frac{\Gamma\bigl(\tfrac12(r+1)\bigr)}{\sqrt{\pi r}\,\Gamma\bigl(\tfrac12 r\bigr)}\Bigl(1+\frac{t^{2}}{r}\Bigr)^{-\frac12(r+1)} ,

the t(r)t(r) density. Finally T=V/U/(n−1)T = V/\sqrt{U/(n-1)} equals n(X‾−μ)/σ\sqrt n(\overline X-\mu)/\sigma divided by S/σS/\sigma, and the σ\sigma's cancel, giving T=(X‾−μ)/(S/n)T = (\overline X - \mu)/(S/\sqrt n) as claimed.

Step 7: the FF density. Let U∼χ2(r)U\sim\chi^{2}(r) and V∼χ2(s)V\sim\chi^{2}(s) be independent and set x=(U/r)/(V/s)x = (U/r)/(V/s). The same two-variable device works: keep w=Vw = V as the second coordinate, so U=(r/s) x wU = (r/s)\,x\,w with Jacobian ∂U/∂x=(r/s)w\partial U/\partial x = (r/s)w, multiply the two gamma densities, and integrate ww out over (0,∞)(0,\infty). The ww-integral is again a gamma integral, of total order 12(r+s)\tfrac12(r+s), and after collecting constants one obtains

fF(x)  =  r Γ(12(r+s))s Γ(12r)Γ(12s)⋅(rx/s)12r−1[1+(rx/s)]12(r+s),x>0.f_F(x) \;=\; \frac{r\,\Gamma\bigl(\tfrac12(r+s)\bigr)}{s\,\Gamma\bigl(\tfrac12 r\bigr)\Gamma\bigl(\tfrac12 s\bigr)} \cdot\frac{(rx/s)^{\frac12 r-1}}{\bigl[1+(rx/s)\bigr]^{\frac12(r+s)}} , \qquad x>0 .

Applying this with U=(m−1)SY2/σ2U = (m-1)S_Y^{2}/\sigma^{2} and V=(n−1)S2/σ2V = (n-1)S^{2}/\sigma^{2}, which are independent because the two samples are, gives the last claim of the statement. □\square

Remark(Where the hypotheses are used)Original

Normality. Used once, in Step 2, and it is what the whole theorem rests on. Rotation invariance alone does not give independent coordinates (the uniform law on a disc is rotation-invariant, yet its two coordinates are dependent); the fact Step 2 rests on is narrower. A vector of independent standard normals has a rotation-invariant density, and among laws on Rn\mathbb{R}^{n} with independent, identically distributed coordinates and a density, only a centred normal has one. For any other parent law, X‾\overline X and S2S^{2} are in general dependent. A two-point example makes this concrete: let n=2n=2 and let each XiX_i be ±1\pm 1 with probability 12\tfrac12. Then X‾∈{−1,0,1}\overline X \in \{-1,0,1\} and S2=(X1−X2)2/2∈{0,2}S^{2} = (X_1-X_2)^{2}/2 \in \{0,2\}, and S2=0S^{2} = 0 holds exactly when X‾=±1\overline X = \pm 1. Knowing one determines the other, so they are as far from independent as possible, although E(S2)=σ2=1\mathbb{E}(S^{2}) = \sigma^{2} = 1 still holds.

Independence of the XiX_i. Used in Step 1 to write the joint density as a product. Without it there is no rotation-invariant density to exploit. Correlated normal data can be brought back into the scheme by whitening - multiply by Σ−1/2\Sigma^{-1/2}, with Σ\Sigma the covariance matrix, as in The multivariate normal distribution - but then the statistic being computed is not the ordinary S2S^{2}.

Common variance σ2\sigma^{2} for both samples, in the FF statement. If the two populations had variances σ12≠σ22\sigma_1^{2} \ne \sigma_2^{2}, the ratio SY2/S2S_Y^{2}/S^{2} would be (σ22/σ12)(\sigma_2^{2}/\sigma_1^{2}) times an F(m−1,n−1)F(m-1,n-1) variable, so its distribution would involve the unknown ratio and could not be used without further assumption. This is precisely why the ratio is informative about that ratio.

n≥2n \ge 2. For n=1n = 1 there is no S2S^{2}, and the complement of the diagonal axis in R1\mathbb{R}^{1} is {0}\{0\}; the theorem degenerates correctly rather than failing.

What survives without normality. Only E(X‾)=μ\mathbb{E}(\overline X) = \mu and var⁡(X‾)=σ2/n\operatorname{var}(\overline X) = \sigma^{2}/n, and - as a limit, not an identity - the approximate normality of X‾\overline X for large nn given by the central limit theorem. The exact tt and FF laws are properties of the normal family alone, though they are mildly robust in practice.

A convention to watch. Riley, Hobson and Bence define the sample variance with divisor NN and accordingly write Student's statistic as t=(xˉ−μ0)/(s/N−1)t = (\bar x - \mu_0)/\bigl(s/\sqrt{N-1}\bigr), with N−1N-1 under the root. Since (N−1)S2=Ns2(N-1)S^{2} = Ns^{2}, one has s/N−1=S/Ns/\sqrt{N-1} = S/\sqrt N, so their tt and ours are the same number computed from the same data; the degrees of freedom are N−1N-1 in both. Only the intermediate symbol ss differs. The same substitution turns their u=Ns2/σ02∼χN−12u = Ns^{2}/\sigma_0^{2} \sim \chi^{2}_{N-1} into our conclusion 3.

Method(Using the three distributions)Original

Given a sample x1,…,xnx_1,\dots,x_n believed to come from a normal population:

  1. Compute xˉ=n−1∑ixi\bar x = n^{-1}\sum_i x_i and the sum of squared deviations Q=∑i(xi−xˉ)2Q = \sum_i (x_i - \bar x)^{2}; then S2=Q/(n−1)S^{2} = Q/(n-1) and S=S2S = \sqrt{S^{2}}.
  2. If σ\sigma is known, use n (xˉ−μ)/σ∼N(0,1)\sqrt n\,(\bar x - \mu)/\sigma \sim N(0,1).
  3. If σ\sigma is unknown, use t=(xˉ−μ)/(S/n)∼t(n−1)t = (\bar x - \mu)/(S/\sqrt n) \sim t(n-1). This is the only change: the standard normal is replaced by tt with n−1n-1 degrees of freedom, whose tails are heavier, the price of not knowing σ\sigma.
  4. For a statement about σ2\sigma^{2} itself, use U=(n−1)S2/σ2∼χ2(n−1)U = (n-1)S^{2}/\sigma^{2} \sim \chi^{2}(n-1).
  5. To compare the spreads of two independent normal samples, of sizes n1n_1 and n2n_2, use F=S22/S12∼F(n2−1, n1−1)F = S_2^{2}/S_1^{2} \sim F(n_2-1,\,n_1-1) under the hypothesis of equal variances. Since F−1∼F(n1−1, n2−1)F^{-1} \sim F(n_1-1,\,n_2-1), the ratio may be taken either way up, but the orientation must be fixed before the data are seen. For a one-sided question ("is sample 2 the noisier?") read the single tail on that side. For a two-sided question ("do the spreads differ?") the tail probability is twice the smaller of Pr⁡(F>f)\Pr(F > f) and Pr⁡(F<f)\Pr(F < f) at the observed value ff. Putting whichever sample variance happens to be larger on top and then reading one upper tail undoubled roughly halves this figure, because the orientation has been chosen from the data.
  6. Convert the resulting tail probability into an interval or a test with Confidence intervals or Hypothesis testing; this unit supplies the distributions, not the decisions.
Example(A calibration run: mean, variance and a variance ratio)Original

A platinum resistance thermometer is held in a stirred water reference bath and read eight times. The readings, in degrees Celsius, are

20.12,19.87,20.31,20.05,19.76,20.44,19.95,20.18.20.12,\quad 19.87,\quad 20.31,\quad 20.05,\quad 19.76,\quad 20.44,\quad 19.95,\quad 20.18 .

Treat them as a random sample from N(μ,σ2)N(\mu,\sigma^{2}).

Sample mean. The readings sum to 160.68160.68, so with n=8n=8

xˉ=160.688=20.085 ∘C.\bar x = \frac{160.68}{8} = 20.085\ ^{\circ}\mathrm{C}.

Sample variance. The deviations from 20.08520.085 are 0.035, −0.215, 0.225, −0.035, −0.325, 0.355, −0.135, 0.0950.035,\,-0.215,\,0.225,\,-0.035,\,-0.325,\,0.355,\,-0.135,\,0.095, and they sum to zero, as they must. Their squares sum to

Q=∑i=18(xi−xˉ)2=0.3582,Q = \sum_{i=1}^{8}(x_i-\bar x)^{2} = 0.3582 ,

so

S2=Qn−1=0.35827=0.05117 (∘C)2,S=0.22621 ∘C.S^{2} = \frac{Q}{n-1} = \frac{0.3582}{7} = 0.05117\ (^{\circ}\mathrm{C})^{2} , \qquad S = 0.22621\ ^{\circ}\mathrm{C} .

For comparison, the Riley-Hobson-Bence convention would give s2=Q/8=0.044775s^{2} = Q/8 = 0.044775 and s=0.21160s = 0.21160, smaller by the factor 7/8\sqrt{7/8}.

Distance of the mean from a reference value. The bath is believed to sit at μ0=20.000 ∘C\mu_0 = 20.000\,^{\circ}\mathrm{C}. Since σ\sigma is unknown we use the tt statistic of step 3:

t=xˉ−μ0S/n=20.085−20.0000.22621/8=0.0850.079977=1.0628,t = \frac{\bar x - \mu_0}{S/\sqrt n} = \frac{20.085 - 20.000}{0.22621/\sqrt 8} = \frac{0.085}{0.079977} = 1.0628 ,

to be read against t(7)t(7). The two-sided tail probability is Pr⁡(∣T∣>1.0628)=0.3232\Pr\bigl(\lvert T\rvert > 1.0628\bigr) = 0.3232 for T∼t(7)T \sim t(7), so a departure at least this large happens in about a third of samples of this size even when the bath is exactly at 20 ∘C20\,^{\circ}\mathrm{C}. Had σ\sigma been treated as known and equal to SS, the same ratio would have been read against N(0,1)N(0,1), giving the smaller tail 0.28790.2879; the difference is the penalty for estimating σ\sigma from seven degrees of freedom.

A statement about the spread. The manufacturer quotes a repeatability of σ0=0.25 ∘C\sigma_0 = 0.25\,^{\circ}\mathrm{C}. Under that value, step 4 gives

U=(n−1)S2σ02=0.35820.0625=5.7312,U = \frac{(n-1)S^{2}}{\sigma_0^{2}} = \frac{0.3582}{0.0625} = 5.7312 ,

a draw from χ2(7)\chi^{2}(7), whose mean is 77 and standard deviation 14=3.742\sqrt{14} = 3.742. The upper tail is Pr⁡(χ2(7)>5.7312)=0.5715\Pr\bigl(\chi^{2}(7) > 5.7312\bigr) = 0.5715: the observed scatter is entirely ordinary for the quoted repeatability.

A second sample and the variance ratio. The bath is re-read six times the next day, after the probe has been re-seated:

20.31,19.62,20.55,19.88,20.44,19.70,20.31,\quad 19.62,\quad 20.55,\quad 19.88,\quad 20.44,\quad 19.70 ,

with yˉ=120.50/6=20.0833\bar y = 120.50/6 = 20.0833 and ∑j(yj−yˉ)2=0.79933\sum_j (y_j-\bar y)^{2} = 0.79933, hence SY2=0.79933/5=0.159867S_Y^{2} = 0.79933/5 = 0.159867. The question is two-sided - did the spread change between the days? - and we fix the orientation as day 2 over day 1:

F=SY2S2=0.1598670.051171=3.1241,F = \frac{S_Y^{2}}{S^{2}} = \frac{0.159867}{0.051171} = 3.1241 ,

a draw from F(5,7)F(5,7) if the two days share one σ\sigma. The upper tail is Pr⁡(F(5,7)>3.1241)=0.0848\Pr\bigl(F(5,7) > 3.1241\bigr) = 0.0848 and the lower tail is 0.91520.9152, so by step 5 the two-sided tail probability is 2×0.0848=0.16962 \times 0.0848 = 0.1696; for a two-sided test at the 5%5\% level the ratio would have to exceed the 97.5%97.5\% point of F(5,7)F(5,7), which is 5.28525.2852. The second day is noisier, but not by more than the ratio of two sample variances of these sizes routinely produces. The single tail 0.08480.0848 would be the right figure only for the one-sided question "did re-seating make the probe noisier?", posed before the second day's readings were taken.

Every number above was computed to the digits shown; the three tail probabilities are 0.32320.3232, 0.57150.5715 and 0.16960.1696.

Application(Error bars, instrument qualification, and the analysis of variance)Original

Quoting an error bar. The statement "xˉ±S/n\bar x \pm S/\sqrt n with n−1n-1 degrees of freedom" is the normal-sample result above, and it is what a laboratory writes down after repeating a measurement. The n\sqrt n is conclusion 2; the n−1n-1 is conclusion 3; the fact that one may divide by the estimated σ\sigma and still know the exact distribution is conclusion 1 together with the tt law. For nn of order ten the difference between the tt and normal tails is tens of percent, which is why small-sample work quotes degrees of freedom and not just a standard error.

Qualifying an instrument. A detector specification of the form "resolution better than σ0\sigma_0" is checked by reading (n−1)S2/σ02(n-1)S^{2}/\sigma_0^{2} against χ2(n−1)\chi^{2}(n-1), exactly as in the example. The same chi-squared appears, with n−Mn-M in place of n−1n-1, as the goodness-of-fit statistic of a least-squares fit with MM fitted parameters: each fitted parameter is one more linear constraint on the residual vector, one more dimension removed from the orthogonal complement, in exactly the sense of Step 4.

Comparing two populations. The FF ratio is the engine of the analysis of variance, in which a total sum of squares is split into orthogonal pieces - between groups and within groups - whose expectations differ if and only if the group means differ. The splitting is the same rotation argument applied to a coarser partition of Rn\mathbb{R}^{n}, and the independence of the pieces, which is what makes the ratio an FF variable, is again the independence of coordinates in a rotated frame.

Spectral estimation. A periodogram ordinate formed from Gaussian noise is a sum of two squared normals, hence σ2χ2(2)/2\sigma^{2}\chi^{2}(2)/2 in distribution, which is why a raw periodogram has a 100%100\% relative error however long the record, and why averaging independent segments - adding degrees of freedom - is the only cure. The same counting gives the degrees of freedom of a smoothed spectral estimate.

Definition

Estimators and their properties

Adapted

Defines bias, consistency, efficiency and the standard error of an estimator, introduces the score and the Fisher information of a sample, and proves the Cramer-Rao (Fisher) inequality bounding the variance of any estimator from below; worked on twelve Poisson counts, where the sample mean attains the bound λ^=6.833±0.755\hat\lambda = 6.833 \pm 0.755 while the sample variance reaches only 6.3%6.3\% of it.

Prerequisites: Sampling distributions, Expectation, variance and covariance, Markov, Chebyshev, Jensen and Chernoff inequalities, Convergence of random variables, The central limit theorem, Inner products and norms, Quadratic forms and the Rayleigh quotient, Differentiation under the integral sign

Note(What this unit is for)Original

A measurement does not hand us a parameter; it hands us a sample, from which we compute a number and call that number our estimate. Several different numbers will usually be available for the same parameter - the mean and the median both estimate the centre of a symmetric law - and they are not equally good. This unit sets out the four things one asks of such a rule: does it converge to the truth, is it right on average, how much does it scatter, and how much scatter was unavoidable.

The last question has a sharp answer. The data carry a finite amount of information about the parameter, measurable as a single number, the Fisher information, and no estimator whatever can scatter less than that number allows. That is the Cramer-Rao inequality, and it converts "this estimator looks good" into "this estimator is within a known factor of the best possible". The distributions that the calculations below run on are those of Sampling distributions; the two standard recipes for building estimators are Maximum likelihood and Least-squares fitting, and turning an estimate into a statement with a stated probability is the business of Confidence intervals.

Definition(Estimator, bias, consistency)AdaptedAdapted from Riley, Hobson & Bence (2006), §31.3, pp. 1229-1230, and §31.3.1, eqs. (31.14)-(31.15), pp. 1230-1231

Let the sample x=(x1,…,xn)x = (x_1,\dots,x_n) be drawn from a population whose joint density P(x∣a)P(x\mid a) is known except for the value of a parameter aa. (Riley, Hobson and Bence write NN for the sample size and allow aa to stand for a whole list a1,…,ama_1,\dots,a_m of unknown parameters; we write nn for the sample size and treat one parameter at a time until the Fisher matrix below.)

An estimator of aa is a statistic a^(x)\hat a(x) - a function of the sample alone, in the sense of Sampling distributions - whose value is offered as an estimate of aa. Being a function of random variables it is itself random, and its law is its sampling distribution P(a^∣a)P(\hat a \mid a).

Its expectation and variance may be computed either over the sampling distribution or over the sample space,

E[a^]=∫a^ P(a^∣a) da^=∫a^(x) P(x∣a) dnx,\mathbb{E}[\hat a] = \int \hat a\, P(\hat a\mid a)\,d\hat a = \int \hat a(x)\, P(x\mid a)\,d^{n}x ,var⁡[a^]=∫(a^(x)−E[a^])2P(x∣a) dnx,\operatorname{var}[\hat a] = \int \bigl(\hat a(x) - \mathbb{E}[\hat a]\bigr)^{2} P(x\mid a)\,d^{n}x ,

the two integrals agreeing by the law of the unconscious statistician of Expectation, variance and covariance.

The bias of a^\hat a is

b(a)  =  E[a^]−a.b(a) \;=\; \mathbb{E}[\hat a] - a .

It is a function of the true aa and of nn, never of the observed data. If b≡0b \equiv 0 the estimator is unbiased.

The estimator is consistent when, as the sample is made larger and larger, it settles down on the parameter it is estimating. Riley, Hobson and Bence write the requirement as a^→a\hat a \to a in the limit n→∞n \to \infty, and give alongside it the equivalent demand that the sampling distribution should collapse onto a point mass there, P(a^∣a)→δ(a^−a)P(\hat a \mid a) \to \delta(\hat a - a). In the vocabulary of Convergence of random variables the statement being made is convergence in probability: for every ε>0\varepsilon > 0, Pr⁡(∣a^−a∣>ε)→0\Pr(\lvert \hat a - a\rvert > \varepsilon) \to 0, which is the sense in which the law of large numbers holds.

Definition(Standard error, mean squared error, efficiency)AdaptedAdapted from Riley, Hobson & Bence (2006), §31.3.1, eq. (31.16) and the discussion of efficiency, pp. 1231-1232, and §31.3.3, eq. (31.24) and the root mean square error, pp. 1234-1235

The standard error on an estimate is the standard deviation of its sampling distribution,

σa^  =  (var⁡[a^])1/2.\sigma_{\hat a} \;=\; \bigl(\operatorname{var}[\hat a]\bigr)^{1/2} .

It usually depends on the unknown aa; one then substitutes the estimate into the formula and quotes the estimated standard error σ^a^\hat\sigma_{\hat a}, writing the result as a=a^±σ^a^a = \hat a \pm \hat\sigma_{\hat a}.

For a biased estimator the spread about the true value is measured instead by the root mean square error ϵa^\epsilon_{\hat a}, where

ϵa^2  =  E[(a^−a)2]  =  var⁡[a^]+b(a)2,\epsilon_{\hat a}^{2} \;=\; \mathbb{E}\bigl[(\hat a - a)^{2}\bigr] \;=\; \operatorname{var}[\hat a] + b(a)^{2} ,

the decomposition following by adding and subtracting E[a^]\mathbb{E}[\hat a] inside the square, since the cross term has expectation zero. The two pieces are the statistical and the systematic part of the error.

Of two estimators of the same aa, the one with the smaller variance is the more efficient. Writing Vmin⁡V_{\min} for the lower bound established below, the efficiency of a^\hat a is

e  =  Vmin⁡var⁡[a^]  ∈  (0,1],e \;=\; \frac{V_{\min}}{\operatorname{var}[\hat a]} \;\in\; (0,1] ,

and a^\hat a is efficient, or minimum-variance, when e=1e = 1. Among unbiased estimators the one of smallest variance is the best unbiased estimator. Riley, Hobson and Bence stress that no single estimator is optimal in all respects: there is a trade-off between bias and variance, and a slightly biased estimator with a small variance may well be preferred to an unbiased one with a large variance. The root mean square error is the quantity that weighs the two against each other.

Definition(Score and Fisher information)AdaptedAdapted from Riley, Hobson & Bence (2006), §31.3.2, eqs. (31.18)-(31.23), pp. 1233-1234, and §31.3.5, eq. (31.36), p. 1241

Suppose P(x∣a)>0P(x \mid a) > 0 on a region of sample space that does not depend on aa, and that PP is twice differentiable in aa there. The score of the sample is the logarithmic derivative

U(x,a)  =  ∂ln⁡P(x∣a)∂a,U(x,a) \;=\; \frac{\partial \ln P(x\mid a)}{\partial a} ,

and the Fisher information carried by the sample about aa is

I(a)  =  E[U2]  =  ∫(∂ln⁡P∂a)2P(x∣a) dnx.I(a) \;=\; \mathbb{E}\bigl[U^{2}\bigr] \;=\; \int \left(\frac{\partial \ln P}{\partial a}\right)^{2} P(x\mid a)\, d^{n}x .

Step 2 of the proof below shows that E[U]=0\mathbb{E}[U] = 0, so I(a)I(a) is also the variance of the score, and Step 6 shows that under one further differentiation

I(a)  =  E ⁣[−∂2ln⁡P∂a2],I(a) \;=\; \mathbb{E}\!\left[-\frac{\partial^{2}\ln P}{\partial a^{2}}\right] ,

which is the form Riley, Hobson and Bence use: the information is the average curvature of the log-density at the true parameter. For several parameters a1,…,aMa_1,\dots,a_M the same construction gives the Fisher matrix

Fij  =  E ⁣[−∂2ln⁡P∂ai ∂aj],F_{ij} \;=\; \mathbb{E}\!\left[-\frac{\partial^{2}\ln P}{\partial a_i\,\partial a_j}\right] ,

a symmetric positive semi-definite matrix (a quadratic form in the sense of Quadratic forms and the Rayleigh quotient, since vTFv=E[(∑ivi∂iln⁡P)2]≥0v^{\mathsf T} F v = \mathbb{E}[(\sum_i v_i \partial_i \ln P)^{2}] \ge 0). Riley, Hobson and Bence state that for unbiased efficient estimators the Fisher matrix is exactly the inverse of their covariance matrix, (V−1)ij=Fij(V^{-1})_{ij} = F_{ij}, which is the many-parameter form of the bound proved below.

Information adds over independent observations. If the sample is independent with common one-observation density p(xi∣a)p(x_i\mid a), then ln⁡P=∑iln⁡p(xi∣a)\ln P = \sum_i \ln p(x_i\mid a), so the score is a sum of nn independent terms each of mean zero, and variances of independent summands add (Expectation, variance and covariance). Hence

I(a)  =  n i(a),i(a)=E ⁣[(∂ln⁡p(x1∣a)∂a)2],I(a) \;=\; n\, i(a) , \qquad i(a) = \mathbb{E}\!\left[\left(\frac{\partial \ln p(x_1\mid a)}{\partial a}\right)^{2}\right] ,

with i(a)i(a) the information in a single observation. Every 1/n1/n in the error bars below comes from this one line.

Definition(The Cramer-Rao inequality)AdaptedAdapted from Riley, Hobson & Bence (2006), §31.3.1, eq. (31.17), p. 1232, and §31.3.2, eqs. (31.18) and (31.23), pp. 1233-1234

Let a^(x)\hat a(x) be any estimator of aa with bias b(a)=E[a^]−ab(a) = \mathbb{E}[\hat a] - a, and suppose that

  1. the set where P(x∣a)>0P(x\mid a) > 0 does not depend on aa, and PP is differentiable in aa there;
  2. the integrals ∫P dnx\int P\,d^{n}x and ∫a^ P dnx\int \hat a\, P \,d^{n}x may be differentiated with respect to aa under the integral sign (Differentiation under the integral sign);
  3. 0<I(a)<∞0 < I(a) < \infty and var⁡[a^]<∞\operatorname{var}[\hat a] < \infty.

Then

var⁡[a^]  ≥  Vmin⁡  =  (1+b′(a))2I(a)  =  (1+∂b/∂a)2E[(∂ln⁡P/∂a)2],\operatorname{var}[\hat a] \;\ge\; V_{\min} \;=\; \frac{\bigl(1 + b'(a)\bigr)^{2}}{I(a)} \;=\; \frac{\bigl(1 + \partial b/\partial a\bigr)^{2}}{\mathbb{E}\bigl[(\partial \ln P/\partial a)^{2}\bigr]} ,

and, if in addition PP is twice differentiable in aa and ∫P dnx\int P\,d^{n}x may be differentiated twice under the integral sign,

var⁡[a^]  ≥  (1+∂b/∂a)2E[−∂2ln⁡P/∂a2].\operatorname{var}[\hat a] \;\ge\; \frac{\bigl(1 + \partial b/\partial a\bigr)^{2}}{\mathbb{E}\bigl[-\partial^{2}\ln P/\partial a^{2}\bigr]} .

In particular an unbiased estimator satisfies var⁡[a^]≥1/I(a)\operatorname{var}[\hat a] \ge 1/I(a). Equality holds if and only if the score is an affine function of the estimator,

∂ln⁡P∂a  =  c(a) [a^(x)−E[a^]]\frac{\partial \ln P}{\partial a} \;=\; c(a)\,\bigl[\hat a(x) - \mathbb{E}[\hat a]\bigr]

for almost every xx, with c(a)c(a) depending on aa but not on xx.

Riley, Hobson and Bence call this Fisher's inequality and also give the name Cramer-Rao inequality; they write it with PP the population density of the whole sample, as here.

Idea of the proofOriginal

Think of random variables with finite variance as vectors, with (F,G)=E[FG](F,G) = \mathbb{E}[FG] as the inner product. Two vectors matter: the centred estimator a^−E[a^]\hat a - \mathbb{E}[\hat a], whose length squared is the variance we want to bound below, and the score UU, whose length squared is the information.

Differentiating the normalisation ∫P dnx=1\int P \,d^{n}x = 1 says that the score has mean zero, so it is already centred. Differentiating ∫a^P dnx=a+b(a)\int \hat a P\,d^{n}x = a + b(a) says that the inner product of the two vectors is fixed at 1+b′(a)1 + b'(a), whatever the estimator. So we have two vectors with a prescribed inner product, and the Cauchy-Schwarz inequality of Inner products and norms immediately forbids either of them from being too short: ∣(a^−E[a^],U)∣≤∥a^−E[a^]∥ ∥U∥\lvert(\hat a - \mathbb{E}[\hat a], U)\rvert \le \lVert \hat a - \mathbb{E}[\hat a]\rVert\,\lVert U \rVert rearranges into exactly the bound. Equality in Cauchy-Schwarz means the two vectors are parallel, which is the condition stated for an efficient estimator.

So the content of the theorem is a triangle: the estimator must "overlap" the score by a fixed amount, the score has a fixed length, and therefore the estimator cannot be short. Nothing about the estimator enters except that it is an unbiased-up-to-bb function of the data.

Proof(The bound, and both forms of the information)AdaptedAdapted from Riley, Hobson & Bence (2006), §31.3.2, the derivation of (31.19)-(31.23) and the identity between the two forms of the information, pp. 1233-1234

Write ∂\partial for ∂/∂a\partial/\partial a and suppress the arguments of PP.

Step 1: the two identities we shall need. Everything comes from differentiating two integrals in aa. Hypothesis 2 licenses taking ∂\partial inside, and hypothesis 1 guarantees that no boundary term appears, because the region of integration where P>0P>0 is the same for every aa.

Step 2: the score has mean zero. Differentiating ∫P dnx=1\int P \,d^{n}x = 1,

0  =  ∂ ⁣∫P dnx  =  ∫∂P dnx  =  ∫(∂ln⁡P) P dnx  =  E[U],0 \;=\; \partial \!\int P\,d^{n}x \;=\; \int \partial P \, d^{n}x \;=\; \int (\partial \ln P)\, P\, d^{n}x \;=\; \mathbb{E}[U] ,

where the third equality is the chain rule ∂P=(∂ln⁡P)P\partial P = (\partial \ln P) P, valid where P>0P>0. Consequently I(a)=E[U2]=var⁡[U]I(a) = \mathbb{E}[U^{2}] = \operatorname{var}[U].

Step 3: the score overlaps the estimator by 1+b′1+b'. The definition of the bias gives ∫a^(x)P dnx=a+b(a)\int \hat a(x) P \,d^{n}x = a + b(a). Differentiating both sides, and using the chain rule again on the left (a^\hat a does not depend on aa),

∫a^ (∂ln⁡P) P dnx  =  1+b′(a),that isE[a^ U]  =  1+b′(a).\int \hat a\, (\partial \ln P)\, P\, d^{n}x \;=\; 1 + b'(a) , \qquad\text{that is}\qquad \mathbb{E}[\hat a\,U] \;=\; 1 + b'(a) .

Step 4: centre the estimator. Multiply the identity of Step 2 by the constant E[a^]\mathbb{E}[\hat a] and subtract it from Step 3. Since E[a^]\mathbb{E}[\hat a] does not depend on xx, this gives

E[(a^−E[a^]) U]  =  1+b′(a).\mathbb{E}\bigl[(\hat a - \mathbb{E}[\hat a])\,U\bigr] \;=\; 1 + b'(a) .

Subtracting any other constant would have produced a larger left-hand factor in the next step; subtracting the mean is what makes the bound sharp, and this is the point at which Riley, Hobson and Bence choose their free function α(a)\alpha(a) to be E[a^]\mathbb{E}[\hat a].

Step 5: Cauchy-Schwarz. On the space of functions of xx with ∫(⋅)2P dnx<∞\int (\cdot)^{2} P \,d^{n}x < \infty, the pairing (F,G)=∫FG P dnx(F,G) = \int FG\,P\,d^{n}x is an inner product, so by Inner products and norms,

(E[(a^−E[a^]) U])2  ≤  E[(a^−E[a^])2]  E[U2]  =  var⁡[a^]  I(a).\Bigl(\mathbb{E}\bigl[(\hat a - \mathbb{E}[\hat a])\,U\bigr]\Bigr)^{2} \;\le\; \mathbb{E}\bigl[(\hat a - \mathbb{E}[\hat a])^{2}\bigr]\;\mathbb{E}\bigl[U^{2}\bigr] \;=\; \operatorname{var}[\hat a]\; I(a) .

The left-hand side is (1+b′)2(1+b')^{2} by Step 4, and I(a)>0I(a) > 0 by hypothesis 3, so dividing gives

var⁡[a^]  ≥  (1+b′(a))2I(a),\operatorname{var}[\hat a] \;\ge\; \frac{(1+b'(a))^{2}}{I(a)} ,

which is the first form. Equality in Cauchy-Schwarz holds exactly when the two entries are proportional, U=c(a)(a^−E[a^])U = c(a)(\hat a - \mathbb{E}[\hat a]), which is the stated equality condition.

Step 6: the curvature form of the information. Differentiate the identity ∫(∂ln⁡P) P dnx=0\int (\partial \ln P)\,P \,d^{n}x = 0 of Step 2 once more in aa, again taking the derivative inside:

∫(∂2ln⁡P)P dnx  +  ∫(∂ln⁡P) ∂P dnx  =  0.\int \bigl(\partial^{2}\ln P\bigr) P \,d^{n}x \;+\; \int \bigl(\partial \ln P\bigr)\,\partial P \,d^{n}x \;=\; 0 .

In the second integral write ∂P=(∂ln⁡P)P\partial P = (\partial \ln P)P once more; it becomes ∫(∂ln⁡P)2P dnx=I(a)\int (\partial\ln P)^{2} P\,d^{n}x = I(a). Hence

I(a)  =  −∫(∂2ln⁡P)P dnx  =  E ⁣[−∂2ln⁡P∂a2],I(a) \;=\; -\int \bigl(\partial^{2}\ln P\bigr)P\,d^{n}x \;=\; \mathbb{E}\!\left[-\frac{\partial^{2}\ln P}{\partial a^{2}}\right] ,

and substituting this into the first form gives the second. □\square

Remark(Where the hypotheses are used)Original

Fixed support (hypothesis 1). Used in Steps 2, 3 and 6, where the derivative is taken inside the integral with no boundary term. It is not a formality. Let x1,…,xnx_1,\dots,x_n be uniform on (0,a)(0,a). Then ln⁡p=−ln⁡a\ln p = -\ln a wherever p>0p>0, so ∂ln⁡p=−1/a\partial \ln p = -1/a and i(a)=1/a2i(a) = 1/a^{2}, giving the apparent bound a2/na^{2}/n for an unbiased estimator. But M=max⁡ixiM = \max_i x_i has E[M]=na/(n+1)\mathbb{E}[M] = na/(n+1), so a^=(n+1)M/n\hat a = (n+1)M/n is unbiased with

var⁡[a^]=a2n(n+2),\operatorname{var}[\hat a] = \frac{a^{2}}{n(n+2)} ,

smaller than a2/na^{2}/n by a factor n+2n+2. The inequality fails outright, because the region {0<xi<a}\{0<x_i<a\} moves with aa and the differentiations of Steps 2 and 3 pick up boundary terms that were discarded.

Differentiation under the integral (hypothesis 2). Used at the same three places. Differentiation under the integral sign gives the standard sufficient condition - continuity of PP and ∂P\partial P - which holds for the exponential families met in practice.

Finite, non-zero information (hypothesis 3). I(a)>0I(a) > 0 is needed to divide in Step 5; if I(a)=0I(a) = 0 the data say nothing about aa and the bound reads var⁡≥∞\operatorname{var} \ge \infty unless b′=−1b' = -1. I(a)<∞I(a)<\infty and var⁡[a^]<∞\operatorname{var}[\hat a]<\infty are needed for Cauchy-Schwarz to be meaningful.

Twice differentiable (for the second form only). The curvature form is the one usually evaluated, because the second derivative of a log-likelihood is often free of the data or easy to average, but it is a corollary of the first form, not an independent statement.

What the bound does not say. It bounds the variance, not the mean squared error. A biased estimator may have variance below 1/I(a)1/I(a) - the factor (1+b′)2(1+b')^{2} is then smaller than one - and the example below exhibits one. It also does not assert that an estimator attaining the bound exists; it exists only when the score happens to be affine in some statistic, which is the exponential-family case.

The limit in "consistent". The definition reported above writes (Riley, Hobson & Bence (2006), §31.3.1, p. 1231) lim⁡n→∞a^=a\lim_{n\to\infty}\hat a = a. Since a^\hat a is a random variable this is not an ordinary limit, and the statement intended is the one made precise in Convergence of random variables: convergence in probability, equivalently the collapse of P(a^∣a)P(\hat a\mid a) onto a point mass, which is the second form they give. The accompanying argument of Riley, Hobson and Bence (Riley, Hobson & Bence (2006), §31.3.1, p. 1232) is sound in that reading: if a^\hat a is unbiased and var⁡[a^]→0\operatorname{var}[\hat a]\to 0, then for any ε>0\varepsilon>0 Chebyshev's inequality of Markov, Chebyshev, Jensen and Chernoff inequalities gives Pr⁡(∣a^−a∣>ε)≤var⁡[a^]/ε2→0\Pr(\lvert\hat a - a\rvert>\varepsilon) \le \operatorname{var}[\hat a]/\varepsilon^{2}\to 0. The converse fails: a consistent estimator need not be unbiased at any finite nn.

Method(Assessing an estimator)Original

Given a candidate a^(x)\hat a(x) and a parametric model P(x∣a)P(x\mid a):

  1. Bias. Compute E[a^]\mathbb{E}[\hat a] and subtract aa. For a sum or an average of sample values this needs only linearity of expectation; for a ratio or a square root it usually does not close in elementary form and one expands to order 1/n1/n.
  2. Variance. Compute var⁡[a^]\operatorname{var}[\hat a], if necessary in terms of the central moments νr\nu_r of the parent. For the corrected sample variance σ^2=(n−1)−1∑i(xi−xˉ)2\hat\sigma^{2} = (n-1)^{-1}\sum_i (x_i-\bar x)^{2}, Riley, Hobson and Bence (Riley, Hobson & Bence (2006), §31.4.2, eqs. (31.47)-(31.49), pp. 1247-1248) give
var⁡[σ^2]  =  1n(ν4−n−3n−1 ν22),\operatorname{var}\bigl[\hat\sigma^{2}\bigr] \;=\; \frac{1}{n}\left(\nu_4 - \frac{n-3}{n-1}\,\nu_2^{2}\right) ,

which needs the fourth central moment of the population, not just its variance. 3. Consistency. If the estimator is unbiased and its variance tends to zero, it is consistent, by Chebyshev. Otherwise check that both the bias and the variance tend to zero, which gives ϵa^→0\epsilon_{\hat a}\to 0 and hence consistency by the same inequality. 4. Information. Write down ln⁡P(x∣a)\ln P(x\mid a), differentiate twice in aa, change sign and average: that is I(a)I(a). For an independent sample use I=n iI = n\,i and do the work on one observation. 5. Efficiency. Form Vmin⁡=(1+b′)2/I(a)V_{\min} = (1+b')^{2}/I(a) and divide by the variance from step 2. If the score is proportional to a^−E[a^]\hat a - \mathbb{E}[\hat a] the estimator is efficient and the division is unnecessary. 6. Quote. For an unbiased estimator quote a^±σ^a^\hat a \pm \hat\sigma_{\hat a}, substituting the estimate wherever the unknown aa appears in the variance formula. For a biased one quote a^±ϵ^a^\hat a \pm \hat\epsilon_{\hat a}, or state the bias separately as a systematic error.

Example(Twelve minutes of muon counts: three estimators of one rate)Original

A scintillator telescope records cosmic-ray muons in twelve consecutive one-minute gates. The counts are

7,4,9,6,5,11,8,6,3,7,10,6,7,\quad 4,\quad 9,\quad 6,\quad 5,\quad 11,\quad 8,\quad 6,\quad 3,\quad 7,\quad 10,\quad 6 ,

with total ∑ixi=82\sum_i x_i = 82 and n=12n = 12. Model them as independent Poisson variables of unknown mean λ\lambda, so that

P(x∣λ)  =  ∏i=112λxie−λxi!,ln⁡P  =  −nλ+(∑ixi)ln⁡λ−∑iln⁡(xi!).P(x\mid\lambda) \;=\; \prod_{i=1}^{12} \frac{\lambda^{x_i} e^{-\lambda}}{x_i!} , \qquad \ln P \;=\; -n\lambda + \Bigl(\textstyle\sum_i x_i\Bigr)\ln\lambda - \textstyle\sum_i \ln (x_i!) .

The information. Differentiating twice, ∂2ln⁡P/∂λ2=−λ−2∑ixi\partial^{2}\ln P/\partial\lambda^{2} = -\lambda^{-2}\sum_i x_i, whose expectation is −nλ/λ2-n\lambda/\lambda^{2}. Hence

I(λ)  =  nλ,soVmin⁡=λn  for any unbiased estimator.I(\lambda) \;=\; \frac{n}{\lambda} , \qquad\text{so}\qquad V_{\min} = \frac{\lambda}{n} \ \text{ for any unbiased estimator.}

Estimator 1: the sample mean. λ^1=xˉ=82/12=6.8333\hat\lambda_1 = \bar x = 82/12 = 6.8333. It is unbiased, since E[xi]=λ\mathbb{E}[x_i]=\lambda, and var⁡[xˉ]=λ/n\operatorname{var}[\bar x] = \lambda/n because a Poisson variable has variance equal to its mean. That is exactly Vmin⁡V_{\min}, so λ^1\hat\lambda_1 is efficient, e=1e=1. One can see this from the equality condition directly:

∂ln⁡P∂λ  =  −n+1λ∑ixi  =  nλ (xˉ−λ),\frac{\partial \ln P}{\partial\lambda} \;=\; -n + \frac{1}{\lambda}\sum_i x_i \;=\; \frac{n}{\lambda}\,\bigl(\bar x - \lambda\bigr) ,

which is c(λ)c(\lambda) times λ^1−E[λ^1]\hat\lambda_1 - \mathbb{E}[\hat\lambda_1] with c(λ)=n/λc(\lambda)=n/\lambda. Substituting the estimate into the standard error λ/n\sqrt{\lambda/n} gives

λ  =  6.833±0.755 counts per minute.\lambda \;=\; 6.833 \pm 0.755\ \text{counts per minute} .

Estimator 2: the sample variance. A Poisson law has variance equal to its mean, so λ^2=σ^2=111∑i(xi−xˉ)2\hat\lambda_2 = \hat\sigma^{2} = \frac{1}{11}\sum_i (x_i-\bar x)^{2} is also an unbiased estimator of λ\lambda. The deviations from 6.83336.8333 have squares summing to ∑i(xi−xˉ)2=185/3=61.667\sum_i (x_i-\bar x)^{2} = 185/3 = 61.667, so

λ^2  =  61.66711  =  5.606.\hat\lambda_2 \;=\; \frac{61.667}{11} \;=\; 5.606 .

Its variance follows from the formula in step 2 of the method with the Poisson central moments ν2=λ\nu_2 = \lambda and ν4=λ+3λ2\nu_4 = \lambda + 3\lambda^{2}:

var⁡[λ^2]=1n(λ+3λ2−n−3n−1λ2)=λn+2λ2n−1,\operatorname{var}[\hat\lambda_2] = \frac{1}{n}\left(\lambda + 3\lambda^{2} - \frac{n-3}{n-1}\lambda^{2}\right) = \frac{\lambda}{n} + \frac{2\lambda^{2}}{n-1} ,

since 3−(n−3)/(n−1)=2n/(n−1)3 - (n-3)/(n-1) = 2n/(n-1). With n=12n=12 and λ≈6.8333\lambda \approx 6.8333 this is 0.569+8.490=9.0590.569 + 8.490 = 9.059, a standard error of 3.0103.010 against 0.7550.755. The efficiency is

e  =  λ/nλ/n+2λ2/(n−1)  =  11+2nλ/(n−1)  =  11+164/11  =  0.0629.e \;=\; \frac{\lambda/n}{\lambda/n + 2\lambda^{2}/(n-1)} \;=\; \frac{1}{1 + 2n\lambda/(n-1)} \;=\; \frac{1}{1 + 164/11} \;=\; 0.0629 .

Both estimators are unbiased and both are consistent, but the second throws away about 94%94\% of the information. Estimating a Poisson rate from the scatter rather than from the total is a quantitatively bad idea, and the bound says so without any need to simulate.

Estimator 3: a biased one that beats the unbiased bound. Take λ^3=1n+1∑ixi=82/13=6.3077\hat\lambda_3 = \frac{1}{n+1}\sum_i x_i = 82/13 = 6.3077. Then E[λ^3]=nλ/(n+1)\mathbb{E}[\hat\lambda_3] = n\lambda/(n+1), so

b(λ)=−λn+1,b′(λ)=−1n+1,1+b′=nn+1,b(\lambda) = -\frac{\lambda}{n+1} , \qquad b'(\lambda) = -\frac{1}{n+1} , \qquad 1 + b' = \frac{n}{n+1} ,

and the bound becomes Vmin⁡=(n/(n+1))2λ/n=nλ/(n+1)2V_{\min} = (n/(n+1))^{2}\lambda/n = n\lambda/(n+1)^{2}. The actual variance is var⁡[λ^3]=nλ/(n+1)2\operatorname{var}[\hat\lambda_3] = n\lambda/(n+1)^{2} as well: this estimator is also efficient, and with λ≈6.8333\lambda\approx 6.8333 its variance is 0.4850.485, below the unbiased bound 0.5690.569. There is no contradiction, because it is biased. Comparing on the root mean square error,

ϵ2[λ^3]=nλ+λ2(n+1)2=82+46.694169=0.762,ϵ2[λ^1]=λn=0.569,\epsilon^{2}[\hat\lambda_3] = \frac{n\lambda + \lambda^{2}}{(n+1)^{2}} = \frac{82 + 46.694}{169} = 0.762 , \qquad \epsilon^{2}[\hat\lambda_1] = \frac{\lambda}{n} = 0.569 ,

so here the shrunken estimator is worse overall. Solving ϵ2[λ^3]<ϵ2[λ^1]\epsilon^{2}[\hat\lambda_3] < \epsilon^{2}[\hat\lambda_1] gives λ<(2n+1)/n=2.083\lambda < (2n+1)/n = 2.083: shrinking towards zero pays only when the rate is low. At 6.86.8 counts per gate it does not.

The three numbers to check are 6.8336.833, 5.6065.606 and 6.3086.308, with efficiencies 11, 0.06290.0629 and 11.

Application(Error budgets, detector design, and Fisher forecasts)Original

Quoting a result. Every "±\pm" in an experimental paper is a standard error in the sense defined here, and the distinction between it and the root mean square error is the distinction between the statistical and the systematic parts of an error budget. A calibration offset that does not average away is a bias bb; the inequality is silent about it, which is why systematics have to be controlled rather than beaten down with more data.

Designing the measurement before taking it. Because I(a)=n i(a)I(a) = n\,i(a) and Vmin⁡=1/IV_{\min} = 1/I, the Cramer-Rao bound predicts the achievable error bar from the model alone, before any data exist. Choosing between two experimental configurations then means comparing their one-observation informations i(a)i(a): how many hours of beam time, how many pixels, what exposure. In cosmology this calculation is standard enough to have a name - a Fisher forecast - and it is the Fisher matrix FijF_{ij}, not the scalar, that is computed, its inverse giving the forecast covariance ellipse for the parameters, as in Confidence intervals.

Resolution limits. In signal processing the same bound fixes how precisely a time delay, a frequency or a direction of arrival can be recovered from noisy samples; for a pulse of bandwidth BB observed at signal-to-noise ratio ρ\rho the information about the arrival time scales as B2ρ2B^{2}\rho^{2}, which is why timing precision improves linearly with bandwidth. The bound is quoted as the target that a practical algorithm is measured against.

Where the estimators come from. This unit says how to judge an estimator but not how to find one. The two standard constructions are the subject of Maximum likelihood, whose estimators attain the bound asymptotically and exactly whenever any estimator does, and Least-squares fitting, which is the same construction specialised to Gaussian errors. The propagation of the resulting standard errors through subsequent calculations is Propagation of uncertainty.

Sources

Method

Maximum likelihood

Adapted

Defines the likelihood and the maximum-likelihood estimator, proves that maximum likelihood commutes with reparametrisation and that any efficient estimator must be a function of it, states the large-sample normal form of the likelihood with its curvature error bar, and locates a lighthouse from fifteen Cauchy-distributed flashes at 1.163±0.1841.163 \pm 0.184 km where the sample mean gives −0.64-0.64 km.

Prerequisites: Estimators and their properties, Sampling distributions, Probability spaces, Joint distributions and transformations, Characteristic functions, Markov, Chebyshev, Jensen and Chernoff inequalities, The central limit theorem, Taylor expansion and critical points in several variables

Note(What this unit is for)Original

Estimators and their properties says how to judge a rule for turning data into a number but not where such a rule should come from. Maximum likelihood is the answer that works almost always: write down the probability of having obtained the data you actually obtained, regard it as a function of the unknown parameters, and take the parameters that make it largest.

The method is worth its name for four reasons, all of them below. It is automatic - no cleverness is needed once the model is written down. It is invariant: estimating a rate and estimating a lifetime give consistent answers. It is asymptotically as good as any method can be, in the precise sense of the Cramer-Rao bound. And it produces its own error bar, from the curvature of the log-likelihood at the peak, with no separate calculation.

Definition(Likelihood, log-likelihood, and the ML estimator)AdaptedAdapted from Riley, Hobson & Bence (2006), §31.5, the definition of the likelihood function, p. 1255, and §31.5.1, eqs. (31.68)-(31.69), pp. 1257-1258

Adopt a hypothesis HH that the data x=(x1,…,xn)x = (x_1,\dots,x_n) were drawn from a joint density of a specified functional form, known except for the values of MM parameters a=(a1,…,aM)a = (a_1,\dots,a_M). The likelihood function is that density read as a function of the parameters with the data held fixed:

L(x;a)  =  P(x∣a,H).L(x; a) \;=\; P(x \mid a, H) .

Riley, Hobson and Bence make the conditioning on HH explicit, as here, because the likelihood is only ever defined relative to an assumed model. When the sample is independent the likelihood factorises,

L(x;a)  =  ∏i=1np(xi∣a),L(x;a) \;=\; \prod_{i=1}^{n} p(x_i \mid a) ,

but the definition does not require independence, nor that the xix_i be drawn from a common law.

The log-likelihood is ℓ(a)=ln⁡L(x;a)\ell(a) = \ln L(x;a). A maximum-likelihood estimator (ML estimator) a^\hat a is a value of the parameters at which L(x;a)L(x;a) attains its largest value over the allowed parameter range. Since ln⁡\ln is strictly increasing, LL and ℓ\ell have the same maximisers and the same stationary points, and for a product likelihood ℓ\ell is a sum, so one works with ℓ\ell.

If the maximum lies at an interior stationary point, a^\hat a solves the MM likelihood equations

∂ℓ∂ai∣a=a^  =  0,i=1,…,M.\left.\frac{\partial \ell}{\partial a_i}\right|_{a=\hat a} \;=\; 0 , \qquad i = 1,\dots,M .

The left-hand side is the score of Estimators and their properties, so the likelihood equations say: choose the parameters that make the observed data score zero. Riley, Hobson and Bence emphasise that this is a necessary condition only. They list the shapes that occur in practice - a single interior stationary point, several stationary points of which one is the global maximum, and a maximum sitting at an end-point of the allowed range, with or without stationary points elsewhere - and insist that one verify that a solution found is in fact a maximum.

Method(Three properties of maximum likelihood)AdaptedAdapted from Riley, Hobson & Bence (2006), §31.5.2, the invariance property and eq. (31.76), p. 1261, §31.5.3, the efficiency theorem, p. 1262, and §31.5.6, the large-sample form and its consequences, pp. 1269-1270

Let a^\hat a be an ML estimator of aa under the hypothesis HH.

1. Invariance under reparametrisation. For any function α\alpha of the parameters, the ML estimator of α(a)\alpha(a) is

α(a)^  =  α(a^).\widehat{\alpha(a)} \;=\; \alpha(\hat a) .

One therefore never has to decide whether to estimate a rate or its reciprocal. The price is that ML estimators are in general biased: if a^\hat a is unbiased for aa and α\alpha is strictly convex (or strictly concave) and non-affine, then α(a^)\alpha(\hat a) is biased upwards (respectively downwards) for α(a)\alpha(a), by Jensen's inequality (Markov, Chebyshev, Jensen and Chernoff inequalities). Riley, Hobson and Bence give the case of a sample from the density τ−1e−x/τ\tau^{-1}e^{-x/\tau} on (0,∞)(0,\infty): the ML estimators are τ^=xˉ\hat\tau = \bar x and λ^=1/xˉ\hat\lambda = 1/\bar x for λ=1/τ\lambda = 1/\tau, with

E[τ^]=τ,E[λ^]=nn−1λ,\mathbb{E}[\hat\tau] = \tau , \qquad \mathbb{E}[\hat\lambda] = \frac{n}{n-1}\lambda ,

so the second is biased although the first is not. They note that the bias of an ML estimator always vanishes as n→∞n\to\infty.

2. If an efficient estimator exists, it is a function of the ML estimator. Suppose some estimator a^eff\hat a_{\mathrm{eff}} attains the Cramer-Rao bound of Estimators and their properties with PP replaced by LL. Then a^eff\hat a_{\mathrm{eff}} is a function of a^\hat a. Maximum likelihood therefore never misses an efficient estimator that exists.

3. Large-sample form. In the limit n→∞n \to \infty the likelihood tends to a multivariate Gaussian in the parameters, centred on the ML estimate:

L(x;a)  ⟶  Lmax⁡exp⁡[−12Q(a,a^)],Q(a,a^)=(a−a^)TV−1(a−a^),L(x;a) \;\longrightarrow\; L_{\max}\exp\left[-\tfrac12 Q(a,\hat a)\right] , \qquad Q(a,\hat a) = (a-\hat a)^{\mathsf T} V^{-1} (a - \hat a) ,(V−1)ij  =  −∂2ℓ∂ai∂aj∣a=a^,\bigl(V^{-1}\bigr)_{ij} \;=\; \left.-\frac{\partial^{2}\ell}{\partial a_i \partial a_j}\right|_{a=\hat a} ,

and in that limit V−1V^{-1} tends to the Fisher matrix FF. Riley, Hobson and Bence draw from this the two statements that ML estimators are asymptotically consistent and asymptotically minimum-variance, attributing the Gaussian shape to the central limit theorem of The central limit theorem; they also note that the corresponding statement for the sampling distribution P(a^∣a)P(\hat a \mid a) holds, with the roles of aa and a^\hat a exchanged, so that in this limit the two ways of setting an error bar agree.

For one parameter, the last display is the curvature standard error

σ^a^  =  [−∂2ℓ∂a2∣a=a^]−1/2,\hat\sigma_{\hat a} \;=\; \left[\left.-\frac{\partial^{2}\ell}{\partial a^{2}}\right|_{a=\hat a}\right]^{-1/2} ,

which Riley, Hobson and Bence justify from the Bayesian reading of the likelihood (Bayesian inference) and recommend as a measure of the error even when LL is not Gaussian.

Idea of the proofOriginal

All three properties are statements about the shape of one function of the parameters.

Invariance is the observation that a change of parameter relabels the horizontal axis of the graph of LL but does not move its peak: the highest point of a curve is still the highest point after the axis is stretched. Nothing is assumed about the stretch except that it is a well-defined map.

The efficiency statement is the equality case of the Cauchy-Schwarz step in the Cramer-Rao proof. Equality forces the score to be proportional to a^eff\hat a_{\mathrm{eff}} minus its mean. But the ML estimator is where the score vanishes, so wherever the score vanishes that bracket vanishes too - which pins a^eff\hat a_{\mathrm{eff}} to the ML estimate.

The large-sample form is Taylor's theorem plus the law of large numbers. For an independent sample ℓ\ell is a sum of nn terms, so its second derivative is a sum of nn terms and grows like nn, while the cubic term in the expansion about the peak grows like nn as well but is multiplied by a displacement of order n−1/2n^{-1/2} and so is smaller by n−1/2n^{-1/2}. Expanding about the maximum, the linear term is absent by stationarity and the quadratic term survives: a parabola in ℓ\ell, a Gaussian in LL, with width set by the curvature.

Proof(Invariance, and the efficiency theorem)AdaptedAdapted from Riley, Hobson & Bence (2006), §31.5.2, p. 1261, and §31.5.3, p. 1262

Invariance. Let α\alpha map the parameter space into some set AA, and define the induced likelihood of a value α0∈A\alpha_0 \in A as the largest likelihood available among parameters carrying that value,

L∗(α0)  =  sup⁡{ L(x;a):α(a)=α0 }.L^{*}(\alpha_0) \;=\; \sup\{\, L(x;a) : \alpha(a) = \alpha_0 \,\} .

This is the only definition available when α\alpha is not injective, and it reduces to L(x;α−1(α0))L(x;\alpha^{-1}(\alpha_0)) when it is. Now sup⁡α0∈AL∗(α0)=sup⁡aL(x;a)=L(x;a^)\sup_{\alpha_0 \in A} L^{*}(\alpha_0) = \sup_a L(x;a) = L(x;\hat a), because every aa is counted exactly once on the left, under α0=α(a)\alpha_0 = \alpha(a). The supremum on the left is therefore attained at α0=α(a^)\alpha_0 = \alpha(\hat a), which says α(a)^=α(a^)\widehat{\alpha(a)} = \alpha(\hat a). No smoothness, monotonicity or invertibility of α\alpha was used.

Bias is not preserved. Suppose E[a^]=a\mathbb{E}[\hat a] = a and α\alpha is strictly convex and non-affine. Jensen's inequality gives E[α(a^)]>α(E[a^])=α(a)\mathbb{E}[\alpha(\hat a)] > \alpha(\mathbb{E}[\hat a]) = \alpha(a) whenever a^\hat a is not degenerate, so α(a^)\alpha(\hat a) is biased upwards; applying the same argument to −α-\alpha gives a downward bias when α\alpha is strictly concave and non-affine. This is why invariance and unbiasedness cannot both be demanded of an estimation rule.

Efficiency. Apply the Cramer-Rao inequality of Estimators and their properties with P(x∣a)P(x\mid a) taken to be L(x;a)L(x;a), which is legitimate under HH because they are the same function. Suppose a^eff\hat a_{\mathrm{eff}} attains the bound. Then Step 5 of that proof holds with equality, and equality in Cauchy-Schwarz requires the two entries to be proportional:

∂ℓ∂a  =  c(a) [a^eff(x)−α(a)]for almost every x,\frac{\partial \ell}{\partial a} \;=\; c(a)\,\bigl[\hat a_{\mathrm{eff}}(x) - \alpha(a)\bigr] \qquad\text{for almost every } x,

with α(a)=E[a^eff]\alpha(a) = \mathbb{E}[\hat a_{\mathrm{eff}}] and c(a)≠0c(a) \ne 0 independent of xx. Evaluate both sides at a=a^a = \hat a, where the left-hand side vanishes by the likelihood equation. Since c(a^)≠0c(\hat a)\neq 0,

a^eff(x)  =  α(a^),\hat a_{\mathrm{eff}}(x) \;=\; \alpha(\hat a) ,

so a^eff\hat a_{\mathrm{eff}} is the function α\alpha of the ML estimator - and, by the invariance property just proved, is itself the ML estimator of α(a)\alpha(a). □\square

The large-sample statement 3 is quoted from Riley, Hobson and Bence, who derive it from the central limit theorem rather than proving it; the conditions under which it holds are discussed in the remark.

Remark(Where the hypotheses are used, and where they fail)Original

The model HH. Everything is conditional on the assumed functional form. If HH is wrong, the ML estimator converges to the parameter value whose model law is closest to the truth in an information sense, not to anything one wanted; and the curvature error bar, which measures only how sharply the assumed model discriminates, is then an understatement. Checking HH is the business of Hypothesis testing, not of this unit.

Interior maximum, and differentiability. The likelihood equations are necessary only where the maximum is interior and ℓ\ell is differentiable. The catalogue of likelihood shapes (Riley, Hobson & Bence (2006), §31.5.1, Fig. 31.6, p. 1257) is a list of the ways this can fail, and each occurs in practice. For a sample from the uniform density on (0,θ)(0,\theta) the likelihood is θ−n\theta^{-n} for θ≥max⁡ixi\theta \ge \max_i x_i and zero below, so it is strictly decreasing wherever it is positive: the ML estimator is θ^=max⁡ixi\hat\theta = \max_i x_i, at the end-point of the allowed range, and the derivative is never zero. The worked example below has three stationary points, two of them spurious.

The regularity behind statement 3. The large-sample Gaussian form needs the conditions already used for the Cramer-Rao bound - support not depending on the parameters, differentiation under the integral sign, finite non-zero information - together with an interior true value and a third derivative of ℓ\ell under control, so that the Taylor expansion can be truncated after the quadratic term. The statement of the large-sample form (Riley, Hobson & Bence (2006), §31.5.6, pp. 1269-1270) does not list these; they are what is being used. The uniform example again shows what is lost: there n(θ−θ^)/θn(\theta - \hat\theta)/\theta converges to an exponential distribution, not a Gaussian, and the error shrinks like 1/n1/n rather than 1/n1/\sqrt n, which is faster than the regular rate rather than slower.

Asymptotic, not finite-sample. Statement 3 says nothing at any fixed nn. The example in this unit has n=15n = 15, and the curvature error bar 0.1840.184 and the asymptotic bound 0.1830.183 agree there to one part in a hundred; that agreement is empirical, not guaranteed.

Two readings of the error bar. The curvature formula for σ^a^\hat\sigma_{\hat a} uses the observed second derivative at the peak, which depends on the data; the Cramer-Rao bound uses its expectation over samples, the Fisher information. The two coincide in the limit and often differ at finite nn. The curvature form (Riley, Hobson & Bence (2006), §31.5.5, eq. (31.85), p. 1266) is reached through the Bayesian identification of the normalised likelihood with a posterior under a flat prior, and Riley, Hobson and Bence (Riley, Hobson & Bence (2006), §31.5.5, p. 1266) are explicit that a frequentist regards the resulting interval as an approximation to the one in Confidence intervals.

Method(Maximum likelihood in practice)Original
  1. State the model. Write the density of one observation, p(x∣a)p(x\mid a), with every parameter named and its allowed range given.
  2. Form the log-likelihood. For an independent sample, ℓ(a)=∑i=1nln⁡p(xi∣a)\ell(a) = \sum_{i=1}^{n}\ln p(x_i\mid a). Drop any additive term free of aa; it shifts ℓ\ell without moving the maximum.
  3. Differentiate and solve. Set ∂ℓ/∂ai=0\partial\ell/\partial a_i = 0 for each ii. If the equations are algebraic, solve them. If not, solve numerically by Newton's method on the score, as in Root finding, starting from a crude estimate (a sample mean, a median, a method-of-moments value).
  4. Confirm it is the global maximum. Check that the Hessian ∂2ℓ/∂ai∂aj\partial^{2}\ell/\partial a_i \partial a_j is negative definite at the solution, and scan ℓ\ell across the whole allowed range: multiple stationary points are common, and the maximum may sit at an end-point where no derivative vanishes.
  5. Error bars. Invert the negative Hessian at the peak: V=[−∂2ℓ/∂ai∂aj]−1V = [-\partial^{2}\ell/\partial a_i\partial a_j]^{-1}, whose diagonal square roots are the standard errors and whose off-diagonal entries are the covariances. Equivalently, for one parameter, find where ℓ\ell has fallen by 12\tfrac12 from its peak; for a parabola these agree exactly, and the drop-by-12\tfrac12 rule is the better of the two when the peak is skew.
  6. Reparametrise freely. If the quantity wanted is α(a)\alpha(a), report α(a^)\alpha(\hat a). Its error bar follows by Propagation of uncertainty, σα=∣α′(a^)∣ σa^\sigma_{\alpha} = \lvert\alpha'(\hat a)\rvert\,\sigma_{\hat a}, to first order - or, better, by repeating step 5 in the new parameter.
  7. Report the bias if it matters. ML estimators are biased at finite nn by an amount of order 1/n1/n. Quote it when it is comparable with the standard error, which happens when nn is small or the parametrisation strongly curved.
Example(Locating a lighthouse from fifteen flashes)Original

A beacon lies somewhere on a straight line parallel to a long, straight shore, at a perpendicular distance γ=0.50\gamma = 0.50 km known from a chart, but at an unknown position μ\mu along it. It emits flashes at instants when its beam points in a direction uniformly distributed over all angles. A detector records the position xx at which each flash strikes the shore. If ϕ\phi is the angle of the beam from the perpendicular, uniform on (−π/2,π/2)(-\pi/2,\pi/2), then x=μ+γtan⁡ϕx = \mu + \gamma\tan\phi, and the change of variables of Joint distributions and transformations gives the Cauchy density

p(x∣μ)  =  1π γγ2+(x−μ)2,x∈R.p(x\mid\mu) \;=\; \frac{1}{\pi}\,\frac{\gamma}{\gamma^{2} + (x-\mu)^{2}} , \qquad x \in \mathbb{R} .

Fifteen flashes are recorded, at the positions (in km, in the order observed)

1.41,  2.69,  1.79,  0.62,  0.84,  2.39,  −29.02,  1.99,  1.88,  1.15,  0.84,  0.78,  0.72,  1.11,  1.21.1.41,\ \ 2.69,\ \ 1.79,\ \ 0.62,\ \ 0.84,\ \ 2.39,\ \ -29.02,\ \ 1.99,\ \ 1.88,\ \ 1.15,\ \ 0.84,\ \ 0.78,\ \ 0.72,\ \ 1.11,\ \ 1.21 .

The sample mean is useless. Its value is xˉ=−0.64\bar x = -0.64 km, dragged far from the cluster by the seventh flash, which went out nearly parallel to the shore. This is not bad luck to be averaged away. Grimmett and Stirzaker (Grimmett & Stirzaker (2020), §4.4, paragraph (4.4.7), p. 108) record that the Cauchy law has no moments, and compute (Grimmett & Stirzaker (2020), §7.4, Example (7.4.10), p. 373) the characteristic function of the average of nn independent standard Cauchy variables to be e−∣t∣e^{-|t|}, the characteristic function of one of them (Characteristic functions); writing xi=μ+γzix_i = \mu + \gamma z_i with ziz_i standard carries that statement to the density here, since xˉ=μ+γzˉ\bar x = \mu + \gamma \bar z. The sampling distribution of xˉ\bar x is therefore the same for n=15n=15 as for n=1n=1: taking more data does not improve it at all. The sample median, 1.151.15 km, is far better behaved.

The likelihood. Dropping terms free of μ\mu,

ℓ(μ)  =  −∑i=115ln⁡[γ2+(xi−μ)2],dℓdμ  =  ∑i=1152 (xi−μ)γ2+(xi−μ)2.\ell(\mu) \;=\; -\sum_{i=1}^{15}\ln\bigl[\gamma^{2} + (x_i-\mu)^{2}\bigr] , \qquad \frac{d\ell}{d\mu} \;=\; \sum_{i=1}^{15}\frac{2\,(x_i-\mu)}{\gamma^{2}+(x_i-\mu)^{2}} .

Each term of the score is a bounded, odd function of xi−μx_i - \mu, peaking at ∣xi−μ∣=γ\lvert x_i-\mu\rvert = \gamma and decaying beyond: a distant point exerts less pull than a near one, which is exactly why the method is not fooled by the outlier.

Solving. The score is not algebraic in μ\mu; solve it numerically. Scanning the range covered by the data, it has three roots, at

μ=−28.897,μ=−27.116,μ=1.1628,\mu = -28.897,\qquad \mu = -27.116,\qquad \mu = 1.1628 ,

with log-likelihoods (in the convention above, with the constant dropped) −94.168-94.168, −95.152-95.152 and +2.173+2.173. The first two are the spurious pair that the lone far point manufactures - the case Riley, Hobson and Bence illustrate as several stationary points - and the global maximum is

μ^  =  1.1628 km.\hat\mu \;=\; 1.1628\ \text{km} .

Error bar from the curvature. Differentiating the score,

−d2ℓdμ2  =  ∑i=1152[γ2−(xi−μ)2][γ2+(xi−μ)2]2,-\frac{d^{2}\ell}{d\mu^{2}} \;=\; \sum_{i=1}^{15} \frac{2\bigl[\gamma^{2}-(x_i-\mu)^{2}\bigr]}{\bigl[\gamma^{2}+(x_i-\mu)^{2}\bigr]^{2}} ,

which evaluated at μ^\hat\mu gives 29.586 km−229.586\ \mathrm{km}^{-2}. Hence

σ^μ^  =  (29.586)−1/2  =  0.1838 km,soμ=1.163±0.184 km.\hat\sigma_{\hat\mu} \;=\; (29.586)^{-1/2} \;=\; 0.1838\ \text{km}, \qquad\text{so}\qquad \mu = 1.163 \pm 0.184\ \text{km} .

As a cross-check, the Fisher information of one observation for a Cauchy location parameter is

i(μ)=∫−∞∞[2(x−μ)γ2+(x−μ)2]2p(x∣μ) dx=12γ2,i(\mu) = \int_{-\infty}^{\infty}\left[\frac{2(x-\mu)}{\gamma^{2}+(x-\mu)^{2}}\right]^{2} p(x\mid\mu)\,dx = \frac{1}{2\gamma^{2}} ,

so the Cramer-Rao bound is 2γ2/n=2(0.25)/15=0.03333 km22\gamma^{2}/n = 2(0.25)/15 = 0.03333\ \mathrm{km}^{2}, a standard error of 0.18260.1826 km. Observed curvature and expected information agree to 0.7%0.7\% here. The interval over which ℓ\ell falls by 12\tfrac12 from its peak is [0.986,1.359][0.986, 1.359], that is 1.163−0.177+0.1961.163^{+0.196}_{-0.177}: very nearly symmetric, so the Gaussian approximation is doing no harm at n=15n=15.

How good is the median? The sample median of a Cauchy sample is asymptotically normal about μ\mu with standard deviation πγ/(2n)=0.2028\pi\gamma/(2\sqrt n) = 0.2028 km, so its efficiency in the sense of Estimators and their properties is

e  =  2γ2/nπ2γ2/(4n)  =  8π2  =  0.811.e \;=\; \frac{2\gamma^{2}/n}{\pi^{2}\gamma^{2}/(4n)} \;=\; \frac{8}{\pi^{2}} \;=\; 0.811 .

Robust, simple, and only 19%19\% short of optimal - but the ML estimate is what the data actually support, and it costs one short numerical solve.

Invariance in use. Suppose the quantity wanted is the bearing of the beacon from the detector's origin, θ=arctan⁡(μ/γ)\theta = \arctan(\mu/\gamma). By the invariance property, θ^=arctan⁡(1.1628/0.50)=1.1647\hat\theta = \arctan(1.1628/0.50) = 1.1647 rad =66.73∘= 66.73^{\circ}, and to first order σθ=γ σμ^/(γ2+μ^2)=0.50×0.1838/1.6021=0.0574\sigma_\theta = \gamma\,\sigma_{\hat\mu}/(\gamma^{2}+\hat\mu^{2}) = 0.50\times 0.1838/1.6021 = 0.0574 rad =3.29∘= 3.29^{\circ}. No new maximisation was needed.

The numbers to check are μ^=1.1628\hat\mu = 1.1628, −d2ℓ/dμ2=29.586-d^{2}\ell/d\mu^{2} = 29.586 and σ^μ^=0.1838\hat\sigma_{\hat\mu} = 0.1838.

Application(Fitting models to data in the physical sciences)Original

Weighted averages. The commonest use of the method is also the simplest. For nn independent measurements xix_i of one quantity μ\mu, each Gaussian with its own known standard deviation σi\sigma_i, the log-likelihood is −12∑i(xi−μ)2/σi2-\tfrac12\sum_i (x_i-\mu)^{2}/\sigma_i^{2} up to constants, and the likelihood equation gives the inverse-variance weighted mean

μ^  =  ∑ixi/σi2∑i1/σi2,σ^μ^=(∑iσi−2)−1/2,\hat\mu \;=\; \frac{\sum_i x_i/\sigma_i^{2}}{\sum_i 1/\sigma_i^{2}} , \qquad \hat\sigma_{\hat\mu} = \Bigl(\textstyle\sum_i \sigma_i^{-2}\Bigr)^{-1/2} ,

which is how every table of world-average physical constants is constructed ((Riley, Hobson & Bence (2006), §31.5.1, eq. (31.72), p. 1259)). When the measurements are correlated with known covariance matrix NN, the same calculation gives μ^=(1TN−1x)/(1TN−11)\hat\mu = (\mathbb{1}^{\mathsf T} N^{-1} x)/(\mathbb{1}^{\mathsf T} N^{-1}\mathbb{1}), reducing to the above when NN is diagonal ((Riley, Hobson & Bence (2006), §31.5.1, pp. 1259-1260)).

Least squares. When the model is a curve f(x;a)f(x;a) observed with Gaussian noise, ℓ=−12χ2(a)\ell = -\tfrac12\chi^{2}(a) exactly, so maximising the likelihood is minimising χ2\chi^{2}. That specialisation, together with its matrix solution and its goodness-of-fit test, is Least-squares fitting.

Counting experiments. When the number of events is itself random, the extended likelihood (Riley, Hobson & Bence (2006), §31.5.7, eq. (31.88), p. 1270) multiplies the usual product by a Poisson factor λne−λ/n!\lambda^{n}e^{-\lambda}/n! for the observed count; this is the standard tool for fitting a signal peak over a background in a particle-physics spectrum, where both the shape and the normalisation carry information.

Beyond the Gaussian world. The example of this unit is the pattern for heavy-tailed data generally: in astronomy, in finance and in geophysics, a model whose likelihood penalises far points only logarithmically gives an estimator that is automatically robust, with no explicit outlier rejection. The same likelihood machinery underlies image deconvolution, survival analysis and phylogenetic inference, and, read through Bayes' theorem as in Bayesian inference, it is the bridge to the posterior distributions used throughout modern data analysis.

Method

Least-squares fitting

Adapted

Sets up the linear fitting problem with a known noise covariance, solves it in closed form for the parameters and their full covariance matrix, proves the Gauss-Markov theorem that this is the best linear unbiased estimator whatever the noise distribution, shows that for Gaussian noise the minimised chi-squared has n−Mn-M degrees of freedom, and fits Planck's constant from six photoelectric points as h=(6.615±0.093)×10−34 J sh = (6.615 \pm 0.093)\times10^{-34}\,\mathrm{J\,s} with χ2=2.20\chi^2 = 2.20 on 44 degrees of freedom.

Prerequisites: Orthogonal projection and least squares, Estimators and their properties, Sampling distributions, Maximum likelihood, Singular value decomposition, Quadratic forms and the Rayleigh quotient, Unitary and orthogonal matrices, Spectral theorem for Hermitian matrices, The multivariate normal distribution

Note(What this unit is for)Original

A fit is an estimation problem in disguise. Given points that should lie on a curve of known shape but unknown parameters, and given how noisy each point is, the parameters are to be estimated and their uncertainties quoted. If the noise is Gaussian this is maximum likelihood (Maximum likelihood) and nothing new is needed - except that for a model linear in its parameters the maximisation can be done once and for all, in closed form, giving the parameters and their covariance matrix from one matrix inversion.

Three things make this worth a unit of its own. The closed form is exact, not asymptotic. Its optimality survives the loss of normality: the Gauss-Markov theorem below needs only that the errors have zero mean and the stated covariance. And the minimised value of the objective function is itself a test of whether the model was right, with a distribution known in advance.

Definition(The fitting problem and the chi-squared form)AdaptedAdapted from Riley, Hobson & Bence (2006), §31.6, pp. 1271-1272, and §31.6.1, eqs. (31.92)-(31.94), pp. 1272-1273

Let data be a list of pairs (xi,yi)(x_i, y_i), i=1,…,ni = 1,\dots,n, in which the xix_i are known exactly and each yiy_i carries a measurement error. Assume

yi  =  f(xi;a)+ηi,y_i \;=\; f(x_i; a) + \eta_i ,

where f( ⋅ ;a)f(\,\cdot\,;a) is a function of known form depending on MM unknown parameters a=(a1,…,aM)a = (a_1,\dots,a_M), and the noise vector η=(η1,…,ηn)\eta = (\eta_1,\dots,\eta_n) has zero mean and known covariance matrix

Nij  =  Cov⁡[ηi,ηj],\mathsf{N}_{ij} \;=\; \operatorname{Cov}[\eta_i,\eta_j] ,

assumed symmetric positive definite. (We write nn for the number of data points and N\mathsf{N} for the noise covariance; Riley, Hobson and Bence use the letter NN for both.) The xix_i may be vectors; nothing below changes.

The chi-squared function of the parameters is the quadratic form

χ2(a)  =  (y−f(a))TN−1(y−f(a))  =  ∑i,j=1n[yi−f(xi;a)](N−1)ij[yj−f(xj;a)],\chi^{2}(a) \;=\; \bigl(y - f(a)\bigr)^{\mathsf T}\mathsf{N}^{-1}\bigl(y - f(a)\bigr) \;=\; \sum_{i,j=1}^{n}\bigl[y_i - f(x_i;a)\bigr]\bigl(\mathsf{N}^{-1}\bigr)_{ij}\bigl[y_j - f(x_j;a)\bigr] ,

with f(a)f(a) the column vector of model values f(xi;a)f(x_i;a). When the errors are uncorrelated, N=diag⁡(σ12,…,σn2)\mathsf{N} = \operatorname{diag}(\sigma_1^{2},\dots,\sigma_n^{2}) and this collapses to the familiar weighted sum

χ2(a)  =  ∑i=1n(yi−f(xi;a)σi)2.\chi^{2}(a) \;=\; \sum_{i=1}^{n}\left(\frac{y_i - f(x_i;a)}{\sigma_i}\right)^{2} .

The least-squares estimators a^\hat a are the parameter values minimising χ2\chi^{2}, found in the interior from ∂χ2/∂ai=0\partial\chi^{2}/\partial a_i = 0.

The model is linear in the parameters if

f(x;a)  =  ∑j=1Maj hj(x)f(x;a) \;=\; \sum_{j=1}^{M} a_j\,h_j(x)

for a fixed, linearly independent set of basis functions h1,…,hMh_1,\dots,h_M, which may themselves be arbitrarily non-linear in xx. Collecting their values at the data points into the n×Mn\times M response matrix

Rij  =  hj(xi),R_{ij} \;=\; h_j(x_i) ,

the model vector is f(a)=Raf(a) = Ra and

χ2(a)  =  (y−Ra)TN−1(y−Ra).\chi^{2}(a) \;=\; (y - Ra)^{\mathsf T}\mathsf{N}^{-1}(y - Ra) .

Throughout the statements below, RR is assumed to have rank MM, which requires n≥Mn \ge M and says that no parameter combination leaves the model values at the data points unchanged.

Method(The linear least-squares solution)AdaptedAdapted from Riley, Hobson & Bence (2006), §31.6.1, eqs. (31.95)-(31.99), pp. 1273-1274

For a model linear in its parameters, with RR of rank MM and N\mathsf{N} symmetric positive definite:

  1. χ2\chi^{2} has a unique minimiser, the solution of the normal equations
RTN−1R a^  =  RTN−1y,that isa^  =  (RTN−1R)−1RTN−1y  ≡  Sy.R^{\mathsf T}\mathsf{N}^{-1} R\,\hat a \;=\; R^{\mathsf T}\mathsf{N}^{-1} y , \qquad\text{that is}\qquad \hat a \;=\; \bigl(R^{\mathsf T}\mathsf{N}^{-1}R\bigr)^{-1}R^{\mathsf T}\mathsf{N}^{-1}y \;\equiv\; Sy .
  1. a^\hat a is a linear function of the data and is unbiased, E[a^]=a\mathbb{E}[\hat a] = a, for every aa.
  2. Its covariance matrix is
V  =  Cov⁡[a^i,a^j]  =  S N ST  =  (RTN−1R)−1,V \;=\; \operatorname{Cov}[\hat a_i,\hat a_j] \;=\; S\,\mathsf{N}\,S^{\mathsf T} \;=\; \bigl(R^{\mathsf T}\mathsf{N}^{-1}R\bigr)^{-1} ,

so the matrix inverted to find the parameters already is their covariance matrix. Equivalently V−1=12 ∂2χ2/∂ai∂ajV^{-1} = \tfrac12\,\partial^{2}\chi^{2}/\partial a_i\partial a_j, which is independent of the data. 4. χ2\chi^{2} is exactly quadratic:

χ2(a)  =  χ2(a^)+(a−a^)TV−1(a−a^),\chi^{2}(a) \;=\; \chi^{2}(\hat a) + (a - \hat a)^{\mathsf T}V^{-1}(a-\hat a) ,

with no higher terms, so the surfaces of constant χ2\chi^{2} are the concentric ellipsoids of Quadratic forms and the Rayleigh quotient centred on a^\hat a.

If in addition the noise is Gaussian, η∼N(0,N)\eta \sim N(0,\mathsf{N}) in the sense of The multivariate normal distribution, then L∝exp⁡(−12χ2)L \propto \exp(-\tfrac12\chi^{2}), so the least-squares and maximum-likelihood estimators coincide, V−1V^{-1} is the Fisher matrix of Estimators and their properties, and a^\hat a attains the Cramer-Rao bound exactly, at every nn.

Method(Gauss-Markov)Original

Keep the linear model y=Ra+ηy = Ra + \eta with RR of rank MM, and assume only that

E[η]=0,Cov⁡[η]=N  symmetric positive definite and known.\mathbb{E}[\eta] = 0 , \qquad \operatorname{Cov}[\eta] = \mathsf{N} \ \text{ symmetric positive definite and known.}

No distributional assumption is made. Let a~=Cy\tilde a = Cy be any estimator that is linear in the data and unbiased for every value of aa. Then

Cov⁡[a~]−Cov⁡[a^]  is positive semi-definite,\operatorname{Cov}[\tilde a] - \operatorname{Cov}[\hat a] \ \text{ is positive semi-definite,}

with a^=Sy\hat a = Sy the least-squares estimator. In particular var⁡[a~i]≥var⁡[a^i]=Vii\operatorname{var}[\tilde a_i] \ge \operatorname{var}[\hat a_i] = V_{ii} for each parameter, and the same holds for every linear combination uTau^{\mathsf T}a of the parameters. Equality for all uu forces C=SC = S.

The least-squares estimator is thus the best linear unbiased estimator: among rules of the form "a fixed matrix times the data", it is the one of smallest variance, whatever the law of the noise.

Idea of the proofOriginal

Both statements are one geometric picture.

Whiten the problem. Because N\mathsf{N} is symmetric positive definite it has a symmetric positive definite square root, and dividing through by it turns the weighted form χ2\chi^{2} into an ordinary squared length: with z=N−1/2yz = \mathsf{N}^{-1/2}y and B=N−1/2RB = \mathsf{N}^{-1/2}R,

χ2(a)  =  ∥z−Ba∥2.\chi^{2}(a) \;=\; \lVert z - Ba\rVert^{2} .

Minimising a squared distance from a point to the column space of BB is exactly the problem solved in Orthogonal projection and least squares: the answer is the orthogonal projection of zz onto that space, characterised by the residual being perpendicular to it, which is the normal equations. The covariance then follows because a linear map sends a covariance matrix N\mathsf{N} to SNSTS\mathsf{N}S^{\mathsf T}, and the whitening makes that collapse.

Gauss-Markov is the Pythagorean theorem in the same picture. Any other linear unbiased rule differs from the projection by a matrix that annihilates the model space, so its error splits into the projection error plus an orthogonal piece; the two are uncorrelated, their covariances add, and adding a covariance matrix can only make the total larger.

Finally, the leftover χ2(a^)\chi^{2}(\hat a) is the squared length of the part of zz perpendicular to an MM-dimensional subspace. For Gaussian noise zz is a standard normal vector, whose law is rotation-invariant, so that squared length is a sum of n−Mn-M independent squared standard normals: a chi-squared variable with n−Mn-M degrees of freedom. The MM lost dimensions are the parameters that have been fitted.

Proof(The solution, its covariance, and the Gauss-Markov bound)AdaptedAdapted from Riley, Hobson & Bence (2006), §31.6.1, the gradient (31.95), the solution (31.98) and the covariance (31.99), pp. 1273-1274

Write W=N−1W = \mathsf{N}^{-1}, symmetric positive definite.

Step 1: the gradient. Expanding the quadratic form,

χ2(a)  =  yTWy−2aTRTWy+aTRTWR a,\chi^{2}(a) \;=\; y^{\mathsf T}Wy - 2a^{\mathsf T}R^{\mathsf T}Wy + a^{\mathsf T}R^{\mathsf T}WR\,a ,

where the two cross terms were combined using WT=WW^{\mathsf T} = W. Differentiating in apa_p, only the last two terms contribute, and

∂χ2∂ap  =  −2(RTWy)p+2(RTWR a)p,that is∇χ2  =  −2RTW(y−Ra).\frac{\partial\chi^{2}}{\partial a_p} \;=\; -2\bigl(R^{\mathsf T}Wy\bigr)_p + 2\bigl(R^{\mathsf T}WR\,a\bigr)_p , \qquad\text{that is}\qquad \nabla\chi^{2} \;=\; -2R^{\mathsf T}W(y - Ra) .

Step 2: the normal equations and uniqueness. Setting the gradient to zero gives RTWR a^=RTWyR^{\mathsf T}WR\,\hat a = R^{\mathsf T}Wy. The matrix A=RTWRA = R^{\mathsf T}WR is positive definite: for v≠0v \ne 0, vTAv=(Rv)TW(Rv)>0v^{\mathsf T}Av = (Rv)^{\mathsf T}W(Rv) > 0, because Rv≠0Rv \ne 0 (rank MM, so RR is injective) and WW is positive definite. Both hypotheses are used here, and each separately: rank MM to get Rv≠0Rv\neq0, positive definiteness of N\mathsf{N} to get a strictly positive value. Hence AA is invertible, the stationary point is unique, and since the Hessian ∂2χ2/∂ai∂aj=2Aij\partial^{2}\chi^{2}/\partial a_i\partial a_j = 2A_{ij} is positive definite and constant, χ2\chi^{2} is strictly convex and the stationary point is its global minimum. This gives claim 1 with S=A−1RTWS = A^{-1}R^{\mathsf T}W, and claim 4 is Taylor's theorem for a quadratic, exact because all third derivatives vanish.

Step 3: unbiasedness. a^=Sy=S(Ra+η)=SRa+Sη\hat a = Sy = S(Ra + \eta) = SRa + S\eta, and

SR  =  A−1RTWR  =  A−1A  =  IM,SR \;=\; A^{-1}R^{\mathsf T}WR \;=\; A^{-1}A \;=\; I_M ,

so a^=a+Sη\hat a = a + S\eta and E[a^]=a\mathbb{E}[\hat a] = a, using E[η]=0\mathbb{E}[\eta] = 0. Claim 2.

Step 4: the covariance. From a^−a=Sη\hat a - a = S\eta,

V  =  E[Sη ηTST]  =  S N ST  =  A−1RTW N WRA−1,V \;=\; \mathbb{E}\bigl[S\eta\,\eta^{\mathsf T}S^{\mathsf T}\bigr] \;=\; S\,\mathsf{N}\,S^{\mathsf T} \;=\; A^{-1}R^{\mathsf T}W\,\mathsf{N}\,W R A^{-1} ,

using ST=WRA−1S^{\mathsf T} = W R A^{-1} (AA and WW are symmetric). Since WNW=WW\mathsf{N}W = W, the middle collapses to RTWR=AR^{\mathsf T}WR = A, leaving V=A−1AA−1=A−1V = A^{-1}AA^{-1} = A^{-1}. Claim 3. Note that only E[η]=0\mathbb{E}[\eta] = 0 and Cov⁡[η]=N\operatorname{Cov}[\eta] = \mathsf{N} were used in Steps 3 and 4: no normality.

Step 5: Gauss-Markov. Let a~=Cy\tilde a = Cy be linear and unbiased. Unbiasedness means E[Cy]=CRa=a\mathbb{E}[Cy] = CRa = a for every aa, which forces

CR  =  IM.CR \;=\; I_M .

Put D=C−SD = C - S. Then DR=CR−SR=IM−IM=0DR = CR - SR = I_M - I_M = 0 by Step 3. Now

Cov⁡[a~]  =  CNCT  =  (S+D)N(S+D)T  =  SNST+SNDT+DNST+DNDT.\operatorname{Cov}[\tilde a] \;=\; C\mathsf{N}C^{\mathsf T} \;=\; (S+D)\mathsf{N}(S+D)^{\mathsf T} \;=\; S\mathsf{N}S^{\mathsf T} + S\mathsf{N}D^{\mathsf T} + D\mathsf{N}S^{\mathsf T} + D\mathsf{N}D^{\mathsf T} .

The cross terms vanish: SNDT=A−1RTWNDT=A−1RTDT=A−1(DR)T=0S\mathsf{N}D^{\mathsf T} = A^{-1}R^{\mathsf T}W\mathsf{N}D^{\mathsf T} = A^{-1}R^{\mathsf T}D^{\mathsf T} = A^{-1}(DR)^{\mathsf T} = 0, and the other is its transpose. Hence

Cov⁡[a~]  =  V+D N DT,\operatorname{Cov}[\tilde a] \;=\; V + D\,\mathsf{N}\,D^{\mathsf T} ,

and DNDTD\mathsf{N}D^{\mathsf T} is positive semi-definite, since uTDNDTu=(DTu)TN(DTu)≥0u^{\mathsf T}D\mathsf{N}D^{\mathsf T}u = (D^{\mathsf T}u)^{\mathsf T}\mathsf{N}(D^{\mathsf T}u)\ge 0. That is the claim; taking u=eiu = e_i gives the statement for a single parameter and general uu the statement for a linear combination. Equality for all uu forces DTu=0D^{\mathsf T}u = 0 for all uu, since N\mathsf{N} is positive definite, hence D=0D = 0 and C=SC = S. □\square

Method(The minimised chi-squared is a goodness-of-fit statistic)AdaptedAdapted from Arfken, Weber & Harris (2013), §23.7, eqs. (23.99)-(23.101) and the degrees-of-freedom rule, pp. 1170-1172

Assume in addition that the noise is Gaussian, η∼N(0,N)\eta \sim N(0,\mathsf{N}), and keep RR of rank MM. Then the minimised value

χmin⁡2  =  χ2(a^)  =  (y−Ra^)TN−1(y−Ra^)\chi^{2}_{\min} \;=\; \chi^{2}(\hat a) \;=\; \bigl(y - R\hat a\bigr)^{\mathsf T}\mathsf{N}^{-1}\bigl(y - R\hat a\bigr)

is distributed as χ2(n−M)\chi^{2}(n-M), and is independent of a^\hat a. Hence

E[χmin⁡2]=n−M,var⁡[χmin⁡2]=2(n−M).\mathbb{E}\bigl[\chi^{2}_{\min}\bigr] = n-M , \qquad \operatorname{var}\bigl[\chi^{2}_{\min}\bigr] = 2(n-M) .

Arfken, Weber and Harris state the counting rule in this form: fitting MM parameters to nn points leaves n−Mn - M effective degrees of freedom. A fit is judged by comparing χmin⁡2\chi^{2}_{\min} with n−Mn-M and quoting the upper tail probability Pr⁡(χ2(n−M)>χmin⁡2)\Pr\bigl(\chi^{2}(n-M) > \chi^{2}_{\min}\bigr); a value far above n−Mn-M indicates a wrong model or understated errors, and one far below indicates overstated errors or too many parameters.

If N\mathsf{N} is known only up to an overall scale, N=σ2W\mathsf{N} = \sigma^{2}\mathsf{W} with W\mathsf{W} known and σ\sigma unknown, then a^\hat a is unchanged (the scale cancels in the normal equations),

σ^2  =  χmin⁡2[W] n−M \hat\sigma^{2} \;=\; \frac{\chi^{2}_{\min}\bigl[\mathsf{W}\bigr]}{\,n-M\,}

is an unbiased estimator of σ2\sigma^{2}, where χmin⁡2[W]\chi^{2}_{\min}[\mathsf{W}] is the minimised form computed with W\mathsf{W} in place of N\mathsf{N}, and the covariance estimate is σ^2(RTW−1R)−1\hat\sigma^{2}(R^{\mathsf T}\mathsf{W}^{-1}R)^{-1}. No goodness-of-fit test is then available, because the fit has been used to set the error scale.

Proof(Degrees of freedom)Original

Whiten: let N1/2\mathsf{N}^{1/2} be the symmetric positive definite square root of N\mathsf{N} (it exists by the spectral theorem, Spectral theorem for Hermitian matrices), and set

z  =  N−1/2y,B  =  N−1/2R,ζ  =  N−1/2η.z \;=\; \mathsf{N}^{-1/2}y , \qquad B \;=\; \mathsf{N}^{-1/2}R , \qquad \zeta \;=\; \mathsf{N}^{-1/2}\eta .

Then χ2(a)=∥z−Ba∥2\chi^{2}(a) = \lVert z - Ba\rVert^{2}, z=Ba+ζz = Ba + \zeta, and ζ∼N(0,In)\zeta \sim N(0, I_n): the whitened noise is a standard normal vector, by the affine transformation rule for multivariate normals (The multivariate normal distribution). The matrix BB still has rank MM, since N−1/2\mathsf{N}^{-1/2} is invertible.

Let PP be the orthogonal projection of Rn\mathbb{R}^{n} onto the MM-dimensional column space of BB (Orthogonal projection and least squares). The minimiser of ∥z−Ba∥2\lVert z - Ba\rVert^{2} makes BaBa equal to PzPz, so

χmin⁡2  =  ∥(I−P)z∥2  =  ∥(I−P)ζ∥2,\chi^{2}_{\min} \;=\; \lVert (I-P)z\rVert^{2} \;=\; \lVert (I-P)\zeta\rVert^{2} ,

the second equality because (I−P)Ba=0(I-P)Ba = 0 for every aa, BaBa lying in the range of PP.

Now choose an orthonormal basis of Rn\mathbb{R}^{n} whose first MM vectors span the range of BB and whose last n−Mn-M span its orthogonal complement, and let u=QTζu = Q^{\mathsf T}\zeta be the coordinates of ζ\zeta in that basis, QQ orthogonal. By the rotation invariance of the standard normal law used in Sampling distributions - orthogonal maps preserve ∥⋅∥\lVert\cdot\rVert and have unit Jacobian, so the density (2π)−n/2e−∥u∥2/2(2\pi)^{-n/2}e^{-\lVert u\rVert^{2}/2} is unchanged - the coordinates u1,…,unu_1,\dots,u_n are again independent standard normals. In these coordinates

χmin⁡2  =  ∑k=M+1nuk2,a^−a  =  (BTB)−1BTζ  depends only on u1,…,uM,\chi^{2}_{\min} \;=\; \sum_{k=M+1}^{n}u_k^{2} , \qquad \hat a - a \;=\; (B^{\mathsf T}B)^{-1}B^{\mathsf T}\zeta \ \text{ depends only on } u_1,\dots,u_M ,

the second because BTζ=BTPζB^{\mathsf T}\zeta = B^{\mathsf T}P\zeta (BT(I−P)=0B^{\mathsf T}(I-P) = 0, the columns of BB being in the range of PP). So χmin⁡2\chi^{2}_{\min} is a sum of n−Mn-M independent squared standard normals, that is a χ2(n−M)\chi^{2}(n-M) variable, and it is a function of coordinates independent of those determining a^\hat a. The mean n−Mn-M and variance 2(n−M)2(n-M) are those of the chi-squared law recorded in Sampling distributions.

For the scale-only-unknown case, apply the above with W\mathsf{W} in place of N\mathsf{N}: then χmin⁡2[W]/σ2∼χ2(n−M)\chi^{2}_{\min}[\mathsf{W}]/\sigma^{2} \sim \chi^{2}(n-M), whose mean is n−Mn-M, so σ^2\hat\sigma^{2} is unbiased. □\square

Remark(Where the hypotheses are used)Original

RR of rank MM. Used in Step 2 to invert A=RTN−1RA = R^{\mathsf T}\mathsf{N}^{-1}R. If it fails, some combination of parameters is invisible to the data - fitting a1+a2xa_1 + a_2 x and a3xa_3 x simultaneously, say - and χ2\chi^{2} has a flat valley rather than a minimum point. Near-degeneracy is the practical danger: AA is then ill-conditioned, and the fitted parameters are enormous and anticorrelated while the fitted curve is perfectly well determined. The cure is not a better inversion routine but a better basis. The singular value decomposition of Singular value decomposition diagnoses it (the ratio of largest to smallest singular value of N−1/2R\mathsf{N}^{-1/2}R is the condition number of Matrix norms and condition numbers) and supplies the minimum-norm solution when the rank really is deficient. Riley, Hobson and Bence make the same point for polynomial fitting and recommend replacing 1,x,x2,…1,x,x^{2},\dots by polynomials orthogonal over the data points, which makes AA diagonal.

N\mathsf{N} positive definite and known. Positive definiteness is used in Step 2 and in the equality case of Step 5; it fails if two data points are perfectly correlated, which is a statement that one of them is redundant. That N\mathsf{N} is known is the most often violated assumption in practice: error bars are themselves estimated. When only the scale is unknown, the last paragraph of the statement applies; when the shape is unknown too, nothing here is valid and the problem becomes one of variance estimation.

E[η]=0\mathbb{E}[\eta] = 0. Used in Steps 3 and 5. A systematic offset common to all points is absorbed into any parameter that can imitate it (an intercept) and biases the others; no amount of data removes it, and the quoted VV does not describe it.

The xix_i exact. Assumed throughout. When the abscissae carry the error instead, the roles of the coordinates are exchanged and one fits xx against yy, which gives a different line. When both carry comparable error, Arfken, Weber and Harris (Arfken, Weber & Harris (2013), §23.7, eq. (23.98) and Fig. 23.11, pp. 1169-1170) minimise the sum of squared perpendicular distances instead, parametrising the line by the angle α\alpha it makes with the abscissa and obtaining tan⁡2α=2∑jxjyj/∑j(xj2−yj2)\tan 2\alpha = 2\sum_j x_j y_j / \sum_j (x_j^{2}-y_j^{2}). That estimator is appropriate when the two coordinates are measured with equal precision; it is not the same as either one-sided fit.

Normality. Used only for the identification with maximum likelihood, for the Cramer-Rao statement, and for the distribution of χmin⁡2\chi^{2}_{\min}. It is not used for claims 1-4 nor for Gauss-Markov. This is the practical importance of the Gauss-Markov theorem: a fit remains the best linear unbiased estimate even when the errors are not Gaussian, although its χ2\chi^{2} then has no tabulated distribution and the goodness-of-fit reading is lost.

Linear in the parameters, not in xx. The basis functions may be anything - powers, sinusoids, exponentials with fixed decay rates. Fitting an exponential with an unknown rate is not a linear problem, and Riley, Hobson and Bence (Riley, Hobson & Bence (2006), §31.6.2, pp. 1276-1277) treat that case by Newton iteration on ∇χ2\nabla\chi^{2}, starting from a guess and solving the linear system ∑j(∂2χ2/∂ai∂aj) δaj=−∂χ2/∂ai\sum_j (\partial^{2}\chi^{2}/\partial a_i\partial a_j)\,\delta a_j = -\partial\chi^{2}/\partial a_i repeatedly. Everything above then holds only approximately and locally, and they warn that χ2\chi^{2} may have many local minima, so that the quality of the initial guess decides which one is found.

A difference in how the optimality is stated. Riley, Hobson and Bence (Riley, Hobson & Bence (2006), §31.6.1, p. 1273) write that for a model linear in the parameters the least-squares estimators are unbiased and of minimum variance, whatever the probability density the measurement errors come from. The theorem proved above is the same assertion with one restriction added: minimum-variance among estimators that are linear functions of the data. The restriction cannot be dropped. For heavy-tailed noise a non-linear estimator can beat least squares badly - the lighthouse example of Maximum likelihood is exactly such a case, where the least-squares estimate of a location parameter is the sample mean and is useless, while the maximum-likelihood estimate is not linear in the data and is excellent. This unit follows the restricted statement, which is the one that is true without further assumptions; under normality the two coincide, because then the best linear unbiased estimator is also the best unbiased estimator by the Cramer-Rao argument of claim 4.

Method(Fitting a linear model)Original
  1. Write the model as a basis expansion. Choose h1,…,hMh_1,\dots,h_M with f(x;a)=∑jajhj(x)f(x;a) = \sum_j a_j h_j(x). For a straight line, h1=1h_1 = 1 and h2=xh_2 = x.
  2. Build the response matrix Rij=hj(xi)R_{ij} = h_j(x_i), of size n×Mn\times M, and the noise covariance N\mathsf{N}. For independent errors N−1=diag⁡(w1,…,wn)\mathsf{N}^{-1} = \operatorname{diag}(w_1,\dots,w_n) with weights wi=1/σi2w_i = 1/\sigma_i^{2}.
  3. Form and solve the normal equations. Compute A=RTN−1RA = R^{\mathsf T}\mathsf{N}^{-1}R and b=RTN−1yb = R^{\mathsf T}\mathsf{N}^{-1}y, then solve Aa^=bA\hat a = b by Cholesky factorisation (Solving linear systems numerically), not by forming A−1A^{-1}, unless MM is small. For M=2M = 2 the explicit 2×22\times2 inverse is quicker and is used in the example.
  4. Read off the errors. V=A−1V = A^{-1}; the standard error on a^i\hat a_i is Vii\sqrt{V_{ii}} and the correlation coefficient of a^i\hat a_i with a^j\hat a_j is Vij/ViiVjjV_{ij}/\sqrt{V_{ii}V_{jj}}. Quote the whole matrix, not just the diagonal: the off-diagonal entries are needed by anything downstream, as in Propagation of uncertainty.
  5. Decorrelate if the correlation is large. Replacing xx by x−xˉwx - \bar x_w, where xˉw=∑iwixi/∑iwi\bar x_w = \sum_i w_i x_i/\sum_i w_i is the weighted mean abscissa, makes AA diagonal for a straight line and the two parameters uncorrelated. The fitted line is unchanged; only the parametrisation is.
  6. Test the fit. Compute χmin⁡2\chi^{2}_{\min}, compare with n−Mn-M, and quote the tail probability. Only then believe the error bars.
  7. Confidence regions. For a joint statement about several parameters use the ellipsoid (a−a^)TV−1(a−a^)≤c(a-\hat a)^{\mathsf T}V^{-1}(a-\hat a) \le c, with cc the upper point of a chi-squared distribution with MM degrees of freedom at the wanted level: c=1c = 1 gives the one-parameter one-sigma interval for M=1M=1, while for M=2M=2 a joint 68.3%68.3\% region needs c=2.30c = 2.30. Confidence intervals develops this.
Example(Planck's constant from the photoelectric effect)Original

A caesium-coated photocathode is illuminated with six mercury lines in turn and the retarding voltage VV that just stops the photocurrent is measured for each. Einstein's relation predicts

V  =  he ν−φe,V \;=\; \frac{h}{e}\,\nu - \frac{\varphi}{e} ,

a straight line in the frequency ν\nu whose slope gives h/eh/e and whose intercept gives the work function. Writing x=ν/1014 Hzx = \nu/10^{14}\,\mathrm{Hz}, the data are

xx V/VV/\mathrm{V} σ/V\sigma/\mathrm{V} w=1/σ2w = 1/\sigma^{2}
5.1875.187 0.2580.258 0.0150.015 4444.4444444.444
5.4905.490 0.3610.361 0.0200.020 2500.0002500.000
6.8796.879 0.9510.951 0.0120.012 6944.4446944.444
7.4047.404 1.1401.140 0.0300.030 1111.1111111.111
8.2198.219 1.5151.515 0.0180.018 3086.4203086.420
8.9768.976 1.8051.805 0.0250.025 1600.0001600.000

Here M=2M = 2, with h1=1h_1 = 1 and h2=xh_2 = x, so RR has a column of ones and a column of the xix_i, and N−1=diag⁡(wi)\mathsf{N}^{-1} = \operatorname{diag}(w_i).

The normal matrix. Its entries are weighted sums:

A=RTN−1R=(S0S1S1S2),b=RTN−1y=(T0T1),A = R^{\mathsf T}\mathsf{N}^{-1}R = \begin{pmatrix} S_0 & S_1\\ S_1 & S_2\end{pmatrix}, \qquad b = R^{\mathsf T}\mathsf{N}^{-1}y = \begin{pmatrix} T_0 \\ T_1 \end{pmatrix},

with Sk=∑iwixikS_k = \sum_i w_i x_i^{k} and Tk=∑iwixikyiT_k = \sum_i w_i x_i^{k} y_i. From the table,

S0=19686.420,S1=132504.717,S2=921857.121,S_0 = 19686.420,\quad S_1 = 132504.717,\quad S_2 = 921857.121,T0=17483.926,T1=130065.071,T_0 = 17483.926,\quad T_1 = 130065.071,

and the determinant is

Δ=S0S2−S12=18 148 066 234−17 557 500 103=5.90566×108.\Delta = S_0S_2 - S_1^{2} = 18\,148\,066\,234 - 17\,557\,500\,103 = 5.90566\times10^{8} .

The parameters. Inverting the 2×22\times2 matrix,

m^=S0T1−S1T0Δ=2.43813×1085.90566×108=0.412846 V per 1014 Hz,\hat m = \frac{S_0T_1 - S_1T_0}{\Delta} = \frac{2.43813\times10^{8}}{5.90566\times10^{8}} = 0.412846\ \mathrm{V\,per\,10^{14}\,Hz} ,c^=S2T0−S1T1Δ=−1.11655×1095.90566×108=−1.890650 V.\hat c = \frac{S_2T_0 - S_1T_1}{\Delta} = \frac{-1.11655\times10^{9}}{5.90566\times10^{8}} = -1.890650\ \mathrm{V} .

The covariance matrix is V=A−1=Δ−1(S2−S1−S1S0)V = A^{-1} = \Delta^{-1}\begin{pmatrix} S_2 & -S_1 \\ -S_1 & S_0\end{pmatrix}, so

σc^=S2/Δ=0.039509 V,σm^=S0/Δ=0.005774,\sigma_{\hat c} = \sqrt{S_2/\Delta} = 0.039509\ \mathrm{V}, \qquad \sigma_{\hat m} = \sqrt{S_0/\Delta} = 0.005774 ,Cov⁡[c^,m^]=−S1/Δ=−2.2437×10−4,ρ=−S1S0S2=−0.9836.\operatorname{Cov}[\hat c,\hat m] = -S_1/\Delta = -2.2437\times10^{-4} , \qquad \rho = \frac{-S_1}{\sqrt{S_0S_2}} = -0.9836 .

The two parameters are almost perfectly anticorrelated, because the data sit far from x=0x=0 and a small increase in slope is compensated by a large decrease in intercept. Re-fitting in the variable x−xˉwx - \bar x_w with xˉw=S1/S0=6.7308\bar x_w = S_1/S_0 = 6.7308 makes the correlation exactly zero and the height of the line at that point is determined to σ=1/S0=0.00713 V\sigma = 1/\sqrt{S_0} = 0.00713\,\mathrm{V} - five and a half times better than the intercept at the origin.

Goodness of fit. The fitted values c^+m^xi\hat c + \hat m x_i and the pulls (yi−c^−m^xi)/σi(y_i - \hat c - \hat m x_i)/\sigma_i are

0.2508, 0.3759, 0.9493, 1.1661, 1.5025, 1.8151;0.481, −0.744, 0.140, −0.869, 0.693, −0.402.0.2508,\ 0.3759,\ 0.9493,\ 1.1661,\ 1.5025,\ 1.8151 ; \qquad 0.481,\ -0.744,\ 0.140,\ -0.869,\ 0.693,\ -0.402 .

Squaring and adding the pulls,

χmin⁡2=0.2315+0.5532+0.0196+0.7547+0.4798+0.1618=2.2006\chi^{2}_{\min} = 0.2315+0.5532+0.0196+0.7547+0.4798+0.1618 = 2.2006

on n−M=4n - M = 4 degrees of freedom. The expected value is 44 with standard deviation 8=2.83\sqrt{8}=2.83, and the upper tail is Pr⁡(χ2(4)>2.2006)=0.699\Pr(\chi^{2}(4) > 2.2006) = 0.699: an unremarkable fit, with no sign that the straight line is wrong or that the error bars are mis-stated.

The physics. The slope is h/eh/e in volt-seconds once the 101410^{14} is restored:

he=(4.12846±0.05774)×10−15 V s,\frac{h}{e} = (4.12846 \pm 0.05774)\times10^{-15}\ \mathrm{V\,s} ,h=(6.6145±0.0925)×10−34 J s,h = (6.6145 \pm 0.0925)\times10^{-34}\ \mathrm{J\,s} ,

using e=1.602177×10−19 Ce = 1.602177\times10^{-19}\,\mathrm{C}. The accepted value 6.62607×10−34 J s6.62607\times10^{-34}\,\mathrm{J\,s} lies 0.120.12 standard errors away. The intercept gives the work function φ=−c^=1.891±0.040 eV\varphi = -\hat c = 1.891 \pm 0.040\ \mathrm{eV}, and the threshold frequency is

ν0=−c^/m^=4.5796×1014 Hz(λ0=654.6 nm),\nu_0 = -\hat c/\hat m = 4.5796\times10^{14}\ \mathrm{Hz} \qquad (\lambda_0 = 654.6\ \mathrm{nm}) ,

whose standard error must be computed from the full covariance matrix, since ν0\nu_0 depends on both parameters. With ∂ν0/∂c^=−1/m^\partial\nu_0/\partial \hat c = -1/\hat m and ∂ν0/∂m^=c^/m^2\partial\nu_0/\partial\hat m = \hat c/\hat m^{2}, first-order propagation (Propagation of uncertainty) gives σν0=0.0347×1014 Hz\sigma_{\nu_0} = 0.0347\times10^{14}\,\mathrm{Hz}. Had the correlation been ignored, the two terms would have added instead of largely cancelling and the error would have come out more than three times too large.

The numbers to check are m^=0.412846\hat m = 0.412846, c^=−1.890650\hat c = -1.890650, χmin⁡2=2.2006\chi^{2}_{\min} = 2.2006 on 44 degrees of freedom, and h=6.6145×10−34 J sh = 6.6145\times10^{-34}\,\mathrm{J\,s}.

Application(Calibration, trends, and everything downstream)Original

Calibration curves. Every instrument that converts a reading into a physical quantity carries a fitted calibration, and the covariance matrix of its parameters is what propagates into the uncertainty on every later measurement made with it. Quoting only the diagonal of VV - "slope ±\pm, intercept ±\pm" - loses the anticorrelation and, as the threshold frequency above shows, can inflate a downstream error by a large factor.

Trends in time series. Fitting a straight line to a record of global mean temperature, sea level or station pressure is the same calculation with xx the date. The subtlety is that N\mathsf{N} is then not diagonal: geophysical noise is autocorrelated, as in Autoregressive models and red noise, and treating it as white understates σm^\sigma_{\hat m} badly, sometimes by a factor of several. The machinery above handles it correctly provided the autocovariance is supplied, since nothing in the derivation required N\mathsf{N} to be diagonal.

Orbit and trajectory determination. Fitting six orbital elements to many tracking observations is linear least squares after one linearisation about a reference orbit, iterated as in the non-linear scheme. The same structure, applied recursively as data arrive rather than all at once, is the The Kalman filter, in which VV is updated at each step instead of being computed from scratch.

Model selection and testing. Because χmin⁡2\chi^{2}_{\min} has a known distribution, the difference of the minimised values of two nested models is itself a test statistic: adding a parameter must reduce χ2\chi^{2} by at least about one unit to be worth anything, and the formal version of that statement is the likelihood-ratio test of Hypothesis testing. The same ellipsoids (a−a^)TV−1(a−a^)=c(a-\hat a)^{\mathsf T}V^{-1}(a-\hat a) = c that bound confidence regions are the contours used to display parameter degeneracies in fields from cosmology to pharmacokinetics.

Method

Propagation of uncertainty

Adapted

Gives the first-order rule for the variance of a function of uncertain inputs, in the matrix form VY=SVXSTV_Y = S V_X S^{\mathsf T} that keeps the correlations, says exactly when the rule is exact and when its neglected second-order terms matter, and works two examples ending in g=9.811±0.044 m s−2g = 9.811 \pm 0.044\,\mathrm{m\,s^{-2}} and a predicted-value error of 0.1340.134 that the naive uncorrelated formula overstates by a factor of 3.23.2.

Prerequisites: Expectation, variance and covariance, Taylor expansion and critical points in several variables, Joint distributions and transformations

Note(What the rule is and is not)Original

A measurement is reported as x±σxx \pm \sigma_x, and what is wanted is almost never xx itself but some function of it: a period becomes a frequency, two lengths become an aspect ratio, counts and a live-time become a rate. Propagation of uncertainty answers the question "what is the error bar on the answer?" by one device only: replace the function by its tangent plane at the measured point, and use the exact formula for the variance of a linear combination.

Two consequences are worth stating before any algebra. First, because the device is linearisation, the rule is exact when the function is affine and approximate otherwise, with an error controlled by the curvature of the function over the width of the input distribution. Second, because the exact formula for the variance of a linear combination contains covariances, so does the propagation rule. Dropping them is the commonest error in practice, and this unit's second example shows it inflating an error bar by a factor of 3.23.2.

Definition(Inputs, outputs and the covariance matrix)AdaptedAdapted from Riley, Hobson & Bence (2006), §30.12.3, the definition (30.139) of the covariance matrix and the set-up preceding (30.140), pp. 1203-1205

Let X=(X1,…,Xn)X = (X_1, \dots, X_n) be random variables with finite second moments, means μi=E[Xi]\mu_i = \mathbb{E}[X_i] and covariance matrix VXV_X, the symmetric n×nn \times n matrix with entries

(VX)ij  =  Cov[Xi,Xj]  =  E[(Xi−μi)(Xj−μj)].(V_X)_{ij} \;=\; \mathrm{Cov}[X_i, X_j] \;=\; \mathbb{E}\bigl[(X_i - \mu_i)(X_j - \mu_j)\bigr] .

Its diagonal entries are the variances σi2=V[Xi]\sigma_i^2 = V[X_i], and the standard error (the quoted error bar) on XiX_i is σi\sigma_i. The correlation matrix has entries ρij=(VX)ij/(σiσj)\rho_{ij} = (V_X)_{ij}/(\sigma_i\sigma_j), with unit diagonal. Covariance, correlation and the variance of a linear combination are the subject of Expectation, variance and covariance; VXV_X is symmetric and positive semi-definite because tTVXt=V[∑itiXi]≥0t^{\mathsf T}V_X t = V\bigl[\sum_i t_iX_i\bigr] \ge 0 for every real vector tt.

Let Y=(Y1,…,Ym)Y = (Y_1, \dots, Y_m) with Yk=fk(X1,…,Xn)Y_k = f_k(X_1, \dots, X_n) for functions fkf_k that are differentiable at μ=(μ1,…,μn)\mu = (\mu_1, \dots, \mu_n). The sensitivity matrix (Riley, Hobson and Bence write SS) is the m×nm \times n Jacobian evaluated at the means,

Ski  =  ∂fk∂xi∣x=μ.S_{ki} \;=\; \frac{\partial f_k}{\partial x_i}\bigg|_{x = \mu} .

Throughout, "the error on YkY_k" means V[Yk]\sqrt{V[Y_k]}, and "errors are independent" means VXV_X is diagonal. In an experimental report the mean μi\mu_i is not known and the measured value xix_i is used in its place; the remark below says what that substitution costs.

Method(Linearised propagation of uncertainty)AdaptedAdapted from Riley, Hobson & Bence (2006), §30.12.3, eqs. (30.136)-(30.141), pp. 1203-1205; Arfken, Weber & Harris (2013), §23.7, eqs. (23.88) and (23.91), pp. 1166-1167

Assume:

  • (P1) each XiX_i has finite variance;
  • (P2) each fkf_k is differentiable at μ\mu, with sensitivity matrix SS as above;
  • (P3) the distribution of XX is concentrated near μ\mu in the sense made precise in the remark: the linearisation is a good approximation to fkf_k over the region where XX has its probability.

Then, to first order,

E[Yk]  ≈  fk(μ),Cov[Yk,Yl]  ≈  ∑i=1n∑j=1nSki Slj (VX)ij,\mathbb{E}[Y_k] \;\approx\; f_k(\mu) , \qquad \mathrm{Cov}[Y_k, Y_l] \;\approx\; \sum_{i=1}^{n}\sum_{j=1}^{n} S_{ki}\,S_{lj}\,(V_X)_{ij} ,

which in matrix form is

  VY  =  S VX ST.  \boxed{\;V_Y \;=\; S\,V_X\,S^{\mathsf T} .\;}

For a single output Y=f(X1,…,Xn)Y = f(X_1, \dots, X_n) this reads

V[Y]  ≈  ∑i=1n(∂f∂xi) ⁣2V[Xi]  +  ∑i≠j∂f∂xi∂f∂xj Cov[Xi,Xj],V[Y] \;\approx\; \sum_{i=1}^{n}\left(\frac{\partial f}{\partial x_i}\right)^{\!2} V[X_i] \;+\; \sum_{i \ne j} \frac{\partial f}{\partial x_i}\frac{\partial f}{\partial x_j}\,\mathrm{Cov}[X_i, X_j] ,

all derivatives at x=μx = \mu; for n=2n = 2 this is the formula Riley, Hobson and Bence give as (30.138), and when the XiX_i are uncorrelated the double sum vanishes and only the squared-derivative terms remain, which is Arfken, Weber and Harris's (23.91).

Exactness. If every fkf_k is affine, fk(x)=ck+∑iSkixif_k(x) = c_k + \sum_i S_{ki}x_i, then both relations hold with equality and no hypothesis beyond (P1) is needed. Riley, Hobson and Bence state this for (30.138) and for (30.140).

Idea of the proofOriginal

A smooth function looks like its tangent plane on a small enough neighbourhood, and the variance of an affine function of random variables is a formula we already have exactly. So: expand fkf_k to first order about the means, discard the remainder, and apply the exact formula. The constant term fk(μ)f_k(\mu) carries no variance and drops out; the linear term contributes ∑iSki(Xi−μi)\sum_i S_{ki}(X_i - \mu_i), whose covariance with the corresponding sum for YlY_l is a double sum of covariances weighted by sensitivities. That double sum is the matrix product SVXSTSV_XS^{\mathsf T}. Everything else in this unit is about the discarded remainder: it vanishes identically when fkf_k is affine, and otherwise its size is set by the second derivatives of fkf_k times the variances of the inputs.

ProofAdaptedAdapted from Riley, Hobson & Bence (2006), §30.12.3, the derivation of (30.138) from (30.136) and (30.137), and of (30.140) by the same route, pp. 1203-1205

Step 1 (the exact affine case). Let Z=c+∑iaiXiZ = c + \sum_i a_iX_i and W=d+∑jbjXjW = d + \sum_j b_jX_j with real constants. Bilinearity of the covariance (Expectation, variance and covariance) gives, with no approximation and using only (P1),

E[Z]=c+∑iaiμi,Cov[Z,W]=∑i∑jaibj Cov[Xi,Xj].(1)\mathbb{E}[Z] = c + \sum_i a_i\mu_i , \qquad \mathrm{Cov}[Z, W] = \sum_{i}\sum_{j} a_i b_j\,\mathrm{Cov}[X_i, X_j] . \tag{1}

Taking W=ZW = Z and n=2n = 2 recovers V[aX+bY+c]=a2V[X]+b2V[Y]+2ab Cov[X,Y]V[aX+bY+c] = a^2V[X] + b^2V[Y] + 2ab\,\mathrm{Cov}[X,Y], which is the identity Riley, Hobson and Bence use as their starting point.

Step 2 (linearise). By (P2), Taylor's theorem in several variables (Taylor expansion and critical points in several variables) gives

fk(X)  =  fk(μ)  +  ∑i=1nSki (Xi−μi)  +  Rk(X),(2)f_k(X) \;=\; f_k(\mu) \;+\; \sum_{i=1}^{n} S_{ki}\,(X_i - \mu_i) \;+\; R_k(X) , \tag{2}

where Rk(X)/∥X−μ∥→0R_k(X)/\lVert X - \mu\rVert \to 0 as X→μX \to \mu. Write LkL_k for the affine part, so Yk=Lk+RkY_k = L_k + R_k.

Step 3 (discard the remainder). Hypothesis (P3) is the assumption that RkR_k may be neglected: we replace YkY_k by LkL_k. This is the only approximation in the argument, and it is where (P3) is used. If every fkf_k is affine then Rk≡0R_k \equiv 0 identically and the step is exact.

Step 4 (apply the exact formula). Applying (1) to LkL_k and LlL_l, whose coefficients are ai=Skia_i = S_{ki} and bj=Sljb_j = S_{lj} and whose constants are fk(μ)−∑iSkiμif_k(\mu) - \sum_i S_{ki}\mu_i,

E[Lk]=fk(μ),Cov[Lk,Ll]=∑i∑jSkiSlj Cov[Xi,Xj]=(SVXST)kl,\mathbb{E}[L_k] = f_k(\mu) , \qquad \mathrm{Cov}[L_k, L_l] = \sum_{i}\sum_{j} S_{ki}S_{lj}\,\mathrm{Cov}[X_i, X_j] = \bigl(S V_X S^{\mathsf T}\bigr)_{kl} ,

the last equality being the definition of the matrix product: (SVXST)kl=∑i∑jSki(VX)ij(ST)jl(SV_XS^{\mathsf T})_{kl} = \sum_i\sum_j S_{ki}(V_X)_{ij}(S^{\mathsf T})_{jl} and (ST)jl=Slj(S^{\mathsf T})_{jl} = S_{lj}.

Step 5 (the single-output form). Put m=1m = 1, write ff for f1f_1 and split the double sum into its diagonal and off-diagonal parts, using (VX)ii=V[Xi](V_X)_{ii} = V[X_i]:

V[Y]  ≈  ∑i(∂f∂xi) ⁣2V[Xi]  +  ∑i≠j∂f∂xi∂f∂xjCov[Xi,Xj].V[Y] \;\approx\; \sum_i \left(\frac{\partial f}{\partial x_i}\right)^{\!2}V[X_i] \;+\; \sum_{i\ne j}\frac{\partial f}{\partial x_i}\frac{\partial f}{\partial x_j}\mathrm{Cov}[X_i,X_j] .

The off-diagonal sum runs over ordered pairs, so each unordered pair {i,j}\{i,j\} appears twice and contributes 2 ∂if ∂jf Cov[Xi,Xj]2\,\partial_if\,\partial_jf\,\mathrm{Cov}[X_i,X_j]. □\square

Positive semi-definiteness is inherited. For any real t∈Rmt \in \mathbb{R}^m, tTVYt=(STt)TVX(STt)≥0t^{\mathsf T}V_Yt = (S^{\mathsf T}t)^{\mathsf T}V_X(S^{\mathsf T}t) \ge 0, so VYV_Y is again a legitimate covariance matrix. A propagation scheme that dropped the cross terms would not have this property, and can return a "variance" that is larger than the true one by an arbitrary factor, as the second example shows.

Remark(Where the hypotheses are used, and the size of what was thrown away)Original

(P1) is what makes the question well posed. If an input has no finite variance, the output's error bar is not a number that exists, and the formula returns a finite answer for a quantity that is infinite. The standard trap is a ratio: if XX and YY are independent N(0,1)N(0,1) then X/YX/Y is Cauchy and has no variance at all (Random variables and distributions), yet the rule applied at any point with μY≠0\mu_Y \ne 0 hands back a finite number. The practical version of this is a quotient whose denominator has a non-negligible chance of being near zero.

(P2) is used only at the single point μ\mu. The rule needs no smoothness away from the means — but it needs genuine differentiability there. A function with a kink at μ\mu, such as f(x)=∣x∣f(x) = |x| at μ=0\mu = 0, has no tangent plane and the rule is meaningless: for X∼N(0,σ2)X \sim N(0, \sigma^2) the exact answer is V[∣X∣]=(1−2/π)σ2≈0.363 σ2V[|X|] = (1 - 2/\pi)\sigma^2 \approx 0.363\,\sigma^2, which no choice of derivative reproduces.

(P3) is the real hypothesis, and it is quantitative. Keeping the quadratic term of (2) for a single input gives the two corrections that linearisation discards:

E[Y]  ≈  f(μ)+12f′′(μ) σ2,V[Y]  ≈  f′(μ)2σ2+12f′′(μ)2σ4,\mathbb{E}[Y] \;\approx\; f(\mu) + \tfrac12 f''(\mu)\,\sigma^2 , \qquad V[Y] \;\approx\; f'(\mu)^2\sigma^2 + \tfrac12 f''(\mu)^2\sigma^4 ,

the first of which is the correction 12σ2f′′(xˉ)\tfrac12\sigma^2f''(\bar x) that Arfken, Weber and Harris exhibit in (23.87); in nn variables the bias is 12∑i,j∂i∂jf (VX)ij\tfrac12\sum_{i,j}\partial_i\partial_jf\,(V_X)_{ij}. The ratio of the neglected bias to the propagated error is 12∣f′′∣σ2/∣f′∣σ=12σ ∣f′′/f′∣\tfrac12|f''|\sigma^2 \big/ |f'|\sigma = \tfrac12\sigma\,|f''/f'|, so the linearisation is safe exactly when σ\sigma is small compared with the scale ∣f′/f′′∣|f'/f''| on which the slope of ff changes — not merely small compared with μ\mu.

A case where it fails, with exact numbers. Let X∼N(1,0.52)X \sim N(1, 0.5^2) and Y=X2Y = X^2. Exactly, E[Y]=μ2+σ2=1.25\mathbb{E}[Y] = \mu^2 + \sigma^2 = 1.25 and V[Y]=4μ2σ2+2σ4=1.125V[Y] = 4\mu^2\sigma^2 + 2\sigma^4 = 1.125, so Y=1.25±1.0607Y = 1.25 \pm 1.0607. Linearisation gives f(μ)=1f(\mu) = 1 and ∣f′(μ)∣σ=1.0|f'(\mu)|\sigma = 1.0: the error bar is only 6%6\% low, but the central value is 25%25\% low, and it is low systematically — averaging more experiments will not remove it. Curvature biases the answer before it spoils the error bar.

Dropping the covariances is not conservative. Correlations can either inflate or deflate the output variance, and which one happens depends on the signs of the sensitivities. For Y=X1−X2Y = X_1 - X_2 with equal variances σ2\sigma^2 and correlation ρ\rho, V[Y]=2σ2(1−ρ)V[Y] = 2\sigma^2(1-\rho), which for ρ→1\rho \to 1 tends to zero: a difference of two strongly correlated measurements is far better determined than either. A shared calibration constant produces exactly this, which is why a ratio of two intensities from the same instrument can beat the error bar on each.

Using xx in place of μ\mu. The sensitivities must be evaluated at the unknown μ\mu and in practice are evaluated at the measured xx. The resulting error in SS is itself of first order in X−μX - \mu, so it perturbs VYV_Y at second order — the same order as the terms already discarded, and no worse.

Relative errors for products. If Y=X1p1⋯XnpnY = X_1^{p_1}\cdots X_n^{p_n} with uncorrelated positive inputs, then ∂if/f=pi/μi\partial_i f/f = p_i/\mu_i, and dividing the propagation formula by f(μ)2f(\mu)^2 gives

(σYY) ⁣2  ≈  ∑i=1npi2(σiμi) ⁣2,\left(\frac{\sigma_Y}{Y}\right)^{\!2} \;\approx\; \sum_{i=1}^{n} p_i^2\left(\frac{\sigma_i}{\mu_i}\right)^{\!2} ,

the rule that relative errors add in quadrature with the exponents as weights. The cases C=ABC = AB and C=A/BC = A/B are Arfken, Weber and Harris's Exercise 23.7.1, and the two give the same relative error, since the sign of pp is squared away.

Method(Propagating uncertainty)AdaptedAdapted from Riley, Hobson & Bence (2006), §30.12.3, the route from (30.137) to (30.141), pp. 1203-1205
  1. Write the output as an explicit function of the measured inputs, Yk=fk(x1,…,xn)Y_k = f_k(x_1,\dots,x_n), and collect the inputs' error bars and correlations into the covariance matrix VXV_X. Any quantity measured by the same instrument, read from the same calibration curve, or fitted from the same data set is correlated with its companions until shown otherwise.
  2. Check for curvature and for zeros in denominators. Compare each σi\sigma_i with the scale ∣f′/f′′∣|f'/f''| in that variable (remark above). If they are comparable, or if a denominator can plausibly vanish, stop: linearisation is not applicable and the distribution of YY must be obtained directly, by the change-of-variable formula of Joint distributions and transformations or by Monte Carlo.
  3. Differentiate at the measured point to get Ski=∂fk/∂xiS_{ki} = \partial f_k/\partial x_i, evaluated at xx.
  4. Form VY=SVXSTV_Y = SV_XS^{\mathsf T}. For one output this is the single-output formula; do not drop the cross terms. For several outputs keep the whole matrix, because the outputs are now correlated even if the inputs were not, and anything computed downstream from them will need those correlations.
  5. For a product or quotient of powers, use relative errors and add pi2(σi/μi)2p_i^2(\sigma_i/\mu_i)^2 in quadrature; it is faster and less error-prone than differentiating.
  6. Quote Yk=fk(x)±(VY)kkY_k = f_k(x) \pm \sqrt{(V_Y)_{kk}}, rounding the error to one or two significant figures and the value to the same decimal place. Keep the full VYV_Y if the result will be used further.
  7. Sanity-check. Each term of the sum is a contribution to the error budget; identify the dominant one. If one input dominates by an order of magnitude in variance, the others are irrelevant and improving them is wasted effort.
Example(A pendulum measurement of gg, and which input limits it)Original

A simple pendulum of length LL has small-oscillation period T=2πL/gT = 2\pi\sqrt{L/g}, so

g  =  4π2LT2.g \;=\; \frac{4\pi^2 L}{T^2} .

Measurements: L=1.000±0.002 mL = 1.000 \pm 0.002\ \mathrm{m} (a metre rule read to the nearest millimetre, with the uncertainty dominated by locating the centre of mass of the bob), and the period obtained by timing 2020 swings with a stopwatch, giving T=2.006±0.004 sT = 2.006 \pm 0.004\ \mathrm{s}. The two are measured by different instruments and are taken to be uncorrelated.

Step 1: central value.

g  =  4π2(1.000)(2.006)2  =  39.47844.024036  =  9.8107 m s−2.g \;=\; \frac{4\pi^2 (1.000)}{(2.006)^2} \;=\; \frac{39.4784}{4.024036} \;=\; 9.8107\ \mathrm{m\,s^{-2}} .

Step 2: curvature check. In LL the function is linear, so there is nothing to check. In TT, f∝T−2f \propto T^{-2} gives ∣f′/f′′∣=T/3=0.6687 s|f'/f''| = T/3 = 0.6687\ \mathrm{s}, against σT=0.004 s\sigma_T = 0.004\ \mathrm{s}. The ratio of the neglected bias to the propagated error is 12σT∣f′′/f′∣=0.5×0.004/0.6687=3.0×10−3\tfrac12\sigma_T|f''/f'| = 0.5 \times 0.004/0.6687 = 3.0\times10^{-3}, three parts in a thousand of the error bar, so linearisation is amply safe; in absolute terms the bias is 12f′′σT2=3gσT2/T2=1.2×10−4 m s−2\tfrac12 f''\sigma_T^2 = 3g\sigma_T^2/T^2 = 1.2\times10^{-4}\ \mathrm{m\,s^{-2}}.

Step 3: relative errors. g=4π2L1T−2g = 4\pi^2 L^{1}T^{-2} is a product of powers with pL=1p_L = 1 and pT=−2p_T = -2, so by the rule of the remark

(σgg) ⁣2  =  (σLL) ⁣2+4(σTT) ⁣2  =  (2.000×10−3)2+4 (1.9940×10−3)2.\left(\frac{\sigma_g}{g}\right)^{\!2} \;=\; \left(\frac{\sigma_L}{L}\right)^{\!2} + 4\left(\frac{\sigma_T}{T}\right)^{\!2} \;=\; (2.000\times10^{-3})^2 + 4\,(1.9940\times10^{-3})^2 .

The two contributions are 4.000×10−64.000\times10^{-6} and 1.5904×10−51.5904\times10^{-5}: the timing term is 3.983.98 times the length term, so the measurement is limited by the stopwatch: halving σL\sigma_L would shrink σg\sigma_g only from 4.461×10−3g4.461\times10^{-3}g to 4.111×10−3g4.111\times10^{-3}g, an improvement of 7.8%7.8\%, whereas halving σT\sigma_T would nearly halve it.

Step 4: the answer. σg/g=1.9904×10−5=4.4614×10−3\sigma_g/g = \sqrt{1.9904\times10^{-5}} = 4.4614\times10^{-3}, hence σg=9.8107×4.4614×10−3=0.0438 m s−2\sigma_g = 9.8107 \times 4.4614\times10^{-3} = 0.0438\ \mathrm{m\,s^{-2}}, and

g  =  9.811±0.044 m s−2.g \;=\; 9.811 \pm 0.044\ \mathrm{m\,s^{-2}} .

The standard value is 9.80665 m s−29.80665\ \mathrm{m\,s^{-2}}, so the discrepancy is +0.0041 m s−2+0.0041\ \mathrm{m\,s^{-2}}, or 0.090.09 standard errors: the measurement and the accepted value agree.

Step 5: what to improve. To halve σg\sigma_g one must halve σT\sigma_T, which means timing 4040 swings instead of 2020 at the same reaction-time uncertainty; no improvement in the metre rule will do it.

Example(A correlated pair: predicting from a straight-line fit)Original

Five measurements yiy_i are made at xi=1,2,3,4,5x_i = 1,2,3,4,5, each with independent error σ=0.3\sigma = 0.3, and a straight line y=c+mxy = c + mx is fitted by least squares (Least-squares fitting). With design matrix RR whose rows are (1,xi)(1, x_i) and VX=σ2IV_X = \sigma^2 I, the formula V=(RTN−1R)−1V = (R^{\mathsf T}N^{-1}R)^{-1} gives the covariance matrix of (c^,m^)(\hat c, \hat m):

RTR=(5151555),(RTR)−1=150(55−15−155),R^{\mathsf T}R = \begin{pmatrix} 5 & 15 \\ 15 & 55\end{pmatrix} , \qquad (R^{\mathsf T}R)^{-1} = \frac{1}{50}\begin{pmatrix} 55 & -15 \\ -15 & 5\end{pmatrix} ,V(c^,m^)  =  σ2(RTR)−1  =  (0.0990−0.0270−0.02700.0090).V_{(\hat c,\hat m)} \;=\; \sigma^2 (R^{\mathsf T}R)^{-1} \;=\; \begin{pmatrix} 0.0990 & -0.0270 \\ -0.0270 & 0.0090 \end{pmatrix} .

So σc^=0.3146\sigma_{\hat c} = 0.3146, σm^=0.0949\sigma_{\hat m} = 0.0949, and the correlation is −0.0270/(0.3146×0.0949)=−0.905-0.0270/(0.3146\times0.0949) = -0.905: slope and intercept are strongly anti-correlated, because a fit that is steeper must start lower to keep passing through the middle of the data.

The predicted value at x=3x = 3. Put Y=f(c^,m^)=c^+3m^Y = f(\hat c, \hat m) = \hat c + 3\hat m, an affine function, so the rule is exact. The sensitivity row is S=(1, 3)S = (1, \ 3) and

V[Y]  =  SVST  =  0.0990+9(0.0090)+2(3)(−0.0270)  =  0.0990+0.0810−0.1620  =  0.0180,V[Y] \;=\; S V S^{\mathsf T} \;=\; 0.0990 + 9(0.0090) + 2(3)(-0.0270) \;=\; 0.0990 + 0.0810 - 0.1620 \;=\; 0.0180 ,

giving σY=0.0180=0.1342\sigma_Y = \sqrt{0.0180} = 0.1342.

The check. x=3x = 3 is the mean of the xix_i, and at the centroid a least-squares line is pinned by the sample mean of the yiy_i alone, whose standard error is σ/N=0.3/5=0.13416\sigma/\sqrt{N} = 0.3/\sqrt{5} = 0.13416. The propagated value agrees to all five figures, which it must, since both are exact statements about the same affine function.

What dropping the cross term would have cost. Keeping only the squared-derivative terms gives 0.0990+0.0810=0.18000.0990 + 0.0810 = 0.1800 and σY=0.4243\sigma_Y = 0.4243 — too large by a factor of 3.163.16. An error bar wrong by a factor of three in the safe direction is still wrong: it would hide a real disagreement with a prediction.

The same calculation away from the centroid. At x=6x = 6, one unit beyond the data, V[Y]=0.0990+36(0.0090)+12(−0.0270)=0.0990V[Y] = 0.0990 + 36(0.0090) + 12(-0.0270) = 0.0990 and σY=0.3146\sigma_Y = 0.3146. The cancellation is now only partial, and the extrapolated point is 2.32.3 times less certain than the interpolated one — the quantitative form of the warning against extrapolating a fit.

Application(Error budgets, fitted parameters and filters)Original

The error budget of an experiment. Writing out the terms of ∑i(∂if)2σi2\sum_i (\partial_i f)^2\sigma_i^2 before any data are taken is how an experiment is designed: each term is one line of a budget, and the design effort goes where the budget is largest. The pendulum example is the elementary case; in a precision measurement the same table runs to dozens of lines and separates statistical from systematic entries, the latter being exactly the correlated contributions, since a systematic error is one shared between measurements and therefore carried by an off-diagonal entry of VXV_X.

Fitted parameters and everything computed from them. Riley, Hobson and Bence derive the least-squares covariance matrix V=(RTN−1R)−1V = (R^{\mathsf T}N^{-1}R)^{-1} by applying VY=SVXSTV_Y = SV_XS^{\mathsf T} to the estimator a^=Sy\hat a = Sy, a case in which the function is linear and the rule is therefore exact (Riley, Hobson & Bence (2006), §31.6, eqs. (31.98)-(31.99), pp. 1274-1275). Any quantity derived from fitted parameters — a predicted value, a ratio of amplitudes, an extrapolated intercept — must then be propagated through the full matrix, as the second example does. This is also why fitting codes return a covariance matrix rather than a list of error bars, and why discarding the off-diagonal entries silently corrupts everything downstream. See Least-squares fitting and Maximum likelihood, whose asymptotic covariance is the inverse Fisher matrix.

Linear filters and data assimilation. The forecast step of the Kalman filter is VY=SVXST+QV_Y = SV_XS^{\mathsf T} + Q: the linear propagation law of this unit applied to the model's state-transition matrix, plus the model error. The extended Kalman filter is the same formula with SS the Jacobian of a non-linear model, which is to say it is this unit's approximation, with this unit's failure mode — in a chaotic system the curvature scale ∣f′/f′′∣|f'/f''| shrinks as the forecast lengthens, and the linearised covariance becomes untrustworthy long before the forecast does. The same structure appears in Optimal interpolation and variational data assimilation.

Where the rule is abandoned. When the curvature test of step 2 fails, the modern practice is to sample: draw inputs from their joint distribution, push each draw through ff, and read off the spread of the outputs. That costs nothing in accuracy and is exact in the limit of many draws, and the formula of this unit survives as the thing one checks the sample against.

Method

Confidence intervals

Adapted

Builds interval estimates by the pivotal method, gives the exact normal-sample intervals for a mean (known and unknown variance) and for a variance, says precisely what the confidence level asserts and what it does not, and works nine speed-of-sound readings to μ∈[342.62,344.18] m s−1\mu \in [342.62, 344.18]\,\mathrm{m\,s^{-1}} and σ∈[0.684,1.940] m s−1\sigma \in [0.684, 1.940]\,\mathrm{m\,s^{-1}} at the 95% level.

Prerequisites: Sampling distributions, Estimators and their properties, Random variables and distributions, Expectation, variance and covariance, The central limit theorem

Note(What an interval estimate is for)Original

A point estimate answers the question "what is the value?" and is almost always wrong: a continuous parameter is hit with probability zero. An interval estimate answers the more honest question "what range is consistent with the data, and at what rate does a procedure of this kind succeed?" The machinery for producing such a range is the sampling distribution of Sampling distributions, used backwards. Forwards, it says where the estimator lands when the parameter is known; backwards, it says which parameter values would have made the observed estimate unremarkable.

Everything in this unit is a frequentist construction: the interval is random and the parameter is fixed. The rival construction, in which the parameter is given a distribution and the interval is read off it, is Bayesian inference; the two agree numerically far more often than they agree in meaning.

Definition(Quantiles, and the notation used below)Original

For a random variable with a continuous, strictly increasing distribution function FF and for 0<p<10 < p < 1, the pp-quantile is the unique number qq with F(q)=pF(q) = p. We write

zp=Φ−1(p),tν,p,χν,p2z_p = \Phi^{-1}(p), \qquad t_{\nu,p}, \qquad \chi^{2}_{\nu,p}

for the pp-quantiles of, respectively, the standard normal distribution, Student's tt on ν\nu degrees of freedom and the chi-squared distribution on ν\nu degrees of freedom, all three defined in Sampling distributions. Symmetry of the first two gives z1−p=−zpz_{1-p} = -z_p and tν,1−p=−tν,pt_{\nu,1-p} = -t_{\nu,p}; the chi-squared distribution is not symmetric, and its two tails must be looked up separately. The numbers used below are z0.975=1.95996z_{0.975} = 1.95996, t8,0.975=2.30600t_{8,0.975} = 2.30600, χ8,0.0252=2.17973\chi^{2}_{8,0.025} = 2.17973 and χ8,0.9752=17.53455\chi^{2}_{8,0.975} = 17.53455. Riley, Hobson and Bence tabulate the last two families in their tables 31.3 and 31.2.

Definition(Confidence interval, confidence level, confidence limits)AdaptedAdapted from Riley, Hobson & Bence (2006), §31.3.4, eqs. (31.25)-(31.29) and the naming paragraph, pp. 1235-1237

Let the data xx come from a population depending on one unknown parameter aa, all other parameters being known, and let a^\hat a be an estimator of aa with sampling distribution P(a^∣a)P(\hat a \mid a). Fix two tail probabilities α,β≥0\alpha, \beta \ge 0 with α+β<1\alpha + \beta < 1. For each value of aa, Riley, Hobson and Bence define the two cut points a^α(a)\hat a_\alpha(a) and a^β(a)\hat a_\beta(a) by

Pr⁡(a^<a^α(a)∣a)=α,Pr⁡(a^>a^β(a)∣a)=β,\Pr\bigl(\hat a < \hat a_\alpha(a) \mid a\bigr) = \alpha , \qquad \Pr\bigl(\hat a > \hat a_\beta(a) \mid a\bigr) = \beta ,

so that a^\hat a falls between them with probability 1−α−β1 - \alpha - \beta. Assume both cut points are increasing functions of aa - which is what "a^\hat a estimates aa" ought to mean, and which is needed for the next line. Then, given the observed value a^obs\hat a_{\mathrm{obs}}, the two equations

a^α(a+)=a^obs,a^β(a−)=a^obs\hat a_\alpha(a_+) = \hat a_{\mathrm{obs}} , \qquad \hat a_\beta(a_-) = \hat a_{\mathrm{obs}}

have unique solutions a−a_- and a+a_+, and they satisfy

Pr⁡(a−<a<a+)  =  1−α−β.\Pr(a_- < a < a_+) \;=\; 1 - \alpha - \beta .

The random interval [a−,a+][a_-, a_+] is the confidence interval on aa at confidence level 1−α−β1 - \alpha - \beta (usually quoted as a percentage); a−a_- and a+a_+ are the lower and upper confidence limits. Taking α=β\alpha = \beta gives the central interval; taking β=0\beta = 0, so that only a+a_+ is finite, gives a one-sided interval, which is what an upper or lower bound on a parameter means.

Arfken, Weber and Harris describe the same object less formally, as the range that contains a chosen fraction pp of the probability, reported in the form x=x0±dxx = x_0 \pm dx "with (100p)%(100p)\% confidence", and they name the technique used throughout this unit the pivotal method: relate the unknown to a quantity whose distribution is known and free of unknowns, and read the interval off that.

Method(Exact intervals for a normal sample)AdaptedAdapted from Riley, Hobson & Bence (2006), §31.3.5, eqs. (31.30)-(31.33), pp. 1238-1239; Riley, Hobson & Bence (2006), §31.7.5, eqs. (31.113) and (31.115) and the inversion on p. 1288; Riley, Hobson & Bence (2006), §31.7.6, eq. (31.122) and the equal-tail paragraph, p. 1292; Arfken, Weber & Harris (2013), §23.7, eqs. (23.116)-(23.118) and table 23.3, pp. 1176-1177

Let X1,…,XnX_1, \dots, X_n be independent N(μ,σ2)N(\mu, \sigma^{2}) variables, n≥2n \ge 2, with sample mean X‾\overline X and sample variance S2=(n−1)−1∑i(Xi−X‾)2S^{2} = (n-1)^{-1}\sum_i (X_i - \overline X)^{2}. Fix 0<α<10 < \alpha < 1.

1. Mean, variance known. The interval

[ X‾−z1−α/2σn  ,  X‾+z1−α/2σn ]\left[\, \overline X - z_{1-\alpha/2}\frac{\sigma}{\sqrt n} \;,\; \overline X + z_{1-\alpha/2}\frac{\sigma}{\sqrt n} \,\right]

covers μ\mu with probability exactly 1−α1 - \alpha. More generally, with tails α\alpha and β\beta, the limits are X‾−z1−β σ/n\overline X - z_{1-\beta}\,\sigma/\sqrt n and X‾+z1−α σ/n\overline X + z_{1-\alpha}\,\sigma/\sqrt n.

2. Mean, variance unknown. The interval

[ X‾−tn−1, 1−α/2Sn  ,  X‾+tn−1, 1−α/2Sn ]\left[\, \overline X - t_{n-1,\,1-\alpha/2}\frac{S}{\sqrt n} \;,\; \overline X + t_{n-1,\,1-\alpha/2}\frac{S}{\sqrt n} \,\right]

covers μ\mu with probability exactly 1−α1 - \alpha, for every n≥2n \ge 2 and every value of the unknown σ\sigma.

3. Variance. With a=χn−1, α/22a = \chi^{2}_{n-1,\,\alpha/2} and b=χn−1, 1−α/22b = \chi^{2}_{n-1,\,1-\alpha/2}, the interval

[ (n−1)S2b  ,  (n−1)S2a ]\left[\, \frac{(n-1)S^{2}}{b} \;,\; \frac{(n-1)S^{2}}{a} \,\right]

covers σ2\sigma^{2} with probability exactly 1−α1 - \alpha; taking square roots gives an interval for σ\sigma of the same level.

4. Large samples, any population. If a^\hat a is an estimator whose sampling distribution tends to N(a,σa^2)N(a, \sigma_{\hat a}^{2}) as n→∞n \to \infty - which the central limit theorem of The central limit theorem makes the usual case - then a^±z1−α/2 σa^\hat a \pm z_{1-\alpha/2}\,\sigma_{\hat a} has asymptotic coverage 1−α1 - \alpha, and an estimate σ^a^\hat\sigma_{\hat a} may be substituted for σa^\sigma_{\hat a} when the latter is unknown.

In particular, since z0.8413=1z_{0.8413} = 1, quoting a result as a^±σa^\hat a \pm \sigma_{\hat a} - the physicist's one-sigma error bar - is the central confidence interval at level 1−2(1−0.8413)=0.6831 - 2(1 - 0.8413) = 0.683.

Idea of the proofOriginal

All three exact intervals are one trick applied three times. Find a pivot: a function of the data and of the single unknown parameter whose distribution involves no unknowns at all. Then a probability statement about the pivot can be written down from a table, and because the pivot is monotone in the parameter the statement can be rearranged, with the parameter alone in the middle. The rearrangement is pure algebra; all the probability was spent in the first step.

For the mean with σ\sigma known the pivot is n(X‾−μ)/σ\sqrt n(\overline X - \mu)/\sigma, standard normal. For the mean with σ\sigma unknown, σ\sigma is cancelled by dividing instead by SS, and the pivot becomes Student's tt - this is exactly why the tt distribution was invented. For the variance the pivot is (n−1)S2/σ2(n-1)S^{2}/\sigma^{2}, chi-squared; being a decreasing function of σ2\sigma^{2}, it inverts with the two tails exchanged.

Proof(The three exact intervals)AdaptedAdapted from Riley, Hobson & Bence (2006), §31.3.5, the inversion (31.31)-(31.32), p. 1238, and §31.7.5, the inversion of the two-tailed $t$-test, p. 1288; Riley, Hobson & Bence (2006), §31.7.6, eq. (31.122) and the equal-tail paragraph, p. 1292, inverted here by the same route

Throughout we use the two facts proved in Sampling distributions for a normal sample: X‾∼N(μ,σ2/n)\overline X \sim N(\mu, \sigma^{2}/n), and X‾\overline X and S2S^{2} are independent with (n−1)S2/σ2∼χ2(n−1)(n-1)S^{2}/\sigma^{2} \sim \chi^{2}(n-1).

1. Mean, variance known. Standardising the sample mean,

Z=X‾−μσ/n∼N(0,1),Z = \frac{\overline X - \mu}{\sigma/\sqrt n} \sim N(0,1) ,

and ZZ is a pivot: it contains the unknown μ\mu and nothing else unknown. By the definition of the quantiles and the symmetry zα/2=−z1−α/2z_{\alpha/2} = -z_{1-\alpha/2},

Pr⁡(−z1−α/2≤Z≤z1−α/2)=1−α.\Pr\bigl(-z_{1-\alpha/2} \le Z \le z_{1-\alpha/2}\bigr) = 1 - \alpha .

Multiplying through by σ/n>0\sigma/\sqrt n > 0 and subtracting X‾\overline X reverses the inequalities and gives, after a change of sign, the event X‾−z1−α/2σ/n≤μ≤X‾+z1−α/2σ/n\overline X - z_{1-\alpha/2}\sigma/\sqrt n \le \mu \le \overline X + z_{1-\alpha/2}\sigma/\sqrt n. The two events are the same event, so they have the same probability. The unequal-tail version is the same computation with z1−αz_{1-\alpha} and z1−βz_{1-\beta} in the two places.

2. Mean, variance unknown. Write

T=X‾−μS/n=(X‾−μ)/(σ/n)[(n−1)S2/σ2]/(n−1),T = \frac{\overline X - \mu}{S/\sqrt n} = \frac{(\overline X - \mu)/(\sigma/\sqrt n)}{\sqrt{\bigl[(n-1)S^{2}/\sigma^{2}\bigr]/(n-1)}} ,

where the second form is obtained by dividing numerator and denominator by σ\sigma. The numerator is N(0,1)N(0,1) and the quantity in the square root is χ2(n−1)/(n−1)\chi^{2}(n-1)/(n-1); the independence of X‾\overline X and S2S^{2} is what allows the definition of Student's tt to be applied, and it gives T∼t(n−1)T \sim t(n-1). Note that σ\sigma has cancelled: TT is a pivot even though σ\sigma is unknown. Now repeat step 1 with tn−1,1−α/2t_{n-1,1-\alpha/2} in place of z1−α/2z_{1-\alpha/2} and SS in place of σ\sigma.

3. Variance. Put W=(n−1)S2/σ2∼χ2(n−1)W = (n-1)S^{2}/\sigma^{2} \sim \chi^{2}(n-1), again a pivot. By the definition of aa and bb as the α/2\alpha/2 and 1−α/21 - \alpha/2 quantiles, the two tails each carry probability α/2\alpha/2, so

Pr⁡(a≤W≤b)=1−α.\Pr(a \le W \le b) = 1 - \alpha .

Since S2>0S^{2} > 0 with probability one (the sample values are almost surely not all equal, because the normal distribution is continuous) and a>0a > 0, each of the two inequalities may be solved for σ2\sigma^{2}:

a≤(n−1)S2σ2  ⟺  σ2≤(n−1)S2a,(n−1)S2σ2≤b  ⟺  (n−1)S2b≤σ2.a \le \frac{(n-1)S^{2}}{\sigma^{2}} \iff \sigma^{2} \le \frac{(n-1)S^{2}}{a} , \qquad \frac{(n-1)S^{2}}{\sigma^{2}} \le b \iff \frac{(n-1)S^{2}}{b} \le \sigma^{2} .

Taking the two together converts the event {a≤W≤b}\{a \le W \le b\} into the event that σ2\sigma^{2} lies in the stated interval, and the probability is unchanged. The map σ↦σ2\sigma \mapsto \sigma^{2} is increasing on (0,∞)(0,\infty), so taking square roots of the endpoints gives an interval for σ\sigma with the same coverage.

4. Large samples. By hypothesis (a^−a)/σa^(\hat a - a)/\sigma_{\hat a} converges in distribution to N(0,1)N(0,1), so the probability of the event in step 1 converges to 1−α1 - \alpha; the conclusion is asymptotic, not exact. □\square

Remark(Where the hypotheses are used, and what fails without them)Original

Monotonicity of a^α\hat a_\alpha and a^β\hat a_\beta in aa is what makes a−a_- and a+a_+ well defined in the general construction. Without it the set of parameter values consistent with the data need not be an interval at all, and the honest output of the procedure is that set rather than a pair of limits.

Independence of X‾\overline X and S2S^{2} is used once, in step 2, and it is special to the normal distribution: it is equivalent to normality for a sample of size n≥2n \ge 2 from a non-degenerate distribution with finite variance. If the parent is not normal, TT is not tt-distributed and the interval is only approximate.

Normality is cheap for interval 2 and expensive for interval 3. For the mean, the central limit theorem rescues the construction: n(X‾−μ)/S\sqrt n(\overline X - \mu)/S tends to N(0,1)N(0,1) for any parent with finite variance, and since tν,p→zpt_{\nu,p} \to z_p the tt interval is asymptotically correct whatever the parent. For the variance there is no such rescue. Applying the central limit theorem to the variables (Xi−μ)2(X_i - \mu)^{2} gives n (S2−σ2)→N(0,μ4−σ4)\sqrt n\,(S^{2} - \sigma^{2}) \to N(0, \mu_4 - \sigma^{4}), where μ4\mu_4 is the fourth central moment of the parent, whereas the chi-squared calibration presumes the normal value μ4=3σ4\mu_4 = 3\sigma^{4}, that is an asymptotic variance 2σ42\sigma^{4}. For an exponential parent μ4=9σ4\mu_4 = 9\sigma^{4}, so the true standard deviation of n (S2−σ2)\sqrt n\,(S^{2} - \sigma^{2}) is 8σ4=22 σ2\sqrt{8\sigma^{4}} = 2\sqrt{2}\,\sigma^{2} against the assumed 2 σ2\sqrt{2}\,\sigma^{2}: the interval is too short by a factor of two, and its coverage tends to

2Φ ⁣(1.959962)−1=2(0.83645)−1=0.6729,2\Phi\!\left(\frac{1.95996}{2}\right) - 1 = 2(0.83645) - 1 = 0.6729 ,

not 0.950.95, however large nn is. A nominal 95% interval for a variance is worth little unless normality has been checked.

Independence of the observations is used in every step, through the sampling distributions. Positively correlated data - successive readings of a drifting instrument, or a time series - make S2S^{2} underestimate the variance of X‾\overline X, and all the intervals above come out too narrow. The repair is to replace nn by an effective sample size computed from the autocorrelation; see Stationary processes and spectral densities.

One parameter at a time. Intervals 2 and 3 are each exact for their own parameter; the rectangle formed by taking both at level 1−α1-\alpha is not a 1−α1-\alpha region for the pair (μ,σ2)(\mu, \sigma^{2}). For several parameters at once, Riley, Hobson and Bence construct a region bounded by the ellipsoid Q(a,a^obs)=cQ(a, \hat a_{\mathrm{obs}}) = c, where Q(a^,a)=(a^−a)TV−1(a^−a)Q(\hat a, a) = (\hat a - a)^{\mathsf T}V^{-1}(\hat a - a) is the quadratic form of the large-sample multivariate Gaussian and cc is the 1−α1-\alpha quantile of χM2\chi^{2}_{M} for MM parameters.

Remark(What the confidence level says, and what it does not)AdaptedAdapted from Riley, Hobson & Bence (2006), §31.3.4, the paragraph emphasising that $a_-$ and $a_+$ are random variables, p. 1237; Arfken, Weber & Harris (2013), §23.7, the closing observations of Example 23.7.3, p. 1178

The probability statement is about the interval, not about the parameter. Riley, Hobson and Bence put the emphasis exactly there: a−a_- and a+a_+ are random variables, and the content of "95% confidence" is that if a large number of samples of the same size were drawn and the interval computed each time, the true value would lie inside on 95% of those occasions. Once numbers are substituted, [342.62,344.18][342.62, 344.18] either contains the true speed of sound or does not; there is no 95% left in it. A sentence of the form "there is a 95% probability that μ\mu lies in this interval" is a statement about a posterior distribution for μ\mu, and needs the prior of Bayesian inference before it means anything.

Three practical corollaries, the first two of which Arfken, Weber and Harris stress:

  • A higher level buys a wider interval. The level is chosen, not discovered; quoting the level without the interval, or the interval without the level, is meaningless.
  • The interval is itself sample-dependent. Another sample from the same population gives different endpoints and a different width, the width varying because SS does.
  • Coverage is coverage under the assumed model. A confidence interval answers for statistical fluctuation only. A miscalibrated instrument shifts every sample the same way, and no amount of data narrows that error; systematic uncertainties are estimated and reported separately.
Remark(Three ways the tt interval is written, and which we follow)AdaptedAdapted from Riley, Hobson & Bence (2006), §31.7.5, eqs. (31.113) and (31.115) and the confidence interval displayed on p. 1288; Arfken, Weber & Harris (2013), §23.7, eqs. (23.95), (23.116)-(23.118) and Example 23.7.3, pp. 1168, 1176-1178

The half-width of interval 2 is written differently by our two sources, because they use different symbols for the sample spread, and the reader who mixes them will get the wrong number.

  • This unit uses S2=(n−1)−1∑i(Xi−X‾)2S^{2} = (n-1)^{-1}\sum_i(X_i-\overline X)^{2} and the half-width tn−1,1−α/2 S/nt_{n-1,1-\alpha/2}\,S/\sqrt n.
  • Riley, Hobson and Bence use s2=n−1∑i(Xi−X‾)2s^{2} = n^{-1}\sum_i(X_i-\overline X)^{2}, define t=(xˉ−μ0)/(s/N−1)t = (\bar x - \mu_0)/\bigl(s/\sqrt{N-1}\bigr) in their eq. (31.113), and invert it into xˉ±tcrit s/N−1\bar x \pm t_{\mathrm{crit}}\,s/\sqrt{N-1}. Since s/N−1=S/Ns/\sqrt{N-1} = S/\sqrt N identically, this is the same interval as ours, written in the other convention for the sample variance; their own eq. (31.115) says as much, giving t=(xˉ−μ0)/(σ^/N)t = (\bar x - \mu_0)/(\hat\sigma/\sqrt N) with σ^2=Ns2/(N−1)=S2\hat\sigma^{2} = Ns^{2}/(N-1) = S^{2}.
  • Arfken, Weber and Harris take σ\sigma to be the sample standard deviation with divisor n−1n-1, as in their eq. (23.95), and write the interval through eq. (23.118) as μ=xˉ−Tσ/n\mu = \bar x - T\sigma/\sqrt n. In their Example 23.7.3 the six readings are treated with n=5n = 5, the number of degrees of freedom, in both the divisor of σ2\sigma^{2} and the n\sqrt n of the half-width, which yields 5.885±1.7205.885 \pm 1.720 at the 90% level. Our rule applied to their numbers divides by 6\sqrt 6 instead and gives 5.885±1.5705.885 \pm 1.570.

We follow Riley, Hobson and Bence: the degrees of freedom n−1n-1 fix which tt distribution is used, and the sample size nn fixes the standard error S/nS/\sqrt n. The difference is recorded in the handbook's list of source discrepancies and is not a defect of either book's statement of the tt density, on which they agree.

Method(Constructing an interval by the pivotal method)Original
  1. Write down the model and identify the single unknown parameter θ\theta the interval is for; everything else must be known or eliminated.
  2. Find a pivot G(data,θ)G(\text{data}, \theta) whose distribution is completely known - free of θ\theta and of every nuisance parameter. For normal samples use the table in the statement above; otherwise the sampling distribution of Sampling distributions or the large-sample normal approximation of item 4 is the place to look.
  3. Choose the level 1−α1-\alpha and the split of the tails. Equal tails, α/2\alpha/2 each, is the default; put the whole of α\alpha in one tail if what is wanted is a bound rather than a range.
  4. Look up the two quantiles of the pivot's distribution and write the bracketing statement Pr⁡(qα/2≤G≤q1−α/2)=1−α\Pr(q_{\alpha/2} \le G \le q_{1-\alpha/2}) = 1-\alpha.
  5. Solve both inequalities for θ\theta, reversing them if the pivot decreases in θ\theta. The result is the interval.
  6. Substitute the observed numbers, and report the level, the interval and the model assumed. Check the arithmetic by confirming that the point estimate lies inside.
Example(Nine readings of the speed of sound)Original

A student measures the speed of sound in air at 20 ∘C20\,^\circ\mathrm{C} by timing a pulse over a fixed baseline, nine times, and obtains (in m s−1\mathrm{m\,s^{-1}})

342.6,  344.1,  343.2,  341.8,  345.0,  342.9,  343.7,  344.5,  342.8.342.6,\; 344.1,\; 343.2,\; 341.8,\; 345.0,\; 342.9,\; 343.7,\; 344.5,\; 342.8 .

Take the readings to be independent and normally distributed about the true value μ\mu with unknown standard deviation σ\sigma. Find 95% central confidence intervals for μ\mu and for σ\sigma.

Step 1: the summary statistics. The nine values sum to 3090.63090.6, so

x‾=3090.69=343.400.\overline x = \frac{3090.6}{9} = 343.400 .

The deviations xi−x‾x_i - \overline x are

−0.8,  0.7,  −0.2,  −1.6,  1.6,  −0.5,  0.3,  1.1,  −0.6,-0.8,\; 0.7,\; -0.2,\; -1.6,\; 1.6,\; -0.5,\; 0.3,\; 1.1,\; -0.6 ,

which sum to zero, as they must. Their squares sum to

∑i(xi−x‾)2=0.64+0.49+0.04+2.56+2.56+0.25+0.09+1.21+0.36=8.20,\sum_i (x_i - \overline x)^{2} = 0.64 + 0.49 + 0.04 + 2.56 + 2.56 + 0.25 + 0.09 + 1.21 + 0.36 = 8.20 ,

so s2=8.20/8=1.025s^{2} = 8.20/8 = 1.025 and s=1.01242s = 1.01242. The standard error of the mean is s/9=1.01242/3=0.337474s/\sqrt 9 = 1.01242/3 = 0.337474.

Step 2: the interval for μ\mu. Here σ\sigma is unknown, so the pivot is T=(X‾−μ)/(S/9)∼t(8)T = (\overline X - \mu)/(S/\sqrt 9) \sim t(8). With α=0.05\alpha = 0.05 the quantile is t8,0.975=2.30600t_{8,0.975} = 2.30600, and the half-width is

2.30600×0.337474=0.778217.2.30600 \times 0.337474 = 0.778217 .

Hence the 95% central confidence interval for μ\mu is

343.400±0.778=[ 342.622,  344.178 ] m s−1.343.400 \pm 0.778 = [\,342.622,\; 344.178\,]\ \mathrm{m\,s^{-1}} .

Step 3: the interval for σ\sigma. The pivot is W=8S2/σ2∼χ2(8)W = 8S^{2}/\sigma^{2} \sim \chi^{2}(8), and the quantiles are a=χ8,0.0252=2.17973a = \chi^{2}_{8,0.025} = 2.17973 and b=χ8,0.9752=17.53455b = \chi^{2}_{8,0.975} = 17.53455. With ∑i(xi−x‾)2=8.20\sum_i (x_i - \overline x)^{2} = 8.20,

8.2017.53455=0.467648,8.202.17973=3.761933,\frac{8.20}{17.53455} = 0.467648 , \qquad \frac{8.20}{2.17973} = 3.761933 ,

so the 95% interval for σ2\sigma^{2} is [0.4676,  3.7619] m2 s−2[0.4676,\; 3.7619]\ \mathrm{m^{2}\,s^{-2}} and, on taking square roots,

σ∈[ 0.684,  1.940 ] m s−1.\sigma \in [\,0.684,\; 1.940\,]\ \mathrm{m\,s^{-1}} .

Step 4: read the answers. The interval for μ\mu is nearly symmetric about the estimate, as the tt distribution is symmetric; the interval for σ\sigma is strongly asymmetric about s=1.012s = 1.012, running from two thirds of it to nearly twice it. Nine readings pin a mean to a fraction of a metre per second and pin a standard deviation hardly at all - the familiar fact that variances need far more data than means. For comparison, had σ=1.000\sigma = 1.000 been known in advance, interval 1 would have given 343.400±1.95996/3=343.400±0.653343.400 \pm 1.95996/3 = 343.400 \pm 0.653, narrower than the tt interval because nothing had to be spent estimating the spread. The accepted value 343.2 m s−1343.2\ \mathrm{m\,s^{-1}} at 20 ∘C20\,^\circ\mathrm{C} lies inside the interval for μ\mu.

Application(Error bars, tolerances and detection limits)Original

The error bar on a plot. A point drawn as y±σyy \pm \sigma_y is a 68.3% central confidence interval, by the calculation in the statement above. This is why error bars from different fields can be compared at all, and why a paper that draws two-sigma bars must say so: the same picture then means 95.4%.

Tolerance and qualification. A supplier of resistors claims a spread no worse than some σmax⁡\sigma_{\max}. The quantity under test is a variance, so the relevant object is interval 3, or rather its one-sided version: the upper confidence limit (n−1)S2/χn−1,α2\sqrt{(n-1)S^{2}/\chi^{2}_{n-1,\alpha}} is the number that may honestly be quoted as a bound on σ\sigma at level 1−α1-\alpha. The strong asymmetry seen in the worked example is why qualification tests need large batches.

Detection limits and upper bounds. When an experiment sees no signal, the result is reported as a one-sided interval: the 90% or 95% upper confidence limit on the rate or cross-section. Half a century of particle-physics and astroparticle limits are exactly this construction, with the Poisson rather than the normal sampling distribution.

Trends in geophysical records. A fitted trend in a temperature or sea-level series is reported with a confidence interval obtained from the fit of Least-squares fitting. Because the residuals of such a series are autocorrelated rather than independent, the effective sample size is much smaller than the number of months in the record, and an interval computed as if the data were independent is the standard way to overstate the significance of a trend.

Method

Hypothesis testing

Adapted

Sets up null and alternative hypotheses, rejection regions, significance, power and the pp-value, proves the Neyman-Pearson lemma, derives Student's tt-test as a generalised likelihood-ratio test and gives the chi-squared goodness-of-fit test, with eight dark-current readings giving t=3.000t = 3.000 and p=0.0199p = 0.0199 and five count bins giving χ2=4.625\chi^{2} = 4.625 on four degrees of freedom.

Prerequisites: Confidence intervals, Sampling distributions, Maximum likelihood, Least-squares fitting, The central limit theorem

Note(What a test is, and what it is not)Original

An interval estimate reports a range. A test answers a question with two allowed answers. The machinery is the same - a statistic, its sampling distribution, a tail probability - but the logic is deliberately asymmetric, and reading a test as though it were symmetric is the commonest misuse of statistics in the physical sciences.

The asymmetry is this. One hypothesis, the null, is specific enough to pin down the distribution of the data, so the behaviour of any statistic under the null can be computed. The test then asks a single question: is what we saw unremarkable under the null? If it is not, the null is rejected. If it is, nothing whatever has been proved - the data are merely consistent with the null, as they may also be with a hundred other hypotheses that were never considered. Arfken, Weber and Harris define a statistical hypothesis as any assumption about an unknown probability distribution, and that is all a null hypothesis ever is: an assumption put up to be knocked down.

Definition(Hypotheses, test statistic, rejection region, significance and power)AdaptedAdapted from Riley, Hobson & Bence (2006), §31.7.1, p. 1278, and §31.7.2, pp. 1278-1280

A hypothesis about data xx specifies, in whole or in part, the distribution from which xx was drawn. It is simple if it determines that distribution uniquely, and composite if it fixes the functional form but leaves one or more parameters free. The hypothesis to be tested is the null hypothesis H0H_0, and the alternative H1H_1 is its complement within a hypothesis space fixed in advance, so that rejecting one is accepting the other. For a normal sample of known variance, H0:μ=0H_0 : \mu = 0 is simple and the alternative H1:μ≠0H_1 : \mu \neq 0 is composite; if it were known beforehand that μ\mu is either 00 or 11, then H1:μ=1H_1 : \mu = 1 would be simple as well.

Take H0H_0 simple. A test statistic is a scalar function t(x)t(x) of the data; since H0H_0 fixes the distribution of xx, the sampling distribution P(t∣H0)P(t \mid H_0) can in principle be computed. A rejection region (or critical region) is a set of values of tt carrying probability α\alpha under H0H_0:

Pr⁡(t∈R∣H0)=α.\Pr\bigl(t \in \mathcal{R} \mid H_0\bigr) = \alpha .

It is one-tailed if it is of the form t>tcritt > t_{\mathrm{crit}} or t<tcritt < t_{\mathrm{crit}}, and two-tailed if it consists of both extremes. If the observed tt falls in R\mathcal{R}, then H0H_0 is rejected at significance level α\alpha; otherwise it is accepted at that level. The complement of R\mathcal{R} is the acceptance region.

Two things can go wrong.

  • An error of the first kind is rejecting H0H_0 when it is true. Its probability is α\alpha, by construction; the significance level is the first-kind error rate.
  • An error of the second kind is accepting H0H_0 when it is false. Its probability is β=Pr⁡(t∉R∣H1)\beta = \Pr(t \notin \mathcal{R} \mid H_1), which can only be computed when H1H_1 is simple enough to determine P(t∣H1)P(t \mid H_1). The quantity 1−β1 - \beta is the power of the test: the probability of rejecting H0H_0 when the particular alternative is true.

Choosing α\alpha small makes false alarms rare and misses common. The two rates trade off against each other at fixed sample size, and only more data improves both.

Definition(The pp-value)Original

None of our sources uses the term, so we define it here in terms of theirs. Suppose the rejection region is the upper tail t>tcritt > t_{\mathrm{crit}}, with tcritt_{\mathrm{crit}} a decreasing function of α\alpha. Let tobst_{\mathrm{obs}} be the observed value. The pp-value is

p  =  Pr⁡(t≥tobs∣H0),p \;=\; \Pr\bigl(t \ge t_{\mathrm{obs}} \mid H_0\bigr) ,

the probability, computed under the null, of a result at least as extreme as the one obtained. For a two-tailed region symmetric about zero the definition reads p=Pr⁡(∣t∣≥∣tobs∣∣H0)p = \Pr(|t| \ge |t_{\mathrm{obs}}| \mid H_0).

Its meaning is a matter of bookkeeping: H0H_0 is rejected at level α\alpha precisely when p≤αp \le \alpha, so pp is the smallest significance level at which the data reject the null. Reporting pp therefore reports the outcome of the test at every level at once, which is why it is preferred to the bare verdict "rejected at 5%". It is emphatically not the probability that H0H_0 is true: that number does not exist until a prior is supplied, as in Bayesian inference.

Method(The Neyman-Pearson lemma)AdaptedAdapted from Riley, Hobson & Bence (2006), §31.7.3, eqs. (31.107)-(31.108), p. 1280

Let H0H_0 and H1H_1 both be simple, with densities P0P_0 and P1P_1 for the data xx. Fix a constant c>0c > 0 and let

Rc  =  { x:P0(x)<c P1(x) },\mathcal{R}_c \;=\; \bigl\{\, x : P_0(x) < c\,P_1(x) \,\bigr\} ,

and suppose cc is chosen so that Pr⁡(x∈Rc∣H0)=α\Pr(x \in \mathcal{R}_c \mid H_0) = \alpha and the boundary set {P0=cP1}\{P_0 = cP_1\} has probability zero under both hypotheses. Then Rc\mathcal{R}_c has the greatest power among all rejection regions of size at most α\alpha: for every region R′\mathcal{R}' with Pr⁡(R′∣H0)≤α\Pr(\mathcal{R}' \mid H_0) \le \alpha,

Pr⁡(Rc∣H1)  ≥  Pr⁡(R′∣H1).\Pr\bigl(\mathcal{R}_c \mid H_1\bigr) \;\ge\; \Pr\bigl(\mathcal{R}' \mid H_1\bigr) .

Equivalently, the best scalar test statistic is the likelihood ratio

Λ(x)  =  P0(x)P1(x),\Lambda(x) \;=\; \frac{P_0(x)}{P_1(x)} ,

with rejection region Λ<Λcrit\Lambda < \Lambda_{\mathrm{crit}}. Any monotonically increasing function u=f(Λ)u = f(\Lambda) serves equally well, with region u<f(Λcrit)u < f(\Lambda_{\mathrm{crit}}); any monotonically decreasing v=g(Λ)v = g(\Lambda) serves with the region reversed, v>g(Λcrit)v > g(\Lambda_{\mathrm{crit}}). This is the form in which the lemma is used, because a monotone rewriting usually turns Λ\Lambda into a statistic whose distribution is tabulated.

Riley, Hobson and Bence state the lemma without proof and give the best statistic as Λ\Lambda with rejection region Λ<Λcrit\Lambda < \Lambda_{\mathrm{crit}}, which is the version above and the one used in all their worked examples. Their accompanying inequality (31.107) is printed with the ratio P(t∣H0)/P(t∣H1)P(t|H_0)/P(t|H_1) greater than a constant in the rejection region; we follow their (31.108), and the difference is recorded in the handbook's list of source discrepancies.

Method(The generalised likelihood-ratio test)AdaptedAdapted from Riley, Hobson & Bence (2006), §31.7.4, eqs. (31.109)-(31.110) and the large-sample statement on p. 1284, pp. 1282-1284; Riley, Hobson & Bence (2006), §31.7.5, eqs. (31.112)-(31.114), pp. 1284-1285

Let the data be drawn from a population P(x∣a)P(x \mid a) of known functional form depending on parameters a=(a1,…,aM)a = (a_1, \dots, a_M), with likelihood L(x;a)L(x; a) as in Maximum likelihood. Let H0H_0 assert that aa lies in a subspace SS of the full parameter space AA, and H1H_1 that it does not. Write a^\hat a for the maximum-likelihood estimate over AA and a^S\hat a_S for the maximiser over SS alone. The generalised likelihood ratio is

λ(x)  =  L(x;a^S)L(x;a^).\lambda(x) \;=\; \frac{L(x; \hat a_S)}{L(x; \hat a)} .
  1. λ\lambda depends only on the data, and 0≤λ≤10 \le \lambda \le 1, since S⊆AS \subseteq A. The rejection region is λ<λcrit\lambda < \lambda_{\mathrm{crit}}: a value near 11 says the restricted model fits nearly as well as the free one, a small value says it does not. When H1H_1 is also simple, λ\lambda reduces to the Neyman-Pearson ratio.
  2. Large-sample law (Wilks). If H0H_0 fixes RR of the MM parameters at given values, R≤MR \le M, then for large sample size NN the quantity −2ln⁡λ-2\ln\lambda follows approximately a chi-squared distribution of order RR. Riley, Hobson and Bence state this without proof.
  3. Student's tt-test. For a sample of size NN from N(μ,σ2)N(\mu, \sigma^{2}) with both parameters unknown, and H0:μ=μ0H_0 : \mu = \mu_0 against H1:μ≠μ0H_1 : \mu \neq \mu_0 with σ2\sigma^{2} free under both,
λ  =  (1+t2N−1)−N/2,t  =  x‾−μ0S/N,S2=1N−1∑i(xi−x‾)2,\lambda \;=\; \left(1 + \frac{t^{2}}{N-1}\right)^{-N/2} , \qquad t \;=\; \frac{\overline x - \mu_0}{S/\sqrt N} , \qquad S^{2} = \frac{1}{N-1}\sum_{i}(x_i - \overline x)^{2} ,

and t∼t(N−1)t \sim t(N-1) under H0H_0. Since λ\lambda is a decreasing function of t2t^{2}, the rejection region λ<λcrit\lambda < \lambda_{\mathrm{crit}} is the two-tailed region ∣t∣>tcrit|t| > t_{\mathrm{crit}}, with tcrit=tN−1, 1−α/2t_{\mathrm{crit}} = t_{N-1,\,1-\alpha/2} for significance α\alpha.

Idea of the proofOriginal

The Neyman-Pearson lemma is a budgeting argument. A rejection region is a set of outcomes bought with a budget α\alpha of null-hypothesis probability; the aim is to buy as much alternative-hypothesis probability as the budget allows. An outcome xx costs P0(x)P_0(x) and pays P1(x)P_1(x), so the outcomes worth buying are those with the best pay-to-cost ratio - and buying everything down to a fixed exchange rate cc, which is exactly the region P0<cP1P_0 < cP_1, is optimal. The proof below is this argument with the regions compared term by term.

The generalised ratio extends the idea to the usual situation in which the alternative is a whole family: compare the best fit the null allows with the best fit possible, and reject when restricting the model costs too much likelihood. Student's tt-test is nothing but this comparison for a normal sample, rearranged until the statistic is one whose distribution is in a table.

Proof(The lemma, and the tt-test as a special case)Original

1. The Neyman-Pearson lemma. Let R=Rc\mathcal{R} = \mathcal{R}_c and let R′\mathcal{R}' be any region with Pr⁡(R′∣H0)≤α\Pr(\mathcal{R}' \mid H_0) \le \alpha. Write Pr⁡j(⋅)\Pr_j(\cdot) for probability computed with the density PjP_j. Splitting each region into its common and exclusive parts, R=(R∩R′)∪(R∖R′)\mathcal{R} = (\mathcal{R}\cap\mathcal{R}') \cup (\mathcal{R}\setminus\mathcal{R}') and likewise for R′\mathcal{R}', the shared piece cancels from every difference, so

Pr⁡1(R)−Pr⁡1(R′)=Pr⁡1(R∖R′)−Pr⁡1(R′∖R).\Pr\nolimits_1(\mathcal{R}) - \Pr\nolimits_1(\mathcal{R}') = \Pr\nolimits_1(\mathcal{R}\setminus\mathcal{R}') - \Pr\nolimits_1(\mathcal{R}'\setminus\mathcal{R}) .

On R∖R′\mathcal{R}\setminus\mathcal{R}' we are inside R\mathcal{R}, where the defining inequality P0<cP1P_0 < cP_1 holds, so P1>P0/cP_1 > P_0/c pointwise and therefore

Pr⁡1(R∖R′)  ≥  1cPr⁡0(R∖R′).\Pr\nolimits_1(\mathcal{R}\setminus\mathcal{R}') \;\ge\; \frac1c \Pr\nolimits_0(\mathcal{R}\setminus\mathcal{R}') .

On R′∖R\mathcal{R}'\setminus\mathcal{R} we are outside R\mathcal{R}, where P0≥cP1P_0 \ge cP_1, so P1≤P0/cP_1 \le P_0/c and

Pr⁡1(R′∖R)  ≤  1cPr⁡0(R′∖R).\Pr\nolimits_1(\mathcal{R}'\setminus\mathcal{R}) \;\le\; \frac1c \Pr\nolimits_0(\mathcal{R}'\setminus\mathcal{R}) .

Subtracting the second from the first and reversing the cancellation of the shared piece,

Pr⁡1(R)−Pr⁡1(R′)  ≥  1c[Pr⁡0(R)−Pr⁡0(R′)]  =  1c[α−Pr⁡0(R′)]  ≥  0,\Pr\nolimits_1(\mathcal{R}) - \Pr\nolimits_1(\mathcal{R}') \;\ge\; \frac1c\Bigl[\Pr\nolimits_0(\mathcal{R}) - \Pr\nolimits_0(\mathcal{R}')\Bigr] \;=\; \frac{1}{c}\bigl[\alpha - \Pr\nolimits_0(\mathcal{R}')\bigr] \;\ge\; 0 ,

the last step because c>0c > 0 and Pr⁡0(R′)≤α\Pr_0(\mathcal{R}') \le \alpha by hypothesis. That is the claim. The reformulation in terms of Λ\Lambda is immediate: Rc={Λ<c}\mathcal{R}_c = \{\Lambda < c\}. A monotonically increasing ff preserves the ordering of Λ\Lambda and so maps this set to {f(Λ)<f(c)}\{f(\Lambda) < f(c)\}, which is the same set of outcomes; a decreasing gg reverses it.

2. The tt-test is a generalised likelihood-ratio test. For a normal sample the likelihood is

L(x;μ,σ2)=(2πσ2)−N/2exp⁡[−12σ2∑i=1N(xi−μ)2].L(x; \mu, \sigma^{2}) = (2\pi\sigma^{2})^{-N/2}\exp\left[-\frac{1}{2\sigma^{2}}\sum_{i=1}^{N}(x_i-\mu)^{2}\right] .

Over the whole parameter space the maximisers are μ^=x‾\hat\mu = \overline x and σ^2=N−1∑i(xi−x‾)2\hat\sigma^{2} = N^{-1}\sum_i (x_i-\overline x)^{2}, as computed in Maximum likelihood. Over the subspace μ=μ0\mu = \mu_0 only σ2\sigma^{2} is free, and the same calculation with x‾\overline x replaced by the fixed μ0\mu_0 gives σ^S2=N−1∑i(xi−μ0)2\hat\sigma_S^{2} = N^{-1}\sum_i (x_i - \mu_0)^{2}. At either maximiser the exponent evaluates to −N/2-N/2, because the fitted variance is exactly the mean squared residual; so the exponentials cancel in the ratio and

λ=(σ^S2σ^2)−N/2=[∑i(xi−μ0)2∑i(xi−x‾)2]−N/2.\lambda = \left(\frac{\hat\sigma_S^{2}}{\hat\sigma^{2}}\right)^{-N/2} = \left[\frac{\sum_i (x_i-\mu_0)^{2}}{\sum_i (x_i-\overline x)^{2}}\right]^{-N/2} .

Now expand about the sample mean: writing xi−μ0=(xi−x‾)+(x‾−μ0)x_i - \mu_0 = (x_i - \overline x) + (\overline x - \mu_0) and squaring, the cross term is 2(x‾−μ0)∑i(xi−x‾)=02(\overline x - \mu_0)\sum_i (x_i-\overline x) = 0, so

∑i(xi−μ0)2=∑i(xi−x‾)2+N(x‾−μ0)2.\sum_i (x_i-\mu_0)^{2} = \sum_i (x_i-\overline x)^{2} + N(\overline x - \mu_0)^{2} .

Dividing through by ∑i(xi−x‾)2=(N−1)S2\sum_i (x_i - \overline x)^{2} = (N-1)S^{2} turns the bracket into 1+N(x‾−μ0)2/[(N−1)S2]1 + N(\overline x-\mu_0)^{2}/[(N-1)S^{2}], and the second term is t2/(N−1)t^{2}/(N-1) with tt as defined. Hence λ=[1+t2/(N−1)]−N/2\lambda = [1+t^{2}/(N-1)]^{-N/2}. The map t2↦λt^{2} \mapsto \lambda is strictly decreasing, so λ<λcrit\lambda < \lambda_{\mathrm{crit}} is the same event as t2>ct^{2} > c, that is ∣t∣>tcrit|t| > t_{\mathrm{crit}}. Finally, under H0H_0 the statistic tt is exactly the pivot of Confidence intervals, distributed as t(N−1)t(N-1) by Sampling distributions. □\square

Remark(Where the hypotheses are used, and what fails without them)Original

Both hypotheses simple, in the lemma. The proof compares two fixed densities pointwise. If H1H_1 is composite, P1P_1 is not defined, the power is a function of the alternative rather than a number, and no region is best against all alternatives at once. (A test that is best against every alternative in a family does sometimes exist - for a one-sided normal mean, for instance - but that is a theorem about the family, not a consequence of the lemma.)

The boundary has probability zero. If Pr⁡(Λ=c)>0\Pr(\Lambda = c) > 0 - which happens for discrete data, where the attainable sizes form a finite set - no region has size exactly α\alpha, and the optimal test must randomise on the boundary. For continuous data the assumption is automatic.

H0H_0 simple, in the definition of the test. Everything rests on being able to compute P(t∣H0)P(t \mid H_0). A composite null leaves that distribution undetermined; the usual repairs are to maximise the pp-value over the null (conservative) or to eliminate the nuisance parameter, which is precisely what the tt-test does with σ\sigma.

Normality and independence, in the tt-test. Normality enters twice: in writing the likelihood, and in the claim t∼t(N−1)t \sim t(N-1), which needs the independence of X‾\overline X and S2S^{2} special to the normal law. Independence of the observations enters in factorising the likelihood. For a large sample the central limit theorem makes the test approximately valid for any parent of finite variance; for a small sample from a heavy-tailed parent it is not valid at all.

Large NN, in the Wilks approximation. The chi-squared law for −2ln⁡λ-2\ln\lambda is asymptotic. The worked example below shows how rough it can be: at N=8N = 8 it returns p=0.0101p = 0.0101 where the exact tt calculation gives 0.01990.0199, too small by a factor of two, and too small is the dangerous direction.

Linearity in the parameters, in the goodness-of-fit test. The count of degrees of freedom as N−MN-M comes from the fitted parameters imposing MM linear constraints on the standardised residuals, which is Riley, Hobson and Bence's constraint-counting rule applied to the normal equations. For a model non-linear in its parameters the constraints are non-linear and the chi-squared law is only approximate; those authors note that the test is used anyway when the non-linearity is mild.

The region is fixed before the data are seen. Every probability above is computed over hypothetical repetitions with the rejection region held fixed. Choosing the region, the tail, or the number of data points after looking at the data destroys the meaning of α\alpha, and nothing in the mathematics detects that this has happened.

Remark(Reading the verdict honestly)Original

"Accept H0H_0" means "no evidence against H0H_0". A test has power against some alternatives and almost none against others; failing to reject a constant-rate hypothesis with four degrees of freedom says little about a 2% drift. A non-rejection should always be accompanied by the power of the test against an alternative the experiment actually cares about, or by the confidence interval, which displays the whole set of values not rejected.

A pp-value is not a posterior probability. p=0.02p = 0.02 does not mean H0H_0 has probability 0.020.02; it means that data as extreme as these arise two times in a hundred when H0H_0 holds. Small pp-values are produced not only by a false null but also by an incorrect error model, by correlated data treated as independent, and by stopping the experiment when the answer looked good.

Many tests, many false alarms. Twenty independent tests at the 5% level produce on average one rejection when every null is true. A search over a hundred bins, a hundred frequencies or a hundred candidate predictors must correct the threshold accordingly; the particle physicists' five-sigma convention, p≈6×10−7p \approx 6 \times 10^{-7}, is in large part such a correction.

Statistical significance is not size. With enough data, any effect at all - including an instrumental offset of no physical interest - becomes significant. Report the estimate and its interval alongside the test, and say whether the size of the effect matters.

Method(Running a test)Original
  1. State H0H_0 precisely enough to determine the distribution of the data, and say what the alternative is. Decide one-tailed or two-tailed from the alternative, not from the data.
  2. Choose the statistic. If both hypotheses are simple, the likelihood ratio is optimal by the lemma; otherwise use the generalised ratio λ\lambda, and rewrite it monotonically into a tabulated statistic if one exists.
  3. Obtain P(t∣H0)P(t \mid H_0): exactly where possible (normal, tt, χ2\chi^{2}, FF from Sampling distributions), by the Wilks approximation for large samples, or by simulating the null.
  4. Fix the significance level α\alpha and hence the rejection region, before computing the statistic.
  5. Compute the statistic from the data and report the pp-value as well as the verdict.
  6. If the null is not rejected, state the power against an alternative of interest, or quote the confidence interval instead.
Method(The chi-squared goodness-of-fit test)AdaptedAdapted from Riley, Hobson & Bence (2006), §31.7.7, the construction of the test and eq. (31.127), pp. 1296-1298; Riley, Hobson & Bence (2006), §30.9.4, eq. (30.124) and the constraint-counting rule, p. 1193; Arfken, Weber & Harris (2013), §23.7, eq. (23.99) and the moments (23.103)-(23.104), pp. 1170-1172

This tests H0:H_0 : "the model is correct" against the vague alternative that it is not, so no likelihood ratio is available; instead the residuals themselves are the statistic.

  1. Fit. With measurements yiy_i at known xix_i, independent and normally distributed about the model value f(xi;a)f(x_i; a) with known standard deviations σi\sigma_i, estimate the MM parameters by minimising
χ2(a)  =  ∑i=1N[yi−f(xi;a)σi]2,\chi^{2}(a) \;=\; \sum_{i=1}^{N}\left[\frac{y_i - f(x_i; a)}{\sigma_i}\right]^{2} ,

as in Least-squares fitting. Arfken, Weber and Harris emphasise that the weights 1/σi21/\sigma_i^{2} are what make each term a squared standard normal variable, and so make the sum a chi-squared variable. 2. Count the degrees of freedom. If ff is linear in aa, the MM normal equations are MM linear constraints on the NN standardised residuals, so by the constraint-counting rule the minimum value χ2(a^)\chi^{2}(\hat a) is distributed as χ2(N−M)\chi^{2}(N-M). Hence E[χ2(a^)]=N−M\mathbb{E}[\chi^{2}(\hat a)] = N-M and var⁡[χ2(a^)]=2(N−M)\operatorname{var}[\chi^{2}(\hat a)] = 2(N-M). 3. Compare. A value in the range (N−M)±2(N−M)(N-M) \pm \sqrt{2(N-M)} is unremarkable. Equivalently the reduced chi-squared χ2/(N−M)\chi^{2}/(N-M) should be near 11. 4. Test. For significance α\alpha take the one-tailed region χ2(a^)>k\chi^{2}(\hat a) > k, with kk the 1−α1-\alpha quantile of χ2(N−M)\chi^{2}(N-M), tabulated in table 31.2 of Riley, Hobson and Bence and table 23.2 of Arfken, Weber and Harris. A large value says the model is wrong, or the quoted σi\sigma_i are too small. A conspicuously small value is also a signal: either too many adjustable parameters are soaking up the scatter, or the error bars have been overstated. 5. Counts in bins. When the data are counts nin_i in kk bins with expected counts eie_i predicted by the model, the Poisson law of Random variables and distributions makes the variance of each count equal to its mean, so σi2=ei\sigma_i^{2} = e_i and the statistic becomes

χ2  =  ∑i=1k(ni−ei)2ei.\chi^{2} \;=\; \sum_{i=1}^{k}\frac{(n_i - e_i)^{2}}{e_i} .

Each count must be large enough for the normal approximation to the Poisson distribution to hold - a working rule is ei≳5e_i \gtrsim 5 - and the degrees of freedom are k−1−mk - 1 - m, one subtracted because the predicted total is matched to the observed total and mm more for parameters estimated from the same data. This binned form is our own assembly of the two cited ingredients, not a formula taken from either book.

Example(Eight dark-current readings: a tt-test, its pp-value and its power)Original

A photodiode's dark current is measured on eight separate occasions, giving (in pA)

12.9,  11.8,  13.4,  12.2,  13.1,  12.5,  12.0,  12.9.12.9,\; 11.8,\; 13.4,\; 12.2,\; 13.1,\; 12.5,\; 12.0,\; 12.9 .

The manufacturer specifies 12.012.0 pA. Test H0:μ=12.0H_0 : \mu = 12.0 against H1:μ≠12.0H_1 : \mu \neq 12.0 at the 5% level, treating the readings as independent and normal with unknown variance.

Step 1: the statistic. The eight values sum to 100.8100.8, so x‾=12.600\overline x = 12.600. The deviations are

0.3,  −0.8,  0.8,  −0.4,  0.5,  −0.1,  −0.6,  0.3,0.3,\; -0.8,\; 0.8,\; -0.4,\; 0.5,\; -0.1,\; -0.6,\; 0.3 ,

summing to zero, with squares summing to

∑i(xi−x‾)2=0.09+0.64+0.64+0.16+0.25+0.01+0.36+0.09=2.24.\sum_i (x_i-\overline x)^{2} = 0.09+0.64+0.64+0.16+0.25+0.01+0.36+0.09 = 2.24 .

Hence S2=2.24/7=0.32S^{2} = 2.24/7 = 0.32, S=0.565685S = 0.565685, and the standard error is S/8=0.32/8=0.04=0.200S/\sqrt 8 = \sqrt{0.32/8} = \sqrt{0.04} = 0.200 exactly. Therefore

t=12.600−12.0000.200=3.000.t = \frac{12.600 - 12.000}{0.200} = 3.000 .

Step 2: the verdict. With N−1=7N - 1 = 7 degrees of freedom and α=0.05\alpha = 0.05, the two-tailed critical value is t7,0.975=2.3646t_{7,0.975} = 2.3646. Since ∣t∣=3.000>2.3646|t| = 3.000 > 2.3646, reject H0H_0 at the 5% level. At the 1% level the critical value is t7,0.995=3.4995t_{7,0.995} = 3.4995, and H0H_0 would not be rejected; the pp-value therefore lies between 0.010.01 and 0.050.05, and numerically

p=2Pr⁡(t(7)≥3.000)=0.0199.p = 2\Pr\bigl(t(7) \ge 3.000\bigr) = 0.0199 .

Step 3: the same test as a likelihood ratio. By item 3 of the statement above,

λ=(1+97)−4=(167)−4=240165536=0.036636,\lambda = \left(1 + \frac{9}{7}\right)^{-4} = \left(\frac{16}{7}\right)^{-4} = \frac{2401}{65536} = 0.036636 ,

so −2ln⁡λ=8ln⁡(16/7)=6.6134-2\ln\lambda = 8\ln(16/7) = 6.6134. The null fixes R=1R = 1 of the two parameters, so the Wilks approximation compares this with χ2(1)\chi^{2}(1), whose upper tail at 6.61346.6134 is 0.01010.0101. The exact answer is 0.01990.0199: at N=8N = 8 the asymptotic law overstates the evidence by a factor of two, and the exact tt calculation is the one to use.

Step 4: the power. Suppose the quantity of interest is a dark current of 12.512.5 pA or more, and treat σ=0.5657\sigma = 0.5657 as known so that the normal one-tailed test applies. The 5% rejection region is x‾>12.0+1.64485×0.200=12.3290\overline x > 12.0 + 1.64485 \times 0.200 = 12.3290. Under μ=12.5\mu = 12.5 the sample mean is N(12.5,0.2002)N(12.5, 0.200^{2}), so

1−β=Pr⁡(Z>12.3290−12.50.200)=Pr⁡(Z>−0.8551)=Φ(0.8551)=0.804.1 - \beta = \Pr\left(Z > \frac{12.3290 - 12.5}{0.200}\right) = \Pr(Z > -0.8551) = \Phi(0.8551) = 0.804 .

The test misses a true 12.512.5 pA diode about one time in five. That is the number to quote when a test fails to reject.

Example(Five count bins: a goodness-of-fit test)Original

A scintillator counts cosmic-ray muons in five consecutive ten-minute intervals, recording

91,  72,  85,  68,  84,91,\; 72,\; 85,\; 68,\; 84 ,

a total of 400400 counts. Test the hypothesis that the rate is constant over the fifty minutes, at the 5% level.

Step 1: the expected counts. The rate itself is not predicted, only its constancy, so the expectation in each bin is the observed total shared equally: ei=400/5=80e_i = 400/5 = 80 for each ii. Each eie_i is comfortably above 55, so the binned form of the statistic applies.

Step 2: the statistic. The residuals are 11,−8,5,−12,411, -8, 5, -12, 4, which sum to zero because the total was matched. Their squares are 121,64,25,144,16121, 64, 25, 144, 16, summing to 370370, so

χ2=37080=4.625.\chi^{2} = \frac{370}{80} = 4.625 .

Step 3: the degrees of freedom and the verdict. There are k=5k = 5 bins, one constraint from matching the total and no further fitted parameters, so k−1=4k - 1 = 4 degrees of freedom. The reduced chi-squared is 4.625/4=1.1564.625/4 = 1.156, and the expected range is 4±8=4±2.834 \pm \sqrt 8 = 4 \pm 2.83, which contains 4.6254.625 comfortably. The 5% critical value is χ4,0.952=9.488\chi^{2}_{4,0.95} = 9.488; since 4.625<9.4884.625 < 9.488, the hypothesis of a constant rate is not rejected. The pp-value is

p=Pr⁡(χ2(4)≥4.625)=0.328.p = \Pr\bigl(\chi^{2}(4) \ge 4.625\bigr) = 0.328 .

Step 4: what has and has not been shown. The data are consistent with a constant rate. They are also consistent with a slow drift: the largest count is in the first bin and the smallest in the fourth, and a dedicated test against a linear trend - one parameter, one degree of freedom - would have more power against that specific alternative than this omnibus test, which spreads its four degrees of freedom over every possible departure from flatness.

Application(Where tests are used, and where they are abused)Original

Discovery claims. A new particle, an exoplanet transit or a gravitational-wave event is announced as the rejection of a background-only null hypothesis. The test statistic is almost always a likelihood ratio, justified by the lemma above, and the threshold is set far beyond the conventional 5% precisely because the search ranges over many masses, periods or templates.

Instrument and model validation. The reduced chi-squared of a calibration fit is the routine health check of an experiment: near 11, the model and the error bars are both credible; much above 11, one of them is wrong; much below 11, the error bars have been inflated or the model over-parametrised. Arfken, Weber and Harris read their three-point fit exactly this way, reporting χ2=4.533\chi^{2} = 4.533 against an expectation of 22 and a tail probability just above 0.10.1.

Comparing two samples. Asking whether two materials, two detectors or two model runs differ in mean is a tt-test; whether they differ in spread is the FF-test built on the variance ratio of Sampling distributions. In climate work the same machinery, applied to a detection-and-attribution fingerprint, is how a forced signal is distinguished from internal variability.

Model selection in fitting. Adding a parameter to a fit always lowers χ2\chi^{2}; the question is whether it lowers it by more than the one degree of freedom it costs. The generalised likelihood-ratio test with R=1R = 1, compared against χ2(1)\chi^{2}(1), is the standard answer, and the usual reason a spectral line or an extra exponential component is or is not claimed.

Method

Bayesian inference

Adapted

Turns Bayes' theorem into a method of parameter estimation - prior, likelihood, evidence, posterior - proves that the posterior updates sequentially and that the beta and normal families are conjugate, defines the credible interval and sets it against the confidence interval, and works a detector efficiency to a posterior mean of 9/14=0.6439/14 = 0.643 with a 95% credible interval [0.386,0.861][0.386, 0.861].

Prerequisites: Probability spaces, Maximum likelihood, Confidence intervals, Estimators and their properties, Random variables and distributions, The Beta function

Note(The change of question)AdaptedAdapted from Riley, Hobson & Bence (2006), §31.5.5, the remark that the posterior taken as a whole is what a parameter-estimation problem has to deliver, p. 1265

Frequentist inference keeps the parameter fixed and lets the data vary: it asks how a procedure behaves over hypothetical repetitions of the experiment, and reports intervals that cover the truth at a stated rate. Bayesian inference keeps the data fixed - they are what was actually observed - and puts the distribution on the parameter instead. It asks what is now believed about the parameter, given these data and what was believed beforehand.

The price is that "what was believed beforehand" has to be written down as a probability distribution. The return is that every question is answered by one object, the posterior distribution, and answered in the form people instinctively want: a probability that the parameter lies in a range. Riley, Hobson and Bence make the point sharply: on the Bayesian view what a parameter-estimation problem has to deliver is the whole posterior function, and every number one goes on to quote - an estimate, an error bar, an interval - is only a summary of it.

Definition(Prior, likelihood, evidence, posterior)AdaptedAdapted from Riley, Hobson & Bence (2006), §31.5.5, eqs. (31.81)-(31.83) with the naming of the four factors, pp. 1264-1265; Grimmett & Stirzaker (2020), §6.14, Example (1), p. 330

Fix a model HH: a family of distributions for the data xx indexed by parameters a=(a1,…,am)a = (a_1,\dots,a_m). The sampling density P(x∣a,H)P(x \mid a, H), read as a function of aa with xx held at its observed value, is the likelihood L(x;a)L(x; a) of Maximum likelihood. Bayes' theorem, proved for events in Probability spaces and applied here to densities, gives

P(a∣x,H)  =  P(x∣a,H) P(a∣H)P(x∣H).P(a \mid x, H) \;=\; \frac{P(x \mid a, H)\,P(a \mid H)}{P(x \mid H)} .

The four factors have names:

  • P(a∣H)P(a \mid H) is the prior, the distribution of the parameters before these data were analysed;
  • P(x∣a,H)=L(x;a)P(x \mid a, H) = L(x;a) is the likelihood, through which the data act;
  • P(x∣H)=∫L(x;a) P(a∣H) dmaP(x \mid H) = \int L(x;a)\,P(a\mid H)\,d^{m}a is the evidence (or marginal likelihood), which normalises the result;
  • P(a∣x,H)P(a \mid x, H) is the posterior, the distribution of the parameters after the data.

Because the evidence does not depend on aa, it is usually left out and restored at the end by normalisation:

P(a∣x,H)  ∝  L(x;a) P(a∣H),∫P(a∣x,H) dma=1.P(a \mid x, H) \;\propto\; L(x; a)\,P(a \mid H) , \qquad \int P(a \mid x, H)\,d^{m}a = 1 .

For a parameter taking values in a countable set Θ\Theta the integral is a sum, and Grimmett and Stirzaker write the posterior mass function with its denominator displayed, π(θ∣x)=f(x∣θ)π(θ)/∑ψ∈Θf(x∣ψ)π(ψ)\pi(\theta \mid x) = f(x\mid\theta)\pi(\theta)\big/\sum_{\psi\in\Theta} f(x\mid\psi)\pi(\psi); what is usually wanted from it is a posterior expectation E(g(θ)∣x)=∑θg(θ)π(θ∣x)\mathbb{E}(g(\theta)\mid x) = \sum_\theta g(\theta)\pi(\theta\mid x).

A prior should encode whatever was known beforehand, including hard physical restrictions - a mass is positive, an efficiency lies in [0,1][0,1]. When little is known, Riley, Hobson and Bence indicate it with a uniform or very broad prior; then P(a∣H)P(a\mid H) is constant and the posterior is proportional to the likelihood alone.

Definition(Credible interval)AdaptedAdapted from Riley, Hobson & Bence (2006), §31.5.5, eq. (31.84) with the central and equal-ordinate choices, p. 1266

Let aa be a single parameter with posterior density π(a∣x)\pi(a \mid x). A credible interval at level 1−α−β1 - \alpha - \beta is an interval [a−,a+][a_-, a_+] with

∫a−a+π(a∣x) da  =  1−α−β,\int_{a_-}^{a_+} \pi(a \mid x)\,da \;=\; 1 - \alpha - \beta ,

that is, an interval the parameter lies in with the stated posterior probability. Two standard choices pin down the endpoints:

  • the central interval, with equal tail probabilities α=β\alpha = \beta;
  • the interval with equal posterior density at the endpoints, π(a−∣x)=π(a+∣x)\pi(a_-\mid x) = \pi(a_+ \mid x), which for a unimodal posterior is the shortest interval of its level and consists of the most probable values.

Riley, Hobson and Bence give both, under the name Bayesian confidence interval; we use the now-standard term credible interval to keep it distinct from the confidence interval of Confidence intervals, which is a different object with a different meaning. In several dimensions the analogue is a region bounded by a surface of constant posterior density.

Definition(Conjugate family)Original

A family F\mathcal{F} of prior distributions is conjugate to a likelihood L(x;θ)L(x;\theta) if, whenever the prior belongs to F\mathcal{F}, the posterior does too: updating moves the parameters of the prior without leaving the family. The practical content is that the integral defining the evidence is done once, in general, rather than numerically for every data set. The term is not used by any of our sources; the two instances below are proved from scratch.

Method(Properties of the posterior)AdaptedAdapted from Riley, Hobson & Bence (2006), §31.5.5, eqs. (31.82)-(31.83), (31.85) and (31.86), pp. 1265-1268

Let π(a)\pi(a) be a prior and L(x;a)L(x;a) a likelihood, with posterior π(a∣x)∝L(x;a)π(a)\pi(a\mid x) \propto L(x;a)\pi(a).

  1. Sequential updating. If data arrive in two batches x1x_1 and x2x_2 that are independent given aa, then
π(a∣x1,x2)  ∝  L(x2;a) π(a∣x1):\pi(a \mid x_1, x_2) \;\propto\; L(x_2; a)\,\pi(a\mid x_1) :

the posterior after the first batch, used as the prior for the second, gives the same answer as analysing both batches at once. The order of the batches is irrelevant.

  1. Flat prior. If π\pi is constant over the region where LL is appreciable, then π(a∣x)∝L(x;a)\pi(a\mid x) \propto L(x;a): the posterior is the normalised likelihood, and its maximiser is the maximum-likelihood estimate a^ML\hat a_{\mathrm{ML}}. A Bayesian therefore reads the maximum-likelihood estimate as the posterior mode under a uniform prior.

  2. Curvature error. Riley, Hobson and Bence use

σ^a^=[−∂2ln⁡L∂a2∣a=a^]−1/2\hat\sigma_{\hat a} = \left[-\left.\frac{\partial^{2}\ln L}{\partial a^{2}}\right|_{a = \hat a}\right]^{-1/2}

as an estimate of the standard error. If LL is Gaussian in aa this is exactly its standard deviation, and the one-sigma limits are then the 68.3%68.3\% central credible interval; the formula is used as a measure of the error even when LL is not Gaussian. For several parameters the same curvature gives (V−1)ij=−∂2ln⁡L/∂ai∂aj(V^{-1})_{ij} = -\partial^{2}\ln L/\partial a_i \partial a_j at a^\hat a, whose expectation is the Fisher matrix of Estimators and their properties.

Method(Two conjugate families)Original

1. Beta prior, binomial data. Let θ∈(0,1)\theta \in (0,1) be an unknown success probability, let the data be kk successes in nn independent trials, and let the prior be Beta(α0,β0)\mathrm{Beta}(\alpha_0, \beta_0), with density proportional to θα0−1(1−θ)β0−1\theta^{\alpha_0-1}(1-\theta)^{\beta_0-1}. (The subscripted α0,β0>0\alpha_0, \beta_0 > 0 are the parameters of the beta distribution; they have nothing to do with the tail probabilities α,β\alpha, \beta of a credible interval.) Then the posterior is

Beta(α0+k,  β0+n−k),\mathrm{Beta}\bigl(\alpha_0 + k,\; \beta_0 + n - k\bigr) ,

with mean, and hence posterior expectation of θ\theta,

E[θ∣k]=α0+kα0+β0+n=w α0α0+β0+(1−w) kn,w=α0+β0α0+β0+n,\mathbb{E}[\theta \mid k] = \frac{\alpha_0+k}{\alpha_0+\beta_0+n} = w\,\frac{\alpha_0}{\alpha_0+\beta_0} + (1-w)\,\frac{k}{n} , \qquad w = \frac{\alpha_0+\beta_0}{\alpha_0+\beta_0+n} ,

a weighted average of the prior mean and the observed frequency k/nk/n, which is the maximum-likelihood estimate. The prior acts as α0\alpha_0 imagined successes and β0\beta_0 imagined failures, and its weight ww falls like 1/n1/n.

2. Normal prior, normal data of known variance. Let x1,…,xnx_1,\dots,x_n be independent N(θ,σ2)N(\theta, \sigma^{2}) with σ2\sigma^{2} known, and let the prior be θ∼N(μ0,τ2)\theta \sim N(\mu_0, \tau^{2}). Then the posterior is normal,

θ∣x  ∼  N ⁣(μn,1Pn),Pn=1τ2+nσ2,μn=τ−2μ0+(n/σ2) x‾Pn.\theta \mid x \;\sim\; N\!\left(\mu_n, \frac{1}{P_n}\right) , \qquad P_n = \frac{1}{\tau^{2}} + \frac{n}{\sigma^{2}} , \qquad \mu_n = \frac{\tau^{-2}\mu_0 + (n/\sigma^{2})\,\overline x}{P_n} .

In words: precisions add, and the posterior mean is the average of the prior mean and the sample mean weighted by their precisions. As n→∞n \to \infty the data term dominates, μn→x‾\mu_n \to \overline x and the posterior width tends to σ/n\sigma/\sqrt n, the frequentist standard error.

Idea of the proofOriginal

Everything here follows from one line, posterior∝likelihood×prior\text{posterior} \propto \text{likelihood} \times \text{prior}, plus the discipline of never normalising until the end. Sequential updating is that line applied twice, with the factorisation of the likelihood over independent batches doing all the work. Conjugacy is the observation that for some pairs the product has the same algebraic shape as the prior: a beta density times a binomial likelihood is θsomething(1−θ)something\theta^{\text{something}}(1-\theta)^{\text{something}} again, and a Gaussian times a Gaussian is a Gaussian, because the exponents are quadratics and quadratics add. In the Gaussian case the addition is cleanest in terms of the coefficient of θ2\theta^{2}, which is the precision; that is why the rule is "precisions add" and not anything about variances.

Proof(Sequential updating and the two conjugacies)Original

1. Sequential updating. Conditional independence of the batches means L(x1,x2;a)=L(x1;a)L(x2;a)L(x_1,x_2; a) = L(x_1;a)L(x_2;a). Hence

π(a∣x1,x2)  ∝  L(x1;a)L(x2;a) π(a)  =  L(x2;a) [L(x1;a)π(a)]  ∝  L(x2;a) π(a∣x1),\pi(a \mid x_1,x_2) \;\propto\; L(x_1;a)L(x_2;a)\,\pi(a) \;=\; L(x_2;a)\,\bigl[L(x_1;a)\pi(a)\bigr] \;\propto\; L(x_2;a)\,\pi(a\mid x_1) ,

the last step because π(a∣x1)∝L(x1;a)π(a)\pi(a\mid x_1) \propto L(x_1;a)\pi(a), the omitted factor being a constant in aa. Both ends of the chain are probability densities in aa, and two densities that are proportional are equal, since each is the other divided by its total mass, which is one. The product L(x1;a)L(x2;a)L(x_1;a)L(x_2;a) is symmetric in the two batches, so the order of processing cannot matter. □\square

2. Beta and binomial. The likelihood of kk successes in nn trials is (nk)θk(1−θ)n−k\binom{n}{k}\theta^{k}(1-\theta)^{n-k}, and the binomial coefficient is a constant in θ\theta and may be dropped. Multiplying by the prior,

π(θ∣k)  ∝  θk(1−θ)n−k⋅θα0−1(1−θ)β0−1  =  θ(α0+k)−1(1−θ)(β0+n−k)−1.\pi(\theta \mid k) \;\propto\; \theta^{k}(1-\theta)^{n-k}\cdot\theta^{\alpha_0-1}(1-\theta)^{\beta_0-1} \;=\; \theta^{(\alpha_0+k)-1}(1-\theta)^{(\beta_0+n-k)-1} .

This is the kernel of a Beta(α0+k,β0+n−k)\mathrm{Beta}(\alpha_0+k, \beta_0+n-k) density. Since a density is determined by its kernel together with the requirement that it integrate to one, and since the beta integral of The Beta function supplies the constant,

∫01θp−1(1−θ)q−1 dθ=B(p,q)=Γ(p)Γ(q)Γ(p+q),\int_0^1 \theta^{p-1}(1-\theta)^{q-1}\,d\theta = B(p,q) = \frac{\Gamma(p)\Gamma(q)}{\Gamma(p+q)} ,

the posterior is exactly that beta distribution - which is also where the hypothesis α0,β0>0\alpha_0, \beta_0 > 0 is used, since otherwise the integral diverges. Its mean is p/(p+q)p/(p+q) with p=α0+kp = \alpha_0+k and q=β0+n−kq = \beta_0+n-k, as tabulated in Random variables and distributions, giving (α0+k)/(α0+β0+n)(\alpha_0+k)/(\alpha_0+\beta_0+n). The weighted-average form follows by splitting the numerator:

α0+kα0+β0+n=α0+β0α0+β0+n⋅α0α0+β0+nα0+β0+n⋅kn.□\frac{\alpha_0+k}{\alpha_0+\beta_0+n} = \frac{\alpha_0+\beta_0}{\alpha_0+\beta_0+n}\cdot\frac{\alpha_0}{\alpha_0+\beta_0} + \frac{n}{\alpha_0+\beta_0+n}\cdot\frac{k}{n} . \qquad\square

3. Normal and normal. Keep only the factors depending on θ\theta. The likelihood is

L  ∝  exp⁡[−12σ2∑i=1n(xi−θ)2],∑i=1n(xi−θ)2=∑i=1n(xi−x‾)2+n(θ−x‾)2,L \;\propto\; \exp\left[-\frac{1}{2\sigma^{2}}\sum_{i=1}^{n}(x_i-\theta)^{2}\right] , \qquad \sum_{i=1}^{n}(x_i-\theta)^{2} = \sum_{i=1}^{n}(x_i-\overline x)^{2} + n(\theta - \overline x)^{2} ,

the identity being the expansion about x‾\overline x whose cross term vanishes. The first sum is free of θ\theta and joins the constant. Writing p0=1/τ2p_0 = 1/\tau^{2} and p1=n/σ2p_1 = n/\sigma^{2}, the posterior is therefore

π(θ∣x)  ∝  exp⁡[−12(p0(θ−μ0)2+p1(θ−x‾)2)].\pi(\theta\mid x) \;\propto\; \exp\left[-\tfrac12\Bigl(p_0(\theta-\mu_0)^{2} + p_1(\theta-\overline x)^{2}\Bigr)\right] .

The bracket is a quadratic in θ\theta with leading coefficient p0+p1=Pnp_0+p_1 = P_n. Completing the square,

p0(θ−μ0)2+p1(θ−x‾)2=Pn(θ−p0μ0+p1x‾Pn)2+p0p1Pn(μ0−x‾)2,p_0(\theta-\mu_0)^{2} + p_1(\theta-\overline x)^{2} = P_n\left(\theta - \frac{p_0\mu_0+p_1\overline x}{P_n}\right)^{2} + \frac{p_0p_1}{P_n}(\mu_0-\overline x)^{2} ,

which is checked by expanding both sides: the θ2\theta^{2} coefficients are PnP_n, the θ\theta coefficients are −2(p0μ0+p1x‾)-2(p_0\mu_0+p_1\overline x), and the constants agree because p0μ02+p1x‾2−(p0μ0+p1x‾)2/Pn=p0p1(μ0−x‾)2/Pnp_0\mu_0^{2}+p_1\overline x^{2} - (p_0\mu_0+p_1\overline x)^{2}/P_n = p_0p_1(\mu_0-\overline x)^{2}/P_n. The second term is free of θ\theta, so

π(θ∣x)  ∝  exp⁡[−Pn2(θ−μn)2],μn=p0μ0+p1x‾Pn,\pi(\theta\mid x) \;\propto\; \exp\left[-\frac{P_n}{2}(\theta-\mu_n)^{2}\right] , \qquad \mu_n = \frac{p_0\mu_0+p_1\overline x}{P_n} ,

which is the kernel of N(μn,1/Pn)N(\mu_n, 1/P_n); normalisation supplies the constant. □\square

Remark(Where the hypotheses are used, and what fails without them)Original

Conditional independence, in sequential updating. If the two batches are dependent given aa - the same systematic affecting both runs, say - the likelihood does not factorise and feeding the first posterior in as a prior double-counts the shared information, producing a posterior that is too narrow.

A proper posterior. The prior may be improper (a constant on an unbounded range is not a probability density) provided the posterior is normalisable, and that has to be checked. For Riley, Hobson and Bence's exponential model, L(x;τ)=τ−Nexp⁡(−s/τ)L(x;\tau) = \tau^{-N}\exp(-s/\tau) with s=∑ixis = \sum_i x_i, a flat prior on τ∈(0,∞)\tau \in (0,\infty) gives

∫0∞τ−Ne−s/τ dτ=s1−N Γ(N−1),\int_0^\infty \tau^{-N}e^{-s/\tau}\,d\tau = s^{1-N}\,\Gamma(N-1) ,

by the substitution u=s/τu = s/\tau, which is finite only for N≥2N \ge 2. With a single observation the posterior does not exist, and any "estimate" read off it is an artefact of truncating the range.

A flat prior is not a neutral prior. Flatness is not preserved by reparametrisation: if π(θ)\pi(\theta) is constant and ϕ=1/θ\phi = 1/\theta, then π(ϕ)=π(θ)∣dθ/dϕ∣∝ϕ−2\pi(\phi) = \pi(\theta)|d\theta/d\phi| \propto \phi^{-2}, which is far from flat. A uniform prior on a decay time is an informative, decreasing prior on the decay rate. "No prior information" is therefore not a well-defined state, and a paper that uses a flat prior must say flat in what variable.

The model is a hypothesis too. Everything above is conditional on HH. The posterior describes the best parameter values within the assumed family and says nothing about whether the family is right; a badly wrong model yields a sharp, confident and useless posterior. Model checking is a separate step, for which the goodness-of-fit test of Hypothesis testing is the frequentist tool and the evidence P(x∣H)P(x\mid H), compared between models, the Bayesian one.

Prior sensitivity. The normal-normal result quantifies how fast the prior stops mattering: its weight is τ−2\tau^{-2} against the data's n/σ2n/\sigma^{2}, so it is negligible once n≫σ2/τ2n \gg \sigma^{2}/\tau^{2}. For a parameter the data barely constrain - a nuisance direction in a many-parameter fit - that never happens, and the posterior in that direction is whatever the prior was. Reporting results under two or three different priors is the standard check.

Remark(Credible intervals against confidence intervals)AdaptedAdapted from Riley, Hobson & Bence (2006), §31.5.5, the comparison of the two kinds of interval, pp. 1266-1268, with the worked exponential example on pp. 1263-1264 and 1267

The two constructions produce similar numbers and assert different things.

  • A confidence interval at level 1−α1-\alpha is a random interval; the level is the long-run fraction of repeated samples of the same size whose interval would contain the fixed true value.
  • A credible interval at level 1−α1-\alpha is a fixed interval computed from the one sample obtained; the level is the posterior probability that the parameter lies in it.

Riley, Hobson and Bence make the contrast on a single data set: for ten observed intervals between telephone calls, modelled as exponential with mean τ\tau, the maximum-likelihood estimate is τ^=3.77\hat\tau = 3.77 and the curvature error is τ^/N=1.19\hat\tau/\sqrt{N} = 1.19, while the classical 68%68\% central interval computed from the exact sampling distribution of τ^\hat\tau is [2.86,5.46][2.86, 5.46] and the Bayesian 68%68\% central interval computed from the normalised likelihood is [3.16,6.20][3.16, 6.20]. Neither matches the symmetric 3.77±1.193.77 \pm 1.19, because the relevant distributions are skewed, and the two intervals do not match each other. They record that a frequentist regards the Bayesian interval as an approximation to the classical one, and a Bayesian regards it as the more meaningful of the two.

The disagreement shrinks with sample size. As the data come to dominate the prior, the posterior approaches a normal centred at the maximum-likelihood estimate with variance given by the inverse curvature of ln⁡L\ln L - whose expectation is the inverse Fisher information - and that is also the large-sample sampling distribution of the estimator established in Maximum likelihood. The two intervals then coincide numerically while continuing to mean different things, which is why in large-sample work the choice of school is often a matter of vocabulary. In small samples, in problems with physical boundaries (a mass near zero, an efficiency near one) and in problems with many nuisance parameters, the two can differ a great deal.

Method(A Bayesian analysis)Original
  1. Write the model. Specify P(x∣a,H)P(x\mid a, H) completely; as a function of aa at the observed xx this is the likelihood.
  2. Choose the prior. Impose hard physical constraints first (positivity, normalisation, a range). Say in which variable any flat prior is flat. If a conjugate family exists and can represent what is actually known, use it; the update is then arithmetic.
  3. Multiply and normalise. Form L(x;a)π(a)L(x;a)\pi(a), recognise it if possible, otherwise normalise numerically. In more than two or three parameters, sample the posterior with Markov chain Monte Carlo rather than evaluating it on a grid.
  4. Summarise. Quote the posterior mean or mode as the estimate, the posterior standard deviation as the error bar, and a credible interval at a stated level - central or highest-density, and say which. For several parameters, integrate out the ones not being reported; marginalising is the Bayesian treatment of nuisance parameters.
  5. Check. Repeat with a different prior to show the conclusion is driven by the data, and test the model itself separately.
Example(A detector efficiency, and a repeated calibration)Original

Part 1: beta-binomial. A new photon counter is tested with ten identical single-photon pulses and registers seven of them. Its efficiency θ\theta is to be estimated. Previous counters of this design have had efficiencies scattered broadly around one half, which we encode as a Beta(2,2)\mathrm{Beta}(2,2) prior: a smooth bump on (0,1)(0,1) with mean 1/21/2, carrying as much weight as two imagined successes and two imagined failures.

By the conjugacy statement with α0=β0=2\alpha_0 = \beta_0 = 2, n=10n = 10 and k=7k = 7, the posterior is

Beta(2+7,  2+3)=Beta(9,5).\mathrm{Beta}(2+7,\; 2+3) = \mathrm{Beta}(9,5) .

Its summaries follow from the beta formulas in Random variables and distributions:

mean=914=0.6429,mode=9−19+5−2=812=0.6667,\text{mean} = \frac{9}{14} = 0.6429 , \qquad \text{mode} = \frac{9-1}{9+5-2} = \frac{8}{12} = 0.6667 ,s.d.=9⋅5142⋅15=452940=0.1237.\text{s.d.} = \sqrt{\frac{9\cdot 5}{14^{2}\cdot 15}} = \sqrt{\frac{45}{2940}} = 0.1237 .

The maximum-likelihood estimate is k/n=0.700k/n = 0.700; the posterior mean is pulled towards the prior mean 0.50.5, by the weight w=4/14=0.286w = 4/14 = 0.286 of the statement: 0.286×0.5+0.714×0.7=0.6430.286\times 0.5 + 0.714\times 0.7 = 0.643, as computed. The 95%95\% central credible interval, from the quantiles of Beta(9,5)\mathrm{Beta}(9,5), is

[ 0.3857,  0.8614 ],[\,0.3857,\; 0.8614\,] ,

and the posterior probability that the counter beats fifty per cent efficiency is

Pr⁡(θ>12∣k=7)=70998192=0.8666,\Pr(\theta > \tfrac12 \mid k=7) = \frac{7099}{8192} = 0.8666 ,

a statement of exactly the kind a confidence interval is not allowed to make. Ten pulses are few: the interval is half the unit interval wide. Had the prior been flat, Beta(1,1)\mathrm{Beta}(1,1), the posterior would be Beta(8,4)\mathrm{Beta}(8,4) with mean 2/3=0.66672/3 = 0.6667 and interval [0.3903,  0.8907][0.3903,\; 0.8907] - a visible but not decisive shift, which is the honest report of how much the prior is doing here.

Part 2: normal-normal. A spectral line position is known from an earlier experiment to be θ=5.00±0.20\theta = 5.00 \pm 0.20 (arbitrary units), which we take as the prior N(5.00,0.202)N(5.00, 0.20^{2}). Nine new readings of known instrumental standard deviation σ=0.30\sigma = 0.30 have mean x‾=5.30\overline x = 5.30. The precisions are

p0=10.202=25,p1=90.302=100,P9=125,p_0 = \frac{1}{0.20^{2}} = 25 , \qquad p_1 = \frac{9}{0.30^{2}} = 100 , \qquad P_9 = 125 ,

so the posterior standard deviation is 1/125=0.08941/\sqrt{125} = 0.0894 and the posterior mean is

μ9=25(5.00)+100(5.30)125=655125=5.240.\mu_9 = \frac{25(5.00) + 100(5.30)}{125} = \frac{655}{125} = 5.240 .

The 95%95\% central credible interval is 5.240±1.95996×0.0894=[ 5.065,  5.415 ]5.240 \pm 1.95996 \times 0.0894 = [\,5.065,\; 5.415\,]. For comparison, the frequentist 95%95\% confidence interval from the new data alone is 5.300±1.95996×0.30/3=[ 5.104,  5.496 ]5.300 \pm 1.95996 \times 0.30/3 = [\,5.104,\; 5.496\,]. The Bayesian interval is shifted towards the earlier measurement and is narrower, 0.3510.351 against 0.3920.392, because it uses both experiments; the whole of that difference is the information in the prior, and nothing else. Note also that by sequential updating the same answer would have come from analysing the two experiments jointly in either order.

Application(Where posteriors are the working object)Original

Cosmology and astrophysics. Parameters of a cosmological model are quoted as posterior means with credible intervals, obtained by sampling a posterior over a dozen or more parameters; positivity and physical ranges enter as priors, and nuisance parameters for instrumental systematics are marginalised away rather than fitted and forgotten. Comparing the evidence P(x∣H)P(x\mid H) between models is how an extra parameter is judged to be warranted.

Sequential estimation and filtering. The Kalman filter of The Kalman filter is the normal-normal update of this unit run once per observation, with a forecast step in between; "precisions add" is its measurement update. Operational weather forecasting does the same on a state space of 10810^{8} variables, where the posterior is represented by an ensemble - see Optimal interpolation and variational data assimilation.

Computation. Beyond two or three parameters the posterior cannot be tabulated, and the integrals wanted from it are posterior expectations. Grimmett and Stirzaker introduce Markov chain Monte Carlo with exactly this example: build a chain whose stationary distribution is the posterior and average along its path. The convergence theory is that of Convergence of Markov chains, and the sampling machinery that of Monte Carlo methods.

Few counts and hard boundaries. When an experiment records three events where two were expected, or measures a quantity known to be non-negative and obtains a negative point estimate, frequentist intervals become awkward and can even be empty. A prior supported on the physical range removes the difficulty by construction, which is why upper limits on masses, rates and cross-sections are so often reported as credible rather than confidence limits - with the prior stated, since the answer depends on it.