Mathematical Methods Handbook

Data analysis for the physical sciences

Methods for analysing fields and time series.

In this chapter 6

Tick a unit to add it to your PDF basket.

  1. Fields and time series

Fields and time series

6

Method

Principal components and empirical orthogonal functions

Adapted

Builds the sample covariance matrix of a centred data matrix, shows that its eigenvectors are the directions of successively largest sample variance and that they are the right singular vectors of the data matrix itself, reads the eigenvalues as the variance each direction explains, and identifies the truncated expansion as the best approximation of its rank — which is what an EOF analysis of a space-time field computes.

Prerequisites: Singular value decomposition, Spectral theorem for Hermitian matrices, Quadratic forms and the Rayleigh quotient, Orthogonal projection and least squares, Expectation, variance and covariance, The multivariate normal distribution

Note(What this unit is, and what is ours)Original

Principal component analysis takes a table of numbers — nn observations of pp variables — and finds the few directions in the pp-dimensional variable space along which the data actually vary. In the atmospheric and ocean sciences the same computation, applied to a field sampled at pp grid points on nn occasions, is called empirical orthogonal function (EOF) analysis: the eigenvectors are maps, and the coefficients that multiply them are time series. The two names describe one piece of linear algebra.

None of the books in this handbook's library treats principal components under that name. What they supply is the machinery: the singular value decomposition and the variational property of the eigenvectors of a symmetric matrix from Riley, Hobson and Bence (Riley, Hobson & Bence (2006), §8.17.1 and §8.18.3, pp. 290-291 and 302-304), and the covariance matrix of a random vector from Grimmett and Stirzaker (Grimmett & Stirzaker (2020), §4.9, pp. 132-134). The assembly of those pieces into the statement below, and every number in the example, are ours.

Definition(Data matrix, sample covariance, principal components, EOFs)Original

Let XX be a real n×pn \times p data matrix with n≥2n \ge 2: row tt is one observation xt∈Rpx_t \in \mathbb{R}^p, column jj is one variable. For a space-time field, tt indexes time and jj indexes a grid point, so XtjX_{tj} is the value of the field at grid point jj at time tt.

The column mean is xˉ=n−1∑t=1nxt\bar x = n^{-1}\sum_{t=1}^{n} x_t, and XX is centred when xˉ=0\bar x = 0, that is when every column sums to zero. We assume from here on that XX has been centred by subtracting xˉ\bar x from every row; the matrix before centring is called the raw data and is never used below.

The sample covariance matrix of a centred XX is the p×pp \times p matrix

S  =  1n−1 XTX,Sjk  =  1n−1∑t=1nXtjXtk.S \;=\; \frac{1}{n-1}\,X^{\mathsf T}X , \qquad S_{jk} \;=\; \frac{1}{n-1}\sum_{t=1}^{n} X_{tj}X_{tk} .

It is symmetric and positive semidefinite, since aTSa=∥Xa∥2/(n−1)≥0a^{\mathsf T}Sa = \lVert Xa\rVert^{2}/(n-1) \ge 0 for every a∈Rpa \in \mathbb{R}^p. Its diagonal entries are the sample variances of the pp variables, and tr⁡S\operatorname{tr}S is the total variance of the data set.

Given a unit vector a∈Rpa \in \mathbb{R}^p, the numbers zt=xt⋅az_t = x_t \cdot a (t=1,…,nt = 1,\dots,n) are the data projected onto the direction aa. Their mean is zero, because XX is centred, and their sample variance is

1n−1∑t=1n(xt⋅a)2  =  ∥Xa∥2n−1  =  aTSa.\frac{1}{n-1}\sum_{t=1}^{n} (x_t\cdot a)^{2} \;=\; \frac{\lVert Xa\rVert^{2}}{n-1} \;=\; a^{\mathsf T}Sa .

A principal direction (in the geosciences, an empirical orthogonal function, or EOF) is a unit vector ek∈Rpe_k \in \mathbb{R}^p produced by the following rule: e1e_1 maximises aTSaa^{\mathsf T}Sa over all unit aa, and for k≥2k \ge 2, eke_k maximises aTSaa^{\mathsf T}Sa over all unit aa orthogonal to e1,…,ek−1e_1, \dots, e_{k-1}. The corresponding principal component (in the geosciences, the PC time series, or expansion coefficient) is the column vector

zk  =  Xek  ∈  Rn,z_k \;=\; X e_k \;\in\; \mathbb{R}^{n} ,

whose ttth entry is the amount of pattern eke_k present in observation tt. The sample variance of zkz_k is ekTSeke_k^{\mathsf T}Se_k, written λk\lambda_k, and, provided X≠0X \ne 0 — equivalently tr⁡S>0\operatorname{tr}S > 0, since tr⁡S=∥X∥F2/(n−1)\operatorname{tr}S = \lVert X\rVert_F^2/(n-1) — the explained variance fraction of mode kk is λk/tr⁡S\lambda_k/\operatorname{tr}S. For the zero data matrix every λk\lambda_k vanishes and the fractions are not defined; that case is excluded wherever they are used.

The population counterpart of SS is the covariance matrix VV of a random vector, Vjk=cov⁡(Xj,Xk)V_{jk} = \operatorname{cov}(X_j, X_k). Grimmett and Stirzaker (Grimmett & Stirzaker (2020), Thm (4.9.5) and Exercise (4.9.3), pp. 132, 134) state this naming of VV at their Theorem (4.9.5), and give the variance ∑iai2var⁡(Xi)+2∑i<jaiajcov⁡(Xi,Xj)\sum_i a_i^2\operatorname{var}(X_i) + 2\sum_{i<j}a_ia_j\operatorname{cov}(X_i,X_j) of a linear combination at their Exercise (4.9.3), which is the population form of the identity var⁡(a⋅X)=aTVa\operatorname{var}(a\cdot X) = a^{\mathsf T}Va just computed for a sample. Both are stated there for a vector with the multivariate normal distribution N(μ,V)N(\mu, V), which is the only distribution that section treats; neither uses normality, since both are identities between second moments that hold for any random vector with finite variances. Everything below is in any case a statement about the matrix SS actually formed from the data, not about VV.

Method(Principal components, the SVD, and optimal truncation)Original

Let XX be a centred real n×pn \times p data matrix with n≥2n \ge 2 and sample covariance S=XTX/(n−1)S = X^{\mathsf T}X/(n-1), and let r=rank⁡Xr = \operatorname{rank}X.

1. The principal directions exist and are the eigenvectors of SS. Write the eigenvalues of SS, which are real and non-negative, in decreasing order λ1≥λ2≥⋯≥λp≥0\lambda_1 \ge \lambda_2 \ge \dots \ge \lambda_p \ge 0, with an orthonormal basis e1,…,epe_1,\dots,e_p of eigenvectors, Sek=λkekSe_k = \lambda_ke_k. Then this e1,…,epe_1,\dots,e_p is a valid choice of principal directions, the successive maxima are

max⁡∥a∥=1,  a⊥e1,…,ek−1aTSa  =  λk,\max_{\lVert a\rVert = 1,\; a \perp e_1,\dots,e_{k-1}} a^{\mathsf T}Sa \;=\; \lambda_k ,

and the sample variance of the kkth principal component is λk\lambda_k. Exactly rr of the λk\lambda_k are non-zero. The choice is unique up to sign whenever λk−1>λk>λk+1\lambda_{k-1} > \lambda_k > \lambda_{k+1}, read with the end conventions λ0=+∞\lambda_0 = +\infty and λp+1=−∞\lambda_{p+1} = -\infty (so at k=1k = 1 the condition is λ1>λ2\lambda_1 > \lambda_2 and at k=pk = p it is λp−1>λp\lambda_{p-1} > \lambda_p), and within any block of equal eigenvalues no direction is singled out at all.

2. The principal components are uncorrelated, and the variances add up. For j≠kj \ne k the sample covariance of zj=Xejz_j = Xe_j and zk=Xekz_k = Xe_k is zjTzk/(n−1)=ejTSek=λk ej⋅ek=0z_j^{\mathsf T}z_k/(n-1) = e_j^{\mathsf T}Se_k = \lambda_k\,e_j\cdot e_k = 0, and

∑k=1pλk  =  tr⁡S,\sum_{k=1}^{p}\lambda_k \;=\; \operatorname{tr}S ,

so, when X≠0X \ne 0 and hence tr⁡S>0\operatorname{tr}S > 0, the explained variance fractions λk/tr⁡S\lambda_k/\operatorname{tr}S are non-negative and sum to one.

3. They come straight out of the SVD of XX. Let X=UΣVTX = U\Sigma V^{\mathsf T} be a singular value decomposition (Singular value decomposition). An n×pn \times p matrix has q=min⁡(n,p)q = \min(n,p) singular values σ1≥⋯≥σq≥0\sigma_1 \ge \dots \ge \sigma_q \ge 0; extend the list by σk=0\sigma_k = 0 for q<k≤pq < k \le p, which is consistent because SS then has p−qp - q further zero eigenvalues. With that convention one may take, for k=1,…,pk = 1,\dots,p,

ek=vk(the kth column of V),λk=σk2n−1,zk=Xvk={σkuk,k≤q,0,k>q.e_k = v_k \quad(\text{the }k\text{th column of }V), \qquad \lambda_k = \frac{\sigma_k^{2}}{n-1}, \qquad z_k = Xv_k = \begin{cases} \sigma_k u_k, & k \le q,\\ 0, & k > q . \end{cases}

The second case is empty when p≤np \le n; when p>np > n — the case the remark below stresses — UU supplies only u1,…,unu_1,\dots,u_n, and the remaining principal components vanish. In particular the principal directions never require SS to be formed.

4. Truncation is optimal. For 1≤m<r1 \le m < r let

X^(m)  =  ∑k=1mzkekT  =  ∑k=1mσkukvkT\widehat X^{(m)} \;=\; \sum_{k=1}^{m} z_k e_k^{\mathsf T} \;=\; \sum_{k=1}^{m}\sigma_k u_kv_k^{\mathsf T}

be the field reconstructed from the first mm modes. Then X^(m)\widehat X^{(m)} minimises ∥X−B∥F\lVert X - B\rVert_F over all n×pn \times p matrices BB of rank at most mm, the minimum value being (∑k>mσk2)1/2\bigl(\sum_{k>m}\sigma_k^{2}\bigr)^{1/2}, and the fraction of the total variance it retains is

∑k≤mλktr⁡S  =  ∑k≤mσk2∑k≤pσk2.\frac{\sum_{k\le m}\lambda_k}{\operatorname{tr}S} \;=\; \frac{\sum_{k\le m}\sigma_k^{2}}{\sum_{k\le p}\sigma_k^{2}} .

Equivalently, among all mm-dimensional subspaces of Rp\mathbb{R}^p, the span of e1,…,eme_1,\dots,e_m is one onto which the orthogonal projection of the data loses the least squared length.

Idea of the proofOriginal

Two short observations do all the work.

The first is that aTSaa^{\mathsf T}Sa depends on aa only through its components in an eigenbasis: writing a=∑kckeka = \sum_k c_ke_k with ∑kck2=1\sum_k c_k^2 = 1 gives aTSa=∑kλkck2a^{\mathsf T}Sa = \sum_k \lambda_kc_k^2, a weighted average of the eigenvalues. An average of numbers cannot exceed the largest of them, and it reaches that value only by putting all the weight on entries equal to the largest — on one eigenvector when the largest eigenvalue is simple, and anywhere in its eigenspace when it is not. So maximising a quadratic form over the unit sphere is not a calculus problem at all once the spectral theorem has been applied; it is the remark that a convex combination is largest at an extreme point. Imposing orthogonality to e1,…,ek−1e_1,\dots,e_{k-1} deletes the first k−1k-1 weights and repeats the argument on what is left.

The second is that SS and XX carry the same information: XTX=(n−1)SX^{\mathsf T}X = (n-1)S, so the right singular vectors of XX are eigenvectors of SS and the squared singular values are (n−1)(n-1) times its eigenvalues. Truncating the principal component expansion is then literally truncating the dyadic sum ∑kσkukvkT\sum_k\sigma_ku_kv_k^{\mathsf T}, and its optimality is the Eckart-Young theorem already proved in Singular value decomposition.

ProofAdaptedAdapted from Riley, Hobson & Bence (2006), §8.17.1, Eqs. (8.113)-(8.116), pp. 290-291; Riley, Hobson & Bence (2006), §8.18.3, Eqs. (8.131)-(8.136), pp. 302-304

Part 1. SS is real symmetric, so by the spectral theorem (Spectral theorem for Hermitian matrices) it has an orthonormal eigenbasis e1,…,epe_1,\dots,e_p with real eigenvalues, which we order decreasingly; they are non-negative because λk=ekTSek=∥Xek∥2/(n−1)≥0\lambda_k = e_k^{\mathsf T}Se_k = \lVert Xe_k\rVert^2/(n-1) \ge 0.

Fix kk and let aa be a unit vector orthogonal to e1,…,ek−1e_1,\dots,e_{k-1}. Expand a=∑i=1pcieia = \sum_{i=1}^{p}c_ie_i with ci=a⋅eic_i = a\cdot e_i; orthogonality to the first k−1k-1 eigenvectors says c1=⋯=ck−1=0c_1 = \dots = c_{k-1} = 0, and ∥a∥=1\lVert a \rVert = 1 says ∑i≥kci2=1\sum_{i\ge k}c_i^2 = 1. Then, using Sei=λieiSe_i = \lambda_ie_i and ei⋅ej=δije_i\cdot e_j = \delta_{ij},

aTSa  =  ∑i≥k∑j≥kcicj eiTSej  =  ∑i≥kλici2  ≤  λk∑i≥kci2  =  λk,a^{\mathsf T}Sa \;=\; \sum_{i\ge k}\sum_{j \ge k} c_ic_j\,e_i^{\mathsf T}Se_j \;=\; \sum_{i\ge k}\lambda_ic_i^{2} \;\le\; \lambda_k\sum_{i\ge k}c_i^{2} \;=\; \lambda_k ,

the inequality because λi≤λk\lambda_i \le \lambda_k for every i≥ki \ge k, by the decreasing ordering, and because every ci2≥0c_i^2 \ge 0. The value λk\lambda_k is attained at a=eka = e_k, which is a unit vector orthogonal to e1,…,ek−1e_1,\dots,e_{k-1}. So the maximum is λk\lambda_k and eke_k achieves it, which is what the defining rule for eke_k asks. The variance of zk=Xekz_k = Xe_k is ∥Xek∥2/(n−1)=ekTSek=λk\lVert Xe_k\rVert^2/(n-1) = e_k^{\mathsf T}Se_k = \lambda_k.

The number of non-zero eigenvalues is rank⁡S\operatorname{rank}S, and rank⁡S=rank⁡(XTX)=rank⁡X=r\operatorname{rank}S = \operatorname{rank}(X^{\mathsf T}X) = \operatorname{rank}X = r: indeed Xa=0Xa = 0 implies XTXa=0X^{\mathsf T}Xa = 0, and conversely XTXa=0X^{\mathsf T}Xa = 0 implies ∥Xa∥2=aTXTXa=0\lVert Xa\rVert^2 = a^{\mathsf T}X^{\mathsf T}Xa = 0, so the two matrices have the same null space.

For uniqueness, suppose λk−1>λk>λk+1\lambda_{k-1} > \lambda_k > \lambda_{k+1} (read λ0=+∞\lambda_0 = +\infty at the left end and λp+1=−∞\lambda_{p+1} = -\infty at the right, so that for k=pk = p the hypothesis is only λp−1>λp\lambda_{p-1} > \lambda_p) and let aa be any maximiser. In the display above, equality in ∑i≥kλici2≤λk∑i≥kci2\sum_{i\ge k}\lambda_ic_i^2 \le \lambda_k\sum_{i\ge k}c_i^2 forces ci=0c_i = 0 for every i>ki > k with λi<λk\lambda_i < \lambda_k, which under the assumed strict gap is every i>ki>k; hence a=ckeka = c_ke_k with ∣ck∣=1|c_k| = 1. If instead λk=λk+1\lambda_k = \lambda_{k+1}, every unit vector in the corresponding eigenspace is a maximiser.

That argument used only the right-hand gap λk>λk+1\lambda_k > \lambda_{k+1}, and it determines eke_k up to sign given e1,…,ek−1e_1,\dots,e_{k-1}. The left-hand gap λk−1>λk\lambda_{k-1} > \lambda_k is what makes the conclusion a statement about the rule and not about one run of it: the constraint set {a:∥a∥=1, a⊥e1,…,ek−1}\{a : \lVert a\rVert = 1,\ a \perp e_1,\dots,e_{k-1}\} depends on the earlier choices, and those are themselves arbitrary inside any block of equal eigenvalues. If λk−1=λk\lambda_{k-1} = \lambda_k, then ek−1e_{k-1} may be taken to be any unit vector of the shared eigenspace, and eke_k is then forced to be a vector of that same eigenspace orthogonal to it — so eke_k moves with ek−1e_{k-1} and is not determined up to sign. With both gaps, λk\lambda_k is a simple eigenvalue, and the left gap also pins down the constraint set: any admissible e1,…,ek−1e_1,\dots,e_{k-1} span the sum of the eigenspaces of λ1,…,λk−1\lambda_1,\dots,\lambda_{k-1}, and since λk−1>λk\lambda_{k-1} > \lambda_k that sum contains every block of equal eigenvalues it meets, so it is the same subspace — the sum of all eigenspaces for eigenvalues exceeding λk\lambda_k — however the ties among the earlier modes were resolved. Hence eke_k is the same line whatever admissible e1,…,ek−1e_1,\dots,e_{k-1} preceded it, which is what "unique up to sign" asserts.

Part 2. The zkz_k have mean zero because the columns of XX do, so their sample covariance is zjTzk/(n−1)=ejTXTXek/(n−1)=ejTSek=λk ej⋅ekz_j^{\mathsf T}z_k/(n-1) = e_j^{\mathsf T}X^{\mathsf T}Xe_k/(n-1) = e_j^{\mathsf T}Se_k = \lambda_k\,e_j\cdot e_k, which vanishes for j≠kj \ne k by orthonormality. The trace identity is the fact that a square matrix has trace equal to the sum of its eigenvalues, applied to SS; concretely, tr⁡S=tr⁡(QΛQT)=tr⁡(ΛQTQ)=tr⁡Λ\operatorname{tr}S = \operatorname{tr}(Q\Lambda Q^{\mathsf T}) = \operatorname{tr}(\Lambda Q^{\mathsf T}Q) = \operatorname{tr}\Lambda with Q=(e1⋯ep)Q = (e_1 \cdots e_p) orthogonal.

Part 3. Let X=UΣVTX = U\Sigma V^{\mathsf T} be a singular value decomposition. Then

XTX  =  VΣTUTUΣVT  =  V(ΣTΣ)VT,X^{\mathsf T}X \;=\; V\Sigma^{\mathsf T}U^{\mathsf T}U\Sigma V^{\mathsf T} \;=\; V(\Sigma^{\mathsf T}\Sigma)V^{\mathsf T} ,

using UTU=IU^{\mathsf T}U = I. This is the computation Riley, Hobson and Bence (Riley, Hobson & Bence (2006), Eq. (8.132), p. 302) make at their Eq. (8.132); since ΣTΣ\Sigma^{\mathsf T}\Sigma is the p×pp \times p diagonal matrix with entries σ12,…,σq2\sigma_1^2,\dots,\sigma_q^2 followed by p−qp - q zeros — that is, with entries σk2\sigma_k^2 under the convention σk=0\sigma_k = 0 for k>qk > q — and VV is orthogonal, it exhibits an orthogonal diagonalisation of XTX=(n−1)SX^{\mathsf T}X = (n-1)S. Hence the columns vkv_k of VV are orthonormal eigenvectors of SS with eigenvalues σk2/(n−1)\sigma_k^2/(n-1), and because the SVD convention orders σ1≥σ2≥…\sigma_1 \ge \sigma_2 \ge \dots, these eigenvalues come out already in decreasing order. By part 1 they are an admissible set of principal directions and variances. Finally Xvk=σkukXv_k = \sigma_ku_k for k≤qk \le q, which is their Eq. (8.134), so zk=σkukz_k = \sigma_ku_k there; for k>qk > q the kkth column of Σ\Sigma is zero, so zk=Xvk=UΣVTvk=0z_k = Xv_k = U\Sigma V^{\mathsf T}v_k = 0, in agreement with λk=0\lambda_k = 0.

Part 4. Substituting zk=σkukz_k = \sigma_ku_k and ek=vke_k = v_k into the definition of X^(m)\widehat X^{(m)} gives ∑k≤mσkukvkT\sum_{k\le m}\sigma_ku_kv_k^{\mathsf T}, which is the rank-mm truncation of the dyadic form of XX (Riley, Hobson and Bence's (Riley, Hobson & Bence (2006), Eq. (8.136), p. 303) Eq. (8.136)). Its optimality in the Frobenius norm, with the stated minimum, is the Eckart-Young statement of Singular value decomposition. Dividing ∥X∥F2=∑kσk2\lVert X\rVert_F^2 = \sum_k\sigma_k^2 by n−1n-1 turns it into tr⁡S=∑kλk\operatorname{tr}S = \sum_k\lambda_k, which gives the variance fraction. For the last sentence, let PP be the orthogonal projection of Rp\mathbb{R}^p onto an mm-dimensional subspace; then XPXP has rank at most mm, so ∥X−XP∥F≥∥X−X^(m)∥F\lVert X - XP\rVert_F \ge \lVert X - \widehat X^{(m)}\rVert_F, and X^(m)=XPm\widehat X^{(m)} = XP_m with PmP_m the projection onto span⁡(e1,…,em)\operatorname{span}(e_1,\dots,e_m), because ∑k≤mXekekT=X∑k≤mekekT\sum_{k\le m}Xe_ke_k^{\mathsf T} = X\sum_{k\le m}e_ke_k^{\mathsf T} and the latter sum is exactly PmP_m (Orthogonal projection and least squares). □\square

Remark(Where the hypotheses are used)Original
  • Centring is what makes SS a covariance matrix, and it is the hypothesis most often dropped by accident. Parts 3 and 4 — the identification with the SVD and the Eckart-Young optimality — are facts about an arbitrary matrix XX and hold whether or not it is centred; what centring buys is the reading of aTSaa^{\mathsf T}Sa as a sample variance, and with it the zero mean of the principal components used in part 2. If the columns of XX are not centred, then XTX/(n−1)X^{\mathsf T}X/(n-1) is a matrix of second moments, not of covariances; its leading eigenvector is dominated by the mean xˉ\bar x and typically just reproduces it. Concretely, take a single variable with the two values 1010 and 1212, so that n=2n = 2 and n−1=1n - 1 = 1. Centred, the formula gives the sample variance ((−1)2+12)/1=2\bigl((-1)^2 + 1^2\bigr)/1 = 2; applied to the raw column it gives (102+122)/1=244(10^2 + 12^2)/1 = 244 instead, of which the mean alone contributes 2⋅112/1=2422\cdot 11^2/1 = 242. So more than 99%99\% of the quantity being maximised has nothing to do with variability, and the "first mode" of an uncentred analysis is just the mean.
  • The decreasing ordering is used once, in the inequality λi≤λk\lambda_i \le \lambda_k for i≥ki \ge k. Without it the argument still shows that stationary directions are eigenvectors — this is the Lagrange-multiplier computation of Riley, Hobson and Bence (Riley, Hobson & Bence (2006), §8.17.1, Eqs. (8.113)-(8.116), pp. 290-291), who note that stationarity is necessary but not sufficient for a maximum — but it no longer identifies which eigenvector is the maximiser. The convex-combination argument above settles that and is why we do not need the multiplier.
  • Symmetry of SS is what gives an orthonormal eigenbasis, and with it both the uncorrelatedness in part 2 and the completeness used in the expansion a=∑cieia = \sum c_ie_i. It is automatic here, because SS is built as XTXX^{\mathsf T}X; there is no hypothesis to check and no non-symmetric variant of the method.
  • Degenerate eigenvalues destroy the modes, not the subspace. When λk=λk+1\lambda_k = \lambda_{k+1}, the individual patterns eke_k and ek+1e_{k+1} are arbitrary inside a two-dimensional eigenspace and will change completely under a tiny perturbation of the data; only their span, and the sum of the two explained variances, is stable. Near-degeneracy is the usual situation for a propagating signal, whose two phases have nearly equal variance, and it is the standard reason an individual EOF should not be read as a physical mode.
  • Rank is limited by the smaller dimension. Since r≤min⁡(n,p)r \le \min(n,p), a field on p=104p = 10^4 grid points observed on n=50n = 50 occasions has at most 5050 non-zero eigenvalues, and at most 4949 after centring, because centring puts the rows in the hyperplane ∑txt=0\sum_t x_t = 0. Part 3 is then the only practical route: the p×pp \times p matrix SS need never be built.
  • Scaling is a modelling choice, not mathematics. SS is not invariant under rescaling the individual variables, so for variables in different units — hectopascals and metres per second — PCA of SS is meaningless and one works with the correlation matrix instead, that is, with each column divided by its sample standard deviation. For a field in one unit this choice is usually inappropriate, but a weight proportional to the square root of the area each grid point represents is needed, or dense high-latitude grid points are over-counted.
  • n−1n-1 versus nn changes every λk\lambda_k by the same factor and therefore changes no eigenvector and no explained variance fraction. We use n−1n-1 for consistency with the unbiased sample variance of Sampling distributions.
  • Row vectors. Grimmett and Stirzaker (Grimmett & Stirzaker (2020), §4.9, pp. 132-133) write random vectors as rows, so their covariance matrix is E[(X−μ)′(X−μ)]\mathbb{E}[(X-\mu)'(X-\mu)] and their linear map acts on the right, Y=XDY = XD with covariance D′VDD'VD. We use column vectors, in which the same statements read V=E[(X−μ)(X−μ)T]V = \mathbb{E}[(X-\mu)(X-\mu)^{\mathsf T}] and cov⁡(DTX)=DTVD\operatorname{cov}(D^{\mathsf T}X) = D^{\mathsf T}VD. The transposes are not a disagreement, only a transcription.
Method(Computing an EOF analysis)Original
  1. Lay out the data matrix. Rows are observations (times), columns are variables (grid points). Decide first what the "observations" are: EOFs of a field in time and EOFs of the same field transposed are different analyses, related by part 3.
  2. Handle missing values and weights before anything else. Fill or drop; then, for a field on a sphere, multiply column jj by wj\sqrt{w_j} with wjw_j the area weight of grid point jj, so that tr⁡S\operatorname{tr}S is the area-weighted variance. For variables in different units, divide each column by its sample standard deviation instead.
  3. Centre. Subtract each column's mean. If a trend or a seasonal cycle is to be excluded rather than analysed, remove it here too; otherwise it will be mode 1.
  4. Factor, do not square. Compute the singular value decomposition X=UΣVTX = U\Sigma V^{\mathsf T} (Singular value decomposition). Forming S=XTX/(n−1)S = X^{\mathsf T}X/(n-1) and diagonalising it gives the same answer in exact arithmetic but squares the condition number (Matrix norms and condition numbers), and is impossible anyway when pp is large.
  5. Read off the modes. EOF kk is the column vkv_k, plotted as a map; the PC time series is zk=σkukz_k = \sigma_ku_k; the variance of mode kk is λk=σk2/(n−1)\lambda_k = \sigma_k^2/(n-1) and its explained fraction is σk2/∑iσi2\sigma_k^2/\sum_i\sigma_i^2.
  6. Fix the sign. Each pair (vk,zk)(v_k, z_k) may be replaced by (−vk,−zk)(-v_k, -z_k); software makes an arbitrary choice. Fix it by a stated rule, for example by requiring the value of vkv_k at a chosen grid point, or the projection of zkz_k on a chosen index, to be positive, and say which rule you used.
  7. Decide how many modes to keep. Plot λk\lambda_k against kk and truncate where the spectrum flattens; check whether the gap you are truncating at is larger than the sampling uncertainty in the eigenvalues, which for nn independent observations is of order λk2/n\lambda_k\sqrt{2/n}. Keep whole near-degenerate pairs or none of them.
  8. Reconstruct and check. Form X^(m)=∑k≤mzkvkT\widehat X^{(m)} = \sum_{k\le m}z_kv_k^{\mathsf T} and verify that ∥X−X^(m)∥F2\lVert X - \widehat X^{(m)}\rVert_F^2 equals ∑k>mσk2\sum_{k>m}\sigma_k^2. This is an arithmetic check on the whole computation and costs nothing.
Example(A field at four grid points, worked through exactly)Original

A one-dimensional "field" is measured at p=4p = 4 grid points on n=5n = 5 occasions. The data, already centred (each column sums to zero), are

X  =  (42−4−2020−2−2020−2−4240000).X \;=\; \begin{pmatrix} 4 & 2 & -4 & -2\\ 0 & 2 & 0 & -2\\ -2 & 0 & 2 & 0\\ -2 & -4 & 2 & 4\\ 0 & 0 & 0 & 0 \end{pmatrix} .

Step 1: the sample covariance matrix. With n−1=4n - 1 = 4,

S  =  14XTX  =  (64−6−446−4−6−6−464−4−646),tr⁡S=24.S \;=\; \tfrac14 X^{\mathsf T}X \;=\; \begin{pmatrix} 6 & 4 & -6 & -4\\ 4 & 6 & -4 & -6\\ -6 & -4 & 6 & 4\\ -4 & -6 & 4 & 6 \end{pmatrix}, \qquad \operatorname{tr}S = 24 .

For instance the (1,2)(1,2) entry is 14(4⋅2+0⋅2+(−2)⋅0+(−2)⋅(−4)+0)=14(8+0+0+8)=4\tfrac14\bigl(4\cdot2 + 0\cdot2 + (-2)\cdot0 + (-2)\cdot(-4) + 0\bigr) = \tfrac14(8+0+0+8) = 4.

Step 2: guess and verify two eigenvectors. Rows 11 and 33 of SS are negatives of each other, and so are rows 22 and 44; the matrix therefore has rank at most 22, and the two sign patterns f=(1,1,−1,−1)Tf = (1,1,-1,-1)^{\mathsf T} and g=(1,−1,−1,1)Tg = (1,-1,-1,1)^{\mathsf T} suggest themselves. Multiplying out,

Sf=(6+4+6+4,  4+6+4+6,  −6−4−6−4,  −4−6−4−6)T=20 f,Sf = (6+4+6+4,\; 4+6+4+6,\; -6-4-6-4,\; -4-6-4-6)^{\mathsf T} = 20\,f ,Sg=(6−4+6−4,  4−6+4−6,  −6+4−6+4,  −4+6−4+6)T=4 g.Sg = (6-4+6-4,\; 4-6+4-6,\; -6+4-6+4,\; -4+6-4+6)^{\mathsf T} = 4\,g .

So λ1=20\lambda_1 = 20 and λ2=4\lambda_2 = 4, with f⋅g=1−1+1−1=0f \cdot g = 1 - 1 + 1 - 1 = 0. Since λ1+λ2=24=tr⁡S\lambda_1 + \lambda_2 = 24 = \operatorname{tr}S and the remaining eigenvalues are non-negative, they must both be zero: the data lie exactly in a two-dimensional subspace, and r=2r = 2.

Step 3: normalise, and compute the principal components. ∥f∥=∥g∥=2\lVert f\rVert = \lVert g\rVert = 2, so the EOFs are

e1=12(1,1,−1,−1)T,e2=12(1,−1,−1,1)T.e_1 = \tfrac12(1,1,-1,-1)^{\mathsf T}, \qquad e_2 = \tfrac12(1,-1,-1,1)^{\mathsf T} .

EOF 1 is a dipole: the left half of the domain up, the right half down. EOF 2 opposes the two outer grid points to the two inner ones — its signs across grid points 1,2,3,41,2,3,4 are +,−,−,++,-,-,+, so it changes sign between points 11 and 22 and between points 33 and 44, but not between 22 and 33. It is not the grid-scale pattern that alternates at every step: that vector, (1,−1,1,−1)T(1,-1,1,-1)^{\mathsf T}, satisfies S(1,−1,1,−1)T=0S(1,-1,1,-1)^{\mathsf T} = 0 here, so it carries no sample variance at all and spans one of the two null directions whose zero eigenvalues step 2 accounted for (the other is the uniform pattern (1,1,1,1)T(1,1,1,1)^{\mathsf T}, also annihilated by SS). The PC time series are zk=Xekz_k = Xe_k:

z1=(6, 2, −2, −6, 0)T,z2=(2, −2, −2, 2, 0)T.z_1 = (6,\,2,\,-2,\,-6,\,0)^{\mathsf T}, \qquad z_2 = (2,\,-2,\,-2,\,2,\,0)^{\mathsf T} .

(First entry of z1z_1: 12(4+2+4+2)=6\tfrac12(4 + 2 + 4 + 2) = 6.) Their sample variances are ∥z1∥2/4=(36+4+4+36)/4=20=λ1\lVert z_1\rVert^2/4 = (36+4+4+36)/4 = 20 = \lambda_1 and ∥z2∥2/4=16/4=4=λ2\lVert z_2\rVert^2/4 = 16/4 = 4 = \lambda_2, as part 1 promises, and z1⋅z2=12−4+4−12+0=0z_1 \cdot z_2 = 12 - 4 + 4 - 12 + 0 = 0, as part 2 promises.

Step 4: explained variance.

λ1tr⁡S=2024=56=83.33%,λ2tr⁡S=424=16=16.67%.\frac{\lambda_1}{\operatorname{tr}S} = \frac{20}{24} = \frac56 = 83.33\%, \qquad \frac{\lambda_2}{\operatorname{tr}S} = \frac{4}{24} = \frac16 = 16.67\% .

The dipole alone accounts for five sixths of the variance of the field; the two modes together account for all of it.

Step 5: cross-check against the SVD. The singular values must be σk=(n−1)λk\sigma_k = \sqrt{(n-1)\lambda_k}, that is σ1=80=45≈8.9443\sigma_1 = \sqrt{80} = 4\sqrt5 \approx 8.9443 and σ2=16=4\sigma_2 = \sqrt{16} = 4, with σ3=σ4=0\sigma_3 = \sigma_4 = 0; and indeed ∥X∥F2=∑t,jXtj2=96=80+16\lVert X\rVert_F^2 = \sum_{t,j}X_{tj}^2 = 96 = 80 + 16. Truncating after one mode leaves ∥X−X^(1)∥F2=σ22=16\lVert X - \widehat X^{(1)}\rVert_F^2 = \sigma_2^2 = 16, and no rank-one matrix does better.

ApplicationOriginal

Climate fields. Applied to monthly anomalies of sea-level pressure over the northern hemisphere, the leading EOF is the annular seesaw between the polar cap and the midlatitude belt whose PC time series is published as the Arctic Oscillation, or northern annular mode, index; the same analysis restricted to the Atlantic sector gives the North Atlantic Oscillation, the seesaw between the Icelandic low and the Azores high; applied to tropical Pacific sea-surface temperature, the leading EOF is the tongue of warm anomaly whose PC is an El Nino index. The attraction is exactly part 4: a handful of numbers per month reproduces a field of tens of thousands of grid points to within a few per cent of its variance, so a century of maps compresses to a few time series that can be correlated with everything else. The attendant danger is the degeneracy caveat above — the leading EOF is a statistically optimal pattern, and only sometimes also a dynamical mode.

Model reduction and data assimilation. Truncating at mm modes replaces a state vector of length pp by one of length mm in the subspace that carries the most variance, which is how a reduced-rank background covariance is built for Optimal interpolation and variational data assimilation, and how the "essential dynamics" of a protein is extracted from a molecular-dynamics trajectory: the atomic coordinate matrix has p=3Natomsp = 3N_{\text{atoms}} columns, and a handful of collective modes carries most of the fluctuation.

Measurement and instrumentation. The same decomposition applied to a set of spectra separates the number of independent chemical species present (the number of eigenvalues above the noise floor) from the noise, and applied to an array of detectors it identifies common-mode drift as a leading mode to be regressed out. In both cases what is being used is that the noise, being uncorrelated between channels, contributes a nearly flat tail to the eigenvalue spectrum, while any shared signal contributes a few large eigenvalues.

Method

The periodogram and spectral estimation

Adapted

Defines the periodogram of a finite record as the squared modulus of its discrete Fourier transform, shows that it is exactly the transform of the sample autocovariance and that its expectation is the true spectral density smoothed by the Fejer kernel of the data window, computes its distribution for Gaussian white noise to show that it never becomes consistent however long the record, and sets out the two repairs — tapering against leakage and segment averaging against variance.

Prerequisites: The discrete Fourier transform and the FFT, Stationary processes and spectral densities, Cesàro means and Fejér's theorem, The multivariate normal distribution, Expectation, variance and covariance, Sampling distributions

Note(Conventions, and two densities that differ by a factor)Original

Stationary processes and spectral densities defines the spectral density of a discrete-time stationary process through its autocorrelation ρ(n)=c(n)/c(0)\rho(n) = c(n)/c(0), so that the density

f(λ)=12π∑n∈Zρ(n) e−inλ,λ∈(−π,π],f(\lambda) = \frac{1}{2\pi}\sum_{n\in\mathbb{Z}}\rho(n)\,\mathrm{e}^{-in\lambda}, \qquad \lambda\in(-\pi,\pi],

is a probability density: it integrates to one. In data analysis one wants the spectrum in the units of the data, so throughout this unit we use the power spectral density

g(λ)  =  c(0) f(λ)  =  12π∑n∈Zc(n) e−inλ,so thatc(n)=∫−ππeinλg(λ) dλand∫−ππg=c(0)=var⁡Xt.g(\lambda) \;=\; c(0)\,f(\lambda) \;=\; \frac{1}{2\pi}\sum_{n\in\mathbb{Z}}c(n)\,\mathrm{e}^{-in\lambda}, \qquad\text{so that}\qquad c(n) = \int_{-\pi}^{\pi}\mathrm{e}^{in\lambda}g(\lambda)\,d\lambda \quad\text{and}\quad \int_{-\pi}^{\pi}g = c(0) = \operatorname{var}X_t .

The two differ only by the constant factor c(0)c(0), and the summability hypothesis is the same one, Grimmett and Stirzaker's (Grimmett & Stirzaker (2020), (9.3.18), p. 442) condition ∑n∣ρ(n)∣<∞\sum_n\lvert\rho(n)\rvert<\infty. Every formula below can be read in either normalisation by inserting or removing one factor of var⁡Xt\operatorname{var}X_t; mixing them silently is the commonest unit error in this subject.

Time is measured in sampling intervals, so the frequency variable λ\lambda is in radians per sample and the Nyquist frequency is λ=π\lambda = \pi. For data sampled every Δ\Delta seconds, the physical angular frequency is ω=λ/Δ\omega = \lambda/\Delta and the density per unit ω\omega is Δ g(ωΔ)\Delta\,g(\omega\Delta); this is the factor Riley, Hobson and Bence (Riley, Hobson & Bence (2006), Exercise 13.10(a), p. 462) carry as τ\tau in their Exercise 13.10.

Definition(Fourier frequencies, the periodogram, tapers)AdaptedAdapted from Arfken, Weber & Harris (2013), §19.1, Exercise 19.1.2, p. 945; Riley, Hobson & Bence (2006), §13.4, Exercise 13.10, p. 462

Let x0,x1,…,xN−1x_0, x_1, \dots, x_{N-1} be a finite record. The Fourier frequencies are

λj=2πjN,j=0,1,…,N−1,\lambda_j = \frac{2\pi j}{N}, \qquad j = 0, 1, \dots, N-1 ,

the frequencies for which the record contains a whole number of cycles. Values of jj above N/2N/2 are read as the negative frequencies λj−2π\lambda_j - 2\pi, so the λj\lambda_j fill (−π,π](-\pi,\pi].

The discrete Fourier sum of the record is

JN(λ)  =  ∑t=0N−1xt e−iλt,J_N(\lambda) \;=\; \sum_{t=0}^{N-1} x_t\,\mathrm{e}^{-i\lambda t} ,

which at λ=λj\lambda = \lambda_j is NN times the discrete Fourier transform x^(j)\hat x(j) of The discrete Fourier transform and the FFT, whose convention carries the factor 1/N1/N in front. The periodogram is

IN(λ)  =  12πN ∣JN(λ)∣2.I_N(\lambda) \;=\; \frac{1}{2\pi N}\,\bigl\lvert J_N(\lambda)\bigr\rvert^{2} .

Squaring discards the phase: this is the property Arfken, Weber and Harris (Arfken, Weber & Harris (2013), Exercise 19.1.2, p. 945) single out when they call an2+bn2a_n^2+b_n^2 the power spectrum and note its invariance under a phase shift. The 2π2\pi and the NN are chosen so that INI_N estimates gg and not a multiple of it; several other normalisations are in use.

A taper (or data window) is a sequence of weights w0,…,wN−1w_0,\dots,w_{N-1}, not all zero, applied before transforming. The tapered periodogram is

INw(λ)  =  12π∑twt2  ∣∑t=0N−1wt xt e−iλt∣2,I^{w}_N(\lambda) \;=\; \frac{1}{2\pi\sum_{t}w_t^{2}}\;\Bigl\lvert \sum_{t=0}^{N-1} w_t\,x_t\,\mathrm{e}^{-i\lambda t}\Bigr\rvert^{2} ,

the denominator being what keeps the scale right; wt≡1w_t \equiv 1 gives INI_N back. Its spectral window is

ΦNw(θ)  =  12π∑twt2  ∣∑t=0N−1wt e−iθt∣2,\Phi^{w}_N(\theta) \;=\; \frac{1}{2\pi\sum_{t}w_t^{2}}\;\Bigl\lvert \sum_{t=0}^{N-1} w_t\,\mathrm{e}^{-i\theta t}\Bigr\rvert^{2} ,

a non-negative even function of θ\theta with ∫−ππΦNw=1\int_{-\pi}^{\pi}\Phi^{w}_N = 1. For wt≡1w_t\equiv1 the geometric sum gives the closed form

ΦN(θ)  =  12πN sin⁡2(Nθ/2)sin⁡2(θ/2),\Phi_N(\theta) \;=\; \frac{1}{2\pi N}\,\frac{\sin^{2}(N\theta/2)}{\sin^{2}(\theta/2)} ,

which is the Fejer kernel of Cesàro means and Fejér's theorem in the normalisation Stakgold and Holst (Stakgold & Holst (2011), Exercise 2.3.6, p. 144) use.

Finally, the sample autocovariance of the record at lag hh, ∣h∣≤N−1\lvert h\rvert \le N-1, is

c^(h)  =  1N∑t=0N−1−∣h∣(xt−xˉ) (xt+∣h∣−xˉ),xˉ=1N∑txt.\hat c(h) \;=\; \frac{1}{N}\sum_{t=0}^{N-1-\lvert h\rvert}(x_t - \bar x)\,(x_{t+\lvert h\rvert} - \bar x), \qquad \bar x = \frac1N\sum_t x_t .

Note the divisor NN, not N−∣h∣N - \lvert h\rvert: the reason is part 1 below.

Method(What the periodogram is, and what it is not)Original

Let X0,…,XN−1X_0,\dots,X_{N-1} be a stretch of a real weakly stationary process with autocovariance cc and power spectral density gg, and let INI_N, INwI^w_N, ΦNw\Phi^w_N and c^\hat c be as defined above.

1. It is exactly the transform of the sample autocovariance, and it carries all of the mean square of the record. At every Fourier frequency λj\lambda_j with j≠0j \ne 0,

IN(λj)  =  12π∑h=−(N−1)N−1c^(h) e−ihλj,I_N(\lambda_j) \;=\; \frac{1}{2\pi}\sum_{h=-(N-1)}^{N-1}\hat c(h)\,\mathrm{e}^{-ih\lambda_j} ,

and summing over the grid,

2πN∑j=0N−1IN(λj)  =  1N∑t=0N−1xt2.\frac{2\pi}{N}\sum_{j=0}^{N-1} I_N(\lambda_j) \;=\; \frac1N\sum_{t=0}^{N-1}x_t^{2} .

So the periodogram is the finite-sample copy of the inversion formula g(λ)=(2π)−1∑nc(n)e−inλg(\lambda) = (2\pi)^{-1}\sum_n c(n)\mathrm{e}^{-in\lambda}, and it partitions the mean square of the record over the frequency grid. The divisor NN in c^\hat c is what makes the first identity exact; with N−∣h∣N - \lvert h\rvert it fails, and the right-hand side need not even be non-negative.

2. Its expectation is the true density smoothed by the spectral window. If ∑n∣c(n)∣<∞\sum_n\lvert c(n)\rvert < \infty and EXt=0\mathbb{E}X_t = 0, then for every λ\lambda

E INw(λ)  =  ∫−ππΦNw(λ−μ) g(μ) dμ,\mathbb{E}\,I^{w}_N(\lambda) \;=\; \int_{-\pi}^{\pi}\Phi^{w}_N(\lambda - \mu)\,g(\mu)\,d\mu ,

and in the untapered case this is

E IN(λ)  =  12π∑∣h∣<N(1−∣h∣N)c(h) e−ihλ  →N→∞  g(λ),\mathbb{E}\,I_N(\lambda) \;=\; \frac{1}{2\pi}\sum_{\lvert h\rvert < N}\Bigl(1 - \frac{\lvert h\rvert}{N}\Bigr)c(h)\,\mathrm{e}^{-ih\lambda} \;\xrightarrow[N\to\infty]{}\; g(\lambda) ,

the convergence being uniform in λ\lambda. The periodogram is therefore asymptotically unbiased but biased at any finite NN, and the bias has two distinguishable parts: the main lobe of ΦNw\Phi^w_N blurs sharp features (limited resolution), and the sidelobes of ΦNw\Phi^w_N transport power from strong frequencies to distant weak ones (leakage). Among tapers that are heaviest at the centre the main lobe is narrowest with no taper at all: for wt≡1w_t\equiv1 the full width of the main lobe of ΦN\Phi_N between its first zeros is exactly 4π/N4\pi/N, and every taper that lowers the sidelobes widens it — to 8π/N8\pi/N for the Hann taper of the method below. Narrow main lobe and low sidelobes pull against each other: for wt≡1w_t\equiv1 the first sidelobe of ΦN\Phi_N sits about 1.431.43 frequency bins from the centre at about 4.7%4.7\% of the peak, that is −13.3-13.3 decibels, and a taper buys a lower figure than that with a wider main lobe.

3. It is not consistent. Let XtX_t be independent N(0,σ2)N(0,\sigma^2), so that g≡σ2/2πg \equiv \sigma^2/2\pi. Then for each Fourier frequency λj\lambda_j with 0<j<N/20 < j < N/2,

IN(λj)g  ∼  12χ22,equivalentlyIN(λj)∼Exponential with mean g,\frac{I_N(\lambda_j)}{g} \;\sim\; \tfrac12\chi^{2}_{2} , \qquad\text{equivalently}\qquad I_N(\lambda_j) \sim \text{Exponential with mean } g ,

and these variables are independent for different such jj; at the two self-conjugate frequencies λ=0\lambda = 0 and (for even NN) λ=π\lambda = \pi one gets IN/g∼χ12I_N/g \sim \chi^2_1 instead. Consequently

E IN(λj)=g,var⁡IN(λj)=g2,standard deviationmean=1for every N.\mathbb{E}\,I_N(\lambda_j) = g, \qquad \operatorname{var}I_N(\lambda_j) = g^{2}, \qquad \frac{\text{standard deviation}}{\text{mean}} = 1 \quad\text{for every }N .

Lengthening the record adds more frequencies; it does not improve any of them. A raw periodogram of a long record is a dense forest of spikes whose individual heights are no better determined than those from a short one.

4. Averaging is the repair. Split the record into KK segments of length M=N/KM = N/K, form the tapered periodogram of each, and average:

Iˉ(λ)  =  1K∑k=1KIMw,(k)(λ).\bar I(\lambda) \;=\; \frac1K\sum_{k=1}^{K} I^{w,(k)}_M(\lambda) .

For Gaussian white noise and non-overlapping segments the KK terms are independent, and each has mean exactly gg whatever the taper, so E Iˉ=g\mathbb{E}\,\bar I = g. The law, however, depends on the taper. Write the condition

(T)∑t=0M−1wt2 e−2iλjt  =  0.\textbf{(T)}\qquad \sum_{t=0}^{M-1} w_t^{2}\,\mathrm{e}^{-2i\lambda_j t} \;=\; 0 .

At an interior Fourier frequency λj\lambda_j of the segment grid, 0<j<M/20 < j < M/2, at which (T) holds,

Iˉ(λj)g  ∼  χ2K22K,E Iˉ=g,standard deviationmean=1K.\frac{\bar I(\lambda_j)}{g} \;\sim\; \frac{\chi^{2}_{2K}}{2K}, \qquad \mathbb{E}\,\bar I = g, \qquad \frac{\text{standard deviation}}{\text{mean}} = \frac{1}{\sqrt{K}} .

For wt≡1w_t\equiv1 condition (T) holds at every interior λj\lambda_j, so the untapered statement is exact across the grid. For a general taper it can fail, and where it fails the mean is still exactly gg but the chi-squared law and the figure K−1/2K^{-1/2} are only approximations. The failures are few and sit at the two ends of the band: for the Hann taper of the method below, with MM even, the only interior exceptions are j=1j = 1 and j=M/2−1j = M/2-1, where the relative standard deviation is 37/(6K )=1.0138 K−1/2\sqrt{37}/(6\sqrt{K}\,) = 1.0138\,K^{-1/2} instead of K−1/2K^{-1/2}. The price is resolution: the frequency grid is now spaced 2π/M2\pi/M instead of 2π/N2\pi/N, and the main lobe is KK times wider. This trade — variance down by KK, resolution down by KK — is the whole of the design problem. Welch's method is this procedure with a taper on each segment and the segments overlapped by half their length, which recovers part of the data that the tapers suppress at the cost of making the segments no longer independent.

Idea of the proofOriginal

The periodogram is a squared Fourier sum, so everything about it follows from writing the square as a double sum over pairs of times and collecting terms by their separation.

Do that to the data and you get the sample autocovariance: that is part 1, and it is an identity, with no probability in it. Do the same to the expectation and the pair (s,t)(s,t) contributes c(s−t)c(s-t), which depends only on h=s−th = s-t by stationarity; there are N−∣h∣N - \lvert h\rvert pairs at separation hh, so the triangular factor 1−∣h∣/N1 - \lvert h\rvert/N appears, and that factor is precisely what converts the exact inversion sum into a convolution with the Fejer kernel. The record length enters only through the width of that kernel, which is why the bias disappears as NN grows.

The variance does not, and the reason is a counting argument. A record of length NN gives NN numbers, the periodogram evaluates them at about N/2N/2 frequencies, and each value is built out of just two of them — the sine and cosine amplitudes at that frequency. The amount of data behind each estimate is two numbers however long the record is, and two numbers cannot have small relative error. That is part 3, and it also tells us the only possible cure: pool neighbouring or repeated estimates until the count is large. Part 4 pools repetitions in time; smoothing the periodogram across adjacent frequencies pools neighbours and does the same arithmetic.

Proof(Parts 1-4)AdaptedAdapted from Arfken, Weber & Harris (2013), §20.6, Eq. (20.120) and Exercises 20.6.1 and 20.6.3(a), pp. 1004-1007; Grimmett & Stirzaker (2020), §9.3, the discrete-time spectral representation and the inversion formula (9.3.16), pp. 441-442

Part 1. Fix j≠0j \ne 0. Then ∑t=0N−1e−iλjt=0\sum_{t=0}^{N-1}\mathrm{e}^{-i\lambda_j t} = 0 by the discrete orthogonality relation of The discrete Fourier transform and the FFT, so replacing xtx_t by yt=xt−xˉy_t = x_t - \bar x changes JN(λj)J_N(\lambda_j) by −xˉ∑te−iλjt=0-\bar x\sum_t\mathrm{e}^{-i\lambda_j t} = 0, that is, not at all. Expanding the modulus squared as a double sum,

∣JN(λj)∣2=∑s=0N−1∑t=0N−1ysyt e−i(s−t)λj.\bigl\lvert J_N(\lambda_j)\bigr\rvert^{2} = \sum_{s=0}^{N-1}\sum_{t=0}^{N-1} y_sy_t\,\mathrm{e}^{-i(s-t)\lambda_j} .

Group the pairs by h=s−th = s - t, which runs over −(N−1),…,N−1-(N-1),\dots,N-1; for fixed h≥0h \ge 0 the admissible tt are 0,…,N−1−h0,\dots,N-1-h, and the inner sum is ∑tyt+hyt=Nc^(h)\sum_t y_{t+h}y_t = N\hat c(h) by the definition of c^\hat c, with the divisor NN cancelling. For h<0h<0 the same with ∣h∣\lvert h\rvert, since c^(−h)=c^(h)\hat c(-h) = \hat c(h). Hence ∣JN(λj)∣2=N∑∣h∣<Nc^(h)e−ihλj\lvert J_N(\lambda_j)\rvert^2 = N\sum_{\lvert h\rvert<N}\hat c(h)\mathrm{e}^{-ih\lambda_j}, and dividing by 2πN2\pi N gives the identity. Had we divided by N−∣h∣N - \lvert h\rvert in the definition of c^\hat c, the cancellation would not occur and each lag would be reweighted by N/(N−∣h∣)N/(N-\lvert h\rvert).

For the sum rule, the discrete Parseval identity of The discrete Fourier transform and the FFT, written for JN(λj)=Nx^(j)J_N(\lambda_j) = N\hat x(j), reads ∑j∣JN(λj)∣2=N∑t∣xt∣2\sum_{j}\lvert J_N(\lambda_j)\rvert^2 = N\sum_t\lvert x_t\rvert^2. Dividing by 2πN2\pi N and then multiplying by 2π/N2\pi/N gives the stated form.

Part 2. Write mt=wte−iλtm_t = w_t\mathrm{e}^{-i\lambda t}. Since EXt=0\mathbb{E}X_t = 0,

E∣∑twtXte−iλt∣2=∑s∑twswt E(XsXt) e−i(s−t)λ=∑s∑twswt c(s−t) e−i(s−t)λ,\mathbb{E}\Bigl\lvert\sum_t w_tX_t\mathrm{e}^{-i\lambda t}\Bigr\rvert^{2} = \sum_{s}\sum_{t} w_sw_t\,\mathbb{E}(X_sX_t)\,\mathrm{e}^{-i(s-t)\lambda} = \sum_{s}\sum_{t} w_sw_t\,c(s-t)\,\mathrm{e}^{-i(s-t)\lambda} ,

using stationarity in the last step to write E(XsXt)=c(s−t)\mathbb{E}(X_sX_t) = c(s-t). Absolute summability of cc lets us substitute the spectral representation c(s−t)=∫−ππei(s−t)μg(μ) dμc(s-t) = \int_{-\pi}^{\pi}\mathrm{e}^{i(s-t)\mu}g(\mu)\,d\mu of Stationary processes and spectral densities and exchange the finite double sum with the integral:

=∫−ππ(∑s∑twswt ei(s−t)(μ−λ))g(μ) dμ=∫−ππ∣∑twt eit(μ−λ)∣2g(μ) dμ,= \int_{-\pi}^{\pi}\Bigl(\sum_{s}\sum_{t}w_sw_t\,\mathrm{e}^{i(s-t)(\mu-\lambda)}\Bigr)g(\mu)\,d\mu = \int_{-\pi}^{\pi}\Bigl\lvert\sum_t w_t\,\mathrm{e}^{it(\mu-\lambda)}\Bigr\rvert^{2}g(\mu)\,d\mu ,

the bracket having factorised into a sum times its own conjugate because ww is real. Dividing by 2π∑twt22\pi\sum_tw_t^2 turns the integrand into ΦNw(μ−λ)g(μ)\Phi^w_N(\mu-\lambda)g(\mu), and ΦNw\Phi^w_N is even, which gives the stated form. That ∫ΦNw=1\int\Phi^w_N = 1 is the same computation with gg replaced by the constant 1/2π1/2\pi and cc by δh0\delta_{h0}, or directly from orthogonality of the exponentials.

For the untapered case set wt≡1w_t\equiv1 in the double sum and group by h=s−th = s-t as in part 1: the number of pairs with s−t=hs - t = h is N−∣h∣N - \lvert h\rvert, so

E IN(λ)=12πN∑∣h∣<N(N−∣h∣) c(h)e−ihλ=12π∑∣h∣<N(1−∣h∣N)c(h)e−ihλ.\mathbb{E}\,I_N(\lambda) = \frac{1}{2\pi N}\sum_{\lvert h\rvert<N}(N - \lvert h\rvert)\,c(h)\mathrm{e}^{-ih\lambda} = \frac{1}{2\pi}\sum_{\lvert h\rvert<N}\Bigl(1-\frac{\lvert h\rvert}{N}\Bigr)c(h)\mathrm{e}^{-ih\lambda} .

Subtracting this from g(λ)=(2π)−1∑hc(h)e−ihλg(\lambda) = (2\pi)^{-1}\sum_{h}c(h)\mathrm{e}^{-ih\lambda} and taking absolute values,

∣EIN(λ)−g(λ)∣  ≤  12π∑∣h∣<N∣h∣N∣c(h)∣+12π∑∣h∣≥N∣c(h)∣,\bigl\lvert\mathbb{E}I_N(\lambda) - g(\lambda)\bigr\rvert \;\le\; \frac{1}{2\pi}\sum_{\lvert h\rvert<N}\frac{\lvert h\rvert}{N}\lvert c(h)\rvert + \frac{1}{2\pi}\sum_{\lvert h\rvert\ge N}\lvert c(h)\rvert ,

with no λ\lambda on the right. The second sum is the tail of a convergent series and goes to 00. For the first, fix ε>0\varepsilon>0, choose HH with ∑∣h∣≥H∣c(h)∣<ε\sum_{\lvert h\rvert\ge H}\lvert c(h)\rvert<\varepsilon, and split at HH: the part with ∣h∣<H\lvert h\rvert<H is at most (H/N)∑h∣c(h)∣→0(H/N)\sum_h\lvert c(h)\rvert \to 0, and the part with ∣h∣≥H\lvert h\rvert \ge H is at most ε\varepsilon because ∣h∣/N≤1\lvert h\rvert/N \le 1. Hence the bound is eventually below 2ε/2π2\varepsilon/2\pi, which is uniform convergence. The closed form of ΦN\Phi_N is the geometric sum ∑t<Ne−iθt=e−i(N−1)θ/2sin⁡(Nθ/2)/sin⁡(θ/2)\sum_{t<N}\mathrm{e}^{-i\theta t} = \mathrm{e}^{-i(N-1)\theta/2}\sin(N\theta/2)/\sin(\theta/2), whose modulus squared is sin⁡2(Nθ/2)/sin⁡2(θ/2)\sin^2(N\theta/2)/\sin^2(\theta/2); the sidelobe figures are the local maxima of that function, which for large NN occur near θ=2π⋅1.43/N\theta = 2\pi\cdot1.43/N at 4.7%4.7\% of the central value N2N^2.

Part 3. Write JN(λj)=Aj−iBjJ_N(\lambda_j) = A_j - iB_j with

Aj=∑t=0N−1Xtcos⁡(λjt),Bj=∑t=0N−1Xtsin⁡(λjt).A_j = \sum_{t=0}^{N-1}X_t\cos(\lambda_j t), \qquad B_j = \sum_{t=0}^{N-1}X_t\sin(\lambda_j t) .

Both are linear combinations of the independent Gaussians XtX_t, so the whole family {Aj,Bj}\{A_j, B_j\} is jointly Gaussian with mean zero (The multivariate normal distribution), and its law is fixed by the covariances. With 0<j<N/20<j<N/2 and 0<k<N/20<k<N/2, independence of the XtX_t gives

cov⁡(Aj,Ak)=σ2∑tcos⁡(λjt)cos⁡(λkt),cov⁡(Aj,Bk)=σ2∑tcos⁡(λjt)sin⁡(λkt),\operatorname{cov}(A_j,A_k) = \sigma^2\sum_t\cos(\lambda_jt)\cos(\lambda_kt), \qquad \operatorname{cov}(A_j,B_k) = \sigma^2\sum_t\cos(\lambda_jt)\sin(\lambda_kt),

and similarly for cov⁡(Bj,Bk)\operatorname{cov}(B_j,B_k). These are the discrete trigonometric orthogonality sums of Arfken, Weber and Harris (Arfken, Weber & Harris (2013), Exercise 20.6.1, p. 1007): the cosine-sine sum vanishes always, and the cosine-cosine and sine-sine sums vanish for j≠kj\ne k and equal N/2N/2 for j=kj = k in the stated range, the exceptional values NN and 00 occurring only at j=0j = 0 and j=N/2j = N/2.

So AjA_j and BjB_j are independent N(0,σ2N/2)N(0,\sigma^2N/2) variables, independent also of Ak,BkA_k, B_k for k≠jk \ne j — for jointly Gaussian variables zero covariance is independence. Therefore

Aj2+Bj2σ2N/2  ∼  χ22,IN(λj)=Aj2+Bj22πN=σ24π⋅Aj2+Bj2σ2N/2  ∼  σ24πχ22,\frac{A_j^2+B_j^2}{\sigma^2N/2}\;\sim\;\chi^2_2 , \qquad I_N(\lambda_j) = \frac{A_j^2+B_j^2}{2\pi N} = \frac{\sigma^2}{4\pi}\cdot\frac{A_j^2+B_j^2}{\sigma^2N/2} \;\sim\; \frac{\sigma^2}{4\pi}\chi^2_2 ,

by the definition of the chi-squared distribution as a sum of squares of independent standard normals (Sampling distributions). Since g=σ2/2πg = \sigma^2/2\pi here, this is IN/g∼12χ22I_N/g \sim \tfrac12\chi^2_2. A χ22\chi^2_2 variable has mean 22 and variance 44, so EIN=g\mathbb{E}I_N = g and var⁡IN=(g/2)2⋅4=g2\operatorname{var}I_N = (g/2)^2\cdot4 = g^2; and 12χ22\tfrac12\chi^2_2 is the exponential distribution of mean 11, because the chi-squared density with two degrees of freedom is 12e−u/2\tfrac12\mathrm{e}^{-u/2}.

At j=0j=0, B0=0B_0 = 0 and A0=∑tXt∼N(0,Nσ2)A_0 = \sum_tX_t \sim N(0,N\sigma^2), so IN(0)=A02/(2πN)∼(σ2/2π)χ12I_N(0) = A_0^2/(2\pi N) \sim (\sigma^2/2\pi)\chi^2_1; the same happens at j=N/2j = N/2 for even NN, where sin⁡(πt)=0\sin(\pi t) = 0. This is the Hermitian symmetry Fp=FN−p∗F_p = F^*_{N-p} of Arfken, Weber and Harris (Arfken, Weber & Harris (2013), Exercise 20.6.3(a), p. 1007) seen from the probabilistic side: a real record of length NN has only NN independent real numbers in its transform, two at each of the ⌊(N−1)/2⌋\lfloor (N-1)/2\rfloor interior frequencies and one at each self-conjugate end.

Part 4. The KK segments are disjoint blocks of independent variables, hence independent, so it is enough to find the law of one tapered segment periodogram. Repeat the decomposition of part 3 with the taper carried along: for a single segment X0,…,XM−1X_0,\dots,X_{M-1} put

Aj=∑t=0M−1wtXtcos⁡(λjt),Bj=∑t=0M−1wtXtsin⁡(λjt),IMw(λj)=Aj2+Bj22π∑twt2,A_j = \sum_{t=0}^{M-1}w_tX_t\cos(\lambda_jt), \quad B_j = \sum_{t=0}^{M-1}w_tX_t\sin(\lambda_jt), \quad I^{w}_M(\lambda_j) = \frac{A_j^{2}+B_j^{2}}{2\pi\sum_tw_t^{2}} ,

with λj=2πj/M\lambda_j = 2\pi j/M. The pair (Aj,Bj)(A_j,B_j) is centred Gaussian, and independence of the XtX_t gives

var⁡Aj=σ2 ⁣∑twt2cos⁡2(λjt),var⁡Bj=σ2 ⁣∑twt2sin⁡2(λjt),cov⁡(Aj,Bj)=σ2 ⁣∑twt2cos⁡(λjt)sin⁡(λjt).\operatorname{var}A_j = \sigma^2\!\sum_t w_t^2\cos^2(\lambda_jt), \quad \operatorname{var}B_j = \sigma^2\!\sum_t w_t^2\sin^2(\lambda_jt), \quad \operatorname{cov}(A_j,B_j) = \sigma^2\!\sum_t w_t^2\cos(\lambda_jt)\sin(\lambda_jt) .

Adding the first two, var⁡Aj+var⁡Bj=σ2∑twt2\operatorname{var}A_j + \operatorname{var}B_j = \sigma^2\sum_tw_t^2 for every taper and every jj, so

E IMw(λj)=σ2∑twt22π∑twt2=σ22π=g\mathbb{E}\,I^{w}_M(\lambda_j) = \frac{\sigma^2\sum_tw_t^2}{2\pi\sum_tw_t^2} = \frac{\sigma^2}{2\pi} = g

exactly: the mean never depends on the taper. The difference, on the other hand, does. By the double-angle identities,

var⁡Aj−var⁡Bj=σ2∑twt2cos⁡(2λjt),2cov⁡(Aj,Bj)=σ2∑twt2sin⁡(2λjt),\operatorname{var}A_j - \operatorname{var}B_j = \sigma^2\sum_t w_t^2\cos(2\lambda_jt), \qquad 2\operatorname{cov}(A_j,B_j) = \sigma^2\sum_t w_t^2\sin(2\lambda_jt) ,

and these are the real and imaginary parts of σ2∑twt2e−2iλjt\sigma^2\sum_tw_t^2\mathrm{e}^{-2i\lambda_jt} up to a sign. So AjA_j and BjB_j are uncorrelated with the same variance 12σ2∑twt2\tfrac12\sigma^2\sum_tw_t^2 precisely when condition (T) holds. For wt≡1w_t\equiv1 the two sums are ∑tcos⁡(2λjt)\sum_t\cos(2\lambda_jt) and ∑tsin⁡(2λjt)\sum_t\sin(2\lambda_jt), which vanish unless 2λj2\lambda_j is 00 modulo 2π2\pi, that is unless 2j≡0(modM)2j \equiv 0 \pmod M; for 0<j<M/20<j<M/2 we have 0<2j<M0 < 2j < M, so (T) holds at every interior frequency and part 3 is recovered.

Where (T) holds, AjA_j and BjB_j are independent N(0,12σ2∑twt2)N(0,\tfrac12\sigma^2\sum_tw_t^2) — zero covariance is independence for a jointly Gaussian pair — so (Aj2+Bj2)/(12σ2∑twt2)∼χ22(A_j^2+B_j^2)\big/\bigl(\tfrac12\sigma^2\sum_tw_t^2\bigr)\sim\chi^2_2 and IMw(λj)∼(σ2/4π)χ22=12gχ22I^w_M(\lambda_j)\sim(\sigma^2/4\pi)\chi^2_2 = \tfrac12 g\chi^2_2, as in part 3. A sum of KK independent χ22\chi^2_2 variables is χ2K2\chi^2_{2K}, so KIˉ/g∼12χ2K2K\bar I/g\sim\tfrac12\chi^2_{2K}, that is Iˉ/g∼χ2K2/(2K)\bar I/g \sim \chi^2_{2K}/(2K). Its mean is 2K/(2K)=12K/(2K)=1 and its variance is 4K/(2K)2=1/K4K/(2K)^2 = 1/K, giving relative standard deviation K−1/2K^{-1/2}.

Where (T) fails, let Σ\Sigma be the covariance matrix of (Aj,Bj)(A_j,B_j) and σ12≥σ22\sigma_1^2\ge\sigma_2^2 its eigenvalues. Rotating the plane by an orthogonal matrix leaves Aj2+Bj2A_j^2+B_j^2 unchanged and diagonalises Σ\Sigma, so Aj2+Bj2A_j^2+B_j^2 has the law of σ12Z12+σ22Z22\sigma_1^2Z_1^2+\sigma_2^2Z_2^2 with Z1,Z2Z_1,Z_2 independent standard normal. Hence its mean is σ12+σ22=tr⁡Σ=σ2∑twt2\sigma_1^2+\sigma_2^2 = \operatorname{tr}\Sigma = \sigma^2\sum_tw_t^2, confirming the mean once more, while its variance is 2σ14+2σ242\sigma_1^4+2\sigma_2^4, so the relative standard deviation of one segment is

2(σ14+σ24)σ12+σ22  ≥  1,\frac{\sqrt{2(\sigma_1^4+\sigma_2^4)}}{\sigma_1^2+\sigma_2^2} \;\ge\; 1 ,

with equality only when σ1=σ2\sigma_1 = \sigma_2, that is only under (T); and a weighted sum of two chi-squares with unequal weights is not a multiple of χ22\chi^2_2. Averaging KK independent segments divides this ratio by K\sqrt K.

For the Hann taper wt=12(1−cos⁡(2πt/M))w_t = \tfrac12(1-\cos(2\pi t/M)) one has wt2=18(3−4cos⁡(2πt/M)+cos⁡(4πt/M))w_t^2 = \tfrac18\bigl(3 - 4\cos(2\pi t/M) + \cos(4\pi t/M)\bigr), a trigonometric polynomial carrying only the frequencies 0,±2π/M,±4π/M0,\pm2\pi/M,\pm4\pi/M. By discrete orthogonality, ∑twt2e−2iλjt\sum_tw_t^2\mathrm{e}^{-2i\lambda_jt} therefore vanishes unless 2λj2\lambda_j is one of those frequencies modulo 2π2\pi, that is unless 2j≡0,±1,±2(modM)2j\equiv0,\pm1,\pm2\pmod M; for even MM and 0<j<M/20<j<M/2 the only solutions are j=1j=1 and j=M/2−1j=M/2-1. At those two, ∑twt2=3M/8\sum_tw_t^2 = 3M/8 and ∑twt2cos⁡(2λjt)=M/16\sum_tw_t^2\cos(2\lambda_jt) = M/16 with the sine sum zero, so σ12=732σ2M\sigma_1^2 = \tfrac{7}{32}\sigma^2M and σ22=532σ2M\sigma_2^2 = \tfrac{5}{32}\sigma^2M and the ratio above is 2(72+52)/(7+5)=148/12=37/6=1.0138\sqrt{2(7^2+5^2)}/(7+5) = \sqrt{148}/12 = \sqrt{37}/6 = 1.0138, independently of MM. □\square

Remark(Where the hypotheses are used)Original
  • Stationarity is used once, in part 2, to replace E(XsXt)\mathbb{E}(X_sX_t) by a function of s−ts-t. Nothing else needs it: part 1 is an algebraic identity about numbers. This is why a periodogram of a record with a trend in it is not wrong so much as meaningless — the trend is a huge low-frequency feature whose sidelobes contaminate the whole spectrum, and no amount of averaging removes it. Detrend first.
  • Zero mean is assumed in part 2 and matters for the same reason. Adding a constant μ\mu to every xtx_t adds μ2ΦN(λ)\mu^2\Phi_N(\lambda) to the expectation of the periodogram — the cross term between the constant and the process averages to zero — and μ2ΦN\mu^2\Phi_N is, by the definition of ΦN\Phi_N, a copy of the whole spectral window, peak and sidelobes alike, centred on zero frequency. That is a term of size μ2N/2π\mu^2N/2\pi at λ=0\lambda=0 with sidelobes stretching across the band. Subtracting xˉ\bar x removes it exactly; part 1 is stated for j≠0j\ne0 because that is where subtracting the mean leaves JNJ_N unchanged, and the mean-removed periodogram is identically zero at j=0j=0.
  • Absolute summability of cc is used twice in part 2: to justify exchanging the double sum with the integral, and to make the tail estimate that gives uniform convergence. It is a sufficient condition, not a necessary one — Grimmett and Stirzaker (Grimmett & Stirzaker (2020), (9.3.18), p. 442) say so where they state it — and it excludes in particular every process with a spectral atom, such as a deterministic sinusoid of random phase, whose spectral distribution has a jump and no density. For those the periodogram does something different and better: at the matching Fourier frequency its value grows linearly in NN, which is how a line is detected rather than estimated. But an atom is not the only obstruction, and the summability is genuinely stronger than having a density: it also fails for processes whose spectral measure is absolutely continuous and whose autocovariance merely decays too slowly, the long-memory spectra with a singularity at the origin. The density g(λ)=log⁡2−log⁡∣2sin⁡(λ/2)∣g(\lambda) = \log 2 - \log\lvert 2\sin(\lambda/2)\rvert is non-negative, with minimum g(π)=0g(\pi)=0, and integrable, with total mass 2πlog⁡2=4.355172\pi\log2 = 4.35517, so it carries no atom whatever; yet its autocovariances are c(n)=π/∣n∣c(n) = \pi/\lvert n\rvert for n≠0n\ne0, and ∑n∣c(n)∣\sum_n\lvert c(n)\rvert diverges harmonically. More generally c(n)∼∣n∣−αc(n)\sim\lvert n\rvert^{-\alpha} with 0<α≤10<\alpha\le1 goes with an integrable ∣λ∣α−1\lvert\lambda\rvert^{\alpha-1} singularity of gg at λ=0\lambda=0 and is never summable. Part 2 therefore says nothing about exactly the case in which periodogram bias is worst — a spectrum that climbs without bound at low frequency, where the window's sidelobes have an unbounded feature to draw power from.
  • Gaussianity is used only in part 3, to pass from uncorrelated to independent and to name the law. Without it, EIN\mathbb{E}I_N and var⁡IN\operatorname{var}I_N are unchanged to leading order but the distribution is not chi-squared at finite NN. The qualitative conclusion — relative error of order one, not shrinking with NN — is not special to the Gaussian case.
  • Whiteness is used in part 3 to make the covariance sums collapse to the orthogonality relations. The corresponding statement for a general Gaussian stationary process with a continuous, strictly positive spectral density is that IN(λj)/g(λj)→12χ22I_N(\lambda_j)/g(\lambda_j) \to \tfrac12\chi^2_2 in distribution, independently across fixed distinct frequencies; we state this without proof, and use only the white-noise case, which is exact at every NN and is also the case that matters for setting detection thresholds.
  • Condition (T) is what part 4 needs of the taper, and only for the distributional claim: the mean EIˉ=g\mathbb{E}\bar I = g holds for every taper at every frequency, because it depends on ∑twt2\sum_tw_t^2 alone. What (T) buys is that the cosine and sine amplitudes be uncorrelated and of equal variance, which is what makes the two of them a χ22\chi^2_2 rather than a weighted sum of two χ12\chi^2_1s. Dropping it costs little in practice — for the Hann taper it fails at two frequencies out of M/2M/2, and inflates the standard deviation there by 1.4%1.4\% — but the law is then not exactly chi-squared, and the error bars of step 8 are correspondingly approximate at those frequencies.
  • Independence of segments is used in part 4, both to add the chi-squared variables and to divide the variance by KK. Welch's overlapped segments are not independent, so the effective count of degrees of freedom is not 2K2K and has to be worked out for the particular taper and overlap; quoting 2K2K for overlapped segments is a genuine, if usually small, misstatement of the error bars.
  • Equispaced samples are assumed everywhere. For a gapped or irregular record the exponentials are no longer orthogonal, ΦN\Phi_N acquires large sidelobes at the gap frequencies, and the clean statements above all fail.
Method(Estimating a spectrum from a record)Original
  1. Check the sampling. Frequencies above π/Δ\pi/\Delta cannot be represented and appear folded back onto lower ones; this is the aliasing of Arfken, Weber and Harris's (Arfken, Weber & Harris (2013), Example 20.6.1, p. 1006) Example 20.6.1 and of The sampling theorem. Aliasing is a property of the measurement, not of the analysis, and must be prevented by an anti-alias filter (Linear filters) before sampling, not after.
  2. Remove the mean, then any trend, by least squares (Least-squares fitting); remove a known periodic cycle too if it is not the object of study. Record how many parameters you removed.
  3. Choose the trade-off. Decide the frequency resolution δλ\delta\lambda you need; that fixes the segment length M≈2π/δλM \approx 2\pi/\delta\lambda, and then K=⌊N/M⌋K = \lfloor N/M\rfloor segments fix the relative error K−1/2K^{-1/2}. Doing this consciously, in this order, is the entire design.
  4. Taper each segment. A Hann taper wt=12(1−cos⁡(2πt/M))w_t = \tfrac12\bigl(1-\cos(2\pi t/M)\bigr) is the default: it lowers the first sidelobe from the −13.3-13.3 decibels of the untapered window to about −31.5-31.5 decibels, at the cost of a main lobe twice as wide. Use no taper only when the spectrum is known to be nearly flat, and a more aggressive taper when a strong line sits near a weak feature.
  5. Transform and square. Compute ∑twtxte−iλjt\sum_t w_tx_t\mathrm{e}^{-i\lambda_jt} by the FFT (The discrete Fourier transform and the FFT), take the squared modulus, divide by 2π∑twt22\pi\sum_tw_t^2.
  6. Average the segments and, if more smoothness is wanted, additionally average over adjacent frequencies; LL neighbouring bins multiply the degrees of freedom by about LL and widen the resolution by the same factor.
  7. Check the scale. Verify 2πM∑jIˉ(λj)≈\frac{2\pi}{M}\sum_j\bar I(\lambda_j) \approx the sample variance of the record. If it does not, a factor of 2π2\pi, of NN, or of Δ\Delta is wrong. Convert to physical units at the very end: density per unit angular frequency is ΔIˉ\Delta\bar I, per unit ordinary frequency 2πΔIˉ2\pi\Delta\bar I.
  8. Put error bars on, and compare with a null. With ν\nu degrees of freedom the interval [νIˉ/q1−α/2, νIˉ/qα/2][\nu\bar I/q_{1-\alpha/2},\ \nu\bar I/q_{\alpha/2}], with qpq_p the pp-quantile of χν2\chi^2_\nu, covers g(λ)g(\lambda) with probability 1−α1-\alpha (Confidence intervals); plot it on a logarithmic axis, where its width is the same at every frequency. A peak counts as detected only against a stated null spectrum, usually the red-noise spectrum of Autoregressive models and red noise rather than a flat one, and only after allowing for the number of frequencies searched (Hypothesis testing).
Example(A line, its leakage, and the bias of a smooth spectrum)Original

Part A: a line exactly on the grid. Take N=8N = 8 and xt=3+2cos⁡(πt/2)x_t = 3 + 2\cos(\pi t/2) for t=0,…,7t = 0,\dots,7, that is the record (5,3,1,3,5,3,1,3)(5,3,1,3,5,3,1,3). Its mean is 33; subtracting it leaves yt=(2,0,−2,0,2,0,−2,0)y_t = (2,0,-2,0,2,0,-2,0). The frequency π/2\pi/2 is λ2=2π⋅2/8\lambda_2 = 2\pi\cdot2/8, a Fourier frequency, so write yt=eiλ2t+e−iλ2ty_t = \mathrm{e}^{i\lambda_2 t} + \mathrm{e}^{-i\lambda_2t}. Then

J8(λ2)=∑t=07(eiλ2t+e−iλ2t)e−iλ2t=8+0=8,J_8(\lambda_2) = \sum_{t=0}^{7}\bigl(\mathrm{e}^{i\lambda_2t}+\mathrm{e}^{-i\lambda_2t}\bigr)\mathrm{e}^{-i\lambda_2t} = 8 + 0 = 8 ,

the second sum vanishing by orthogonality, and likewise J8(λ6)=8J_8(\lambda_6) = 8 while J8(λj)=0J_8(\lambda_j) = 0 for every other jj. Hence

I8(λ2)=I8(λ6)=822π⋅8=4π=1.27324,I_8(\lambda_2) = I_8(\lambda_6) = \frac{8^2}{2\pi\cdot8} = \frac{4}{\pi} = 1.27324 ,

and zero elsewhere. Check with part 1: 2π8(2⋅4π)=2\frac{2\pi}{8}\bigl(2\cdot\frac4\pi\bigr) = 2, and the mean square of yy is (4+4+4+4)/8=2(4+4+4+4)/8 = 2. The two agree. Note what happens if the mean is not removed: J8(0)=24J_8(0) = 24, so I8(0)=576/(16π)=11.459I_8(0) = 576/(16\pi) = 11.459, nine times the signal peak, sitting where no signal is.

Part B: the same line half a bin off, with and without a taper. Now take N=16N = 16 and xt=cos⁡(2π⋅3.5 t/16)x_t = \cos(2\pi\cdot3.5\,t/16), a frequency exactly between λ3\lambda_3 and λ4\lambda_4. The record no longer contains a whole number of cycles, so no single J16(λj)J_{16}(\lambda_j) captures it. Computing the sixteen values gives, for the untapered periodogram,

I16(λ3)=0.25121,I16(λ4)=0.27130,I16(λ2)=0.02892,I16(λ5)=0.03538, …I_{16}(\lambda_3) = 0.25121, \quad I_{16}(\lambda_4) = 0.27130, \quad I_{16}(\lambda_2) = 0.02892, \quad I_{16}(\lambda_5) = 0.03538, \ \dots

with total ∑jI16(λj)=4/π=1.27324\sum_jI_{16}(\lambda_j) = 4/\pi = 1.27324. The two bins flanking the true frequency hold

2(0.25121+0.27130)1.27324=82.08%\frac{2(0.25121+0.27130)}{1.27324} = 82.08\%

of the power (the factor 22 counts the mirror bins λ12,λ13\lambda_{12},\lambda_{13}), the nearest four hold 92.18%92.18\%, and the remaining 7.8%7.8\% is spread over the rest of the spectrum. That residue is leakage, and it is what a weak feature elsewhere in the spectrum has to compete with. Repeating with the Hann taper wt=12(1−cos⁡(2πt/16))w_t = \tfrac12(1-\cos(2\pi t/16)) gives 96.14%96.14\% in the two nearest bins and 99.93%99.93\% in the nearest four: leakage falls by more than two orders of magnitude. The taper concentrates the peak better here, which is a feature of the half-bin offset: it is the offset that excites the untapered sidelobes maximally, and those sidelobes, 1818 decibels above the Hann ones, carry away more than the wider Hann main lobe does. The price of the taper is paid not here but in resolution, because the main lobe is twice as wide, 8π/N8\pi/N against 4π/N4\pi/N: two lines between one and two bins apart, which the untapered window still shows as two peaks, the Hann window merges into one.

Part C: the bias on a smooth spectrum. Let Xn=Zn+θZn−1X_n = Z_n + \theta Z_{n-1} with the ZnZ_n uncorrelated of mean 00 and variance σ2\sigma^2. This is the moving average process of Grimmett and Stirzaker's (Grimmett & Stirzaker (2020), §9.7, Problem 7(a), p. 468) Problem 7 in §9.7, who write the coefficient α\alpha for our θ\theta and take the ZnZ_n to have unit variance; we keep a general σ2\sigma^2, which only multiplies everything below. Its autocovariance is c(0)=(1+θ2)σ2c(0) = (1+\theta^2)\sigma^2, c(±1)=θσ2c(\pm1) = \theta\sigma^2 and c(h)=0c(h) = 0 for ∣h∣≥2\lvert h\rvert\ge2, so by the inversion formula

g(λ)=σ22π(1+θ2+2θcos⁡λ).g(\lambda) = \frac{\sigma^2}{2\pi}\bigl(1 + \theta^2 + 2\theta\cos\lambda\bigr) .

Because only the lags 00 and ±1\pm1 are present, part 2 gives the expectation of the untapered periodogram in closed form at every NN:

E IN(λ)=σ22π(1+θ2+2θ(1−1N)cos⁡λ)=g(λ)−θσ2cos⁡λπN.\mathbb{E}\,I_N(\lambda) = \frac{\sigma^2}{2\pi}\Bigl(1+\theta^2 + 2\theta\Bigl(1-\frac1N\Bigr)\cos\lambda\Bigr) = g(\lambda) - \frac{\theta\sigma^2\cos\lambda}{\pi N} .

Put θ=12\theta = \tfrac12, σ2=1\sigma^2 = 1, N=8N = 8. At λ=0\lambda = 0 the truth is g(0)=2.25/2π=0.358099g(0) = 2.25/2\pi = 0.358099 and the expectation is 2.125/2π=0.3382042.125/2\pi = 0.338204, low by 5.56%5.56\%. At λ=π\lambda = \pi the truth is g(π)=0.25/2π=0.039789g(\pi) = 0.25/2\pi = 0.039789 and the expectation is 0.375/2π=0.0596830.375/2\pi = 0.059683, high by exactly 50%50\%. The absolute bias is the same at both ends, 0.019894=1/(16π)0.019894 = 1/(16\pi); it is the relative bias that explodes where the spectrum is small, which is the general rule and the reason spectra are plotted on a logarithmic axis. At λ=π/2\lambda = \pi/2, where cos⁡λ=0\cos\lambda = 0, the periodogram is exactly unbiased at every NN.

ApplicationOriginal

Detecting periodicity against a coloured background. The periodogram of a palaeoclimate record is how the Milankovitch periods near 1919, 2323, 4141 and 100100 thousand years were established; the periodogram of a stellar light curve is how a pulsation mode is identified. In both cases the finding is not the peak but the peak's height relative to a fitted null spectrum and to the number of frequencies searched. Part 3 is the reason this must be done carefully: a raw periodogram of pure red noise produces, at each of N/2N/2 frequencies independently, an exponential variable, so the largest of them exceeds its mean by a factor ln⁡(N/2)\ln(N/2) as a matter of course — about 66 for a record of a thousand points. Peaks of that size are the null hypothesis, not evidence against it.

Instrument noise characterisation. The specification of an amplifier, an accelerometer or a gravitational-wave detector is quoted as an amplitude spectral density, g(λ)\sqrt{g(\lambda)} in units of signal per root hertz, and is measured by exactly the Welch procedure of part 4: minutes of data, split into hundreds of overlapping tapered segments, averaged. Here the smooth broadband shape is the quantity of interest and resolution is worth little, so KK is taken as large as the record allows. The narrow lines that stick out of such a spectrum — mains hum and its harmonics, mechanical resonances — are diagnosed by the opposite choice, one long untapered transform.

Turbulence and the inertial range. Measuring the exponent in a power-law spectrum g(λ)∝λ−5/3g(\lambda)\propto\lambda^{-5/3} is a case where leakage, not variance, is the enemy: the spectrum spans many decades, so the sidelobes of the untapered window at the energetic large scales sit above the true signal at the small scales and flatten the measured slope. Part 2 quantifies this, and the remedy is the taper of step 4 rather than more averaging.

Method

Linear filters

Adapted

Shows that a linear time-invariant operation on a signal is a convolution, that complex exponentials pass through it unchanged except for multiplication by its transfer function, and that it multiplies the power spectral density of a stationary process by the squared gain; then turns those facts into a design recipe for moving averages and for low-pass, high-pass and band-pass filters, with the Gibbs ripple and the causality constraint that limit what can be built.

Prerequisites: The convolution theorem, The Fourier transform, Fourier inversion, The discrete Fourier transform and the FFT, Mean-square convergence and Parseval's identity, The Gibbs phenomenon, Cesàro means and Fejér's theorem, Stationary processes and spectral densities

Definition(Filters, impulse response, transfer function)AdaptedAdapted from Arfken, Weber & Harris (2013), §20.5, Eqs. (20.100)-(20.106), pp. 997-999

A filter is a map LL taking an input signal to an output signal which is

  • linear: L(αx1+βx2)=αLx1+βLx2L(\alpha x_1 + \beta x_2) = \alpha Lx_1 + \beta Lx_2, and
  • time-invariant: delaying the input by any amount delays the output by the same amount and changes nothing else.

In continuous time the input is x:R→Cx:\mathbb{R}\to\mathbb{C} and the output is

y(t)  =  (Φ∗x)(t)  =  ∫−∞∞Φ(t−t′) x(t′) dt′,y(t) \;=\; (\Phi * x)(t) \;=\; \int_{-\infty}^{\infty}\Phi(t-t')\,x(t')\,dt' ,

with Φ\Phi the impulse response, the output produced by a unit impulse at the origin. Its Fourier transform

φ(ω)  =  ∫−∞∞Φ(t) e−iωt dt\varphi(\omega) \;=\; \int_{-\infty}^{\infty}\Phi(t)\,\mathrm{e}^{-i\omega t}\,dt

is the transfer function; Arfken, Weber and Harris (Arfken, Weber & Harris (2013), §20.5, Eq. (20.102), p. 998) introduce it the other way round, as the factor by which the device multiplies a pure input frequency, and draw it as a labelled box between an input and an output wire.

In discrete time the input is a sequence (xn)(x_n) and the filter is given by its weights (ak)k∈Z(a_k)_{k\in\mathbb{Z}},

yn  =  ∑k∈Zak xn−k,y_n \;=\; \sum_{k\in\mathbb{Z}} a_k\,x_{n-k} ,

assumed throughout to satisfy ∑k∣ak∣<∞\sum_k\lvert a_k\rvert<\infty. Its transfer function is the 2π2\pi-periodic function

A(λ)  =  ∑k∈Zak e−ikλ,λ∈(−π,π],A(\lambda) \;=\; \sum_{k\in\mathbb{Z}} a_k\,\mathrm{e}^{-ik\lambda}, \qquad \lambda\in(-\pi,\pi] ,

whose modulus ∣A(λ)∣\lvert A(\lambda)\rvert is the gain and whose argument −arg⁡A(λ)-\arg A(\lambda) is the phase lag at frequency λ\lambda. The power gain is ∣A∣2\lvert A\rvert^2, and a frequency at which the power gain is half its maximum is a half-power point.

A filter is causal when the output at tt uses no input from after tt: Φ(t)=0\Phi(t) = 0 for t<0t<0, or ak=0a_k = 0 for k<0k<0. It is finite (FIR) when only finitely many aka_k are non-zero, and recursive (IIR) when yny_n is computed from earlier outputs as well as inputs; the autoregressive schemes of Autoregressive models and red noise are the standard recursive filters, and are not treated here.

Three special cases name themselves. A filter is a low-pass when ∣A∣\lvert A\rvert is near 11 for small ∣λ∣\lvert\lambda\rvert and near 00 near λ=π\lambda = \pi, a high-pass when the roles are exchanged, and a band-pass when ∣A∣\lvert A\rvert is near 11 only on an interval 0<λ1<∣λ∣<λ2<π0<\lambda_1<\lvert\lambda\rvert<\lambda_2<\pi. A moving average is a low-pass filter with non-negative weights summing to 11.

Method(What a filter does to a signal and to a spectrum)AdaptedAdapted from Arfken, Weber & Harris (2013), §20.5, Eqs. (20.102)-(20.106) and (20.110)-(20.113), pp. 998-1001; Grimmett & Stirzaker (2020), §9.7, Problem 2, p. 468

Let LL be a filter as above.

1. Complex exponentials are its eigenfunctions. In discrete time, feeding xn=einλx_n = \mathrm{e}^{in\lambda} into the filter gives

yn  =  A(λ) einλ,y_n \;=\; A(\lambda)\,\mathrm{e}^{in\lambda} ,

and in continuous time x(t)=eiωtx(t) = \mathrm{e}^{i\omega t} gives y(t)=φ(ω)eiωty(t) = \varphi(\omega)\mathrm{e}^{i\omega t}. A filter changes the amplitude and the phase of each frequency and nothing else; it creates no new frequency. This is the assumption Arfken, Weber and Harris (Arfken, Weber & Harris (2013), §20.5, Eq. (20.102), p. 998) make explicitly as the definition of a linear response, listing its three parts: same frequency out as in, output proportional to input, and no interference between frequencies present at once.

2. Equivalently, the transform multiplies. Lx^(ω)=φ(ω)x^(ω)\widehat{Lx}(\omega) = \varphi(\omega)\hat x(\omega), by the convolution theorem (The convolution theorem). Running the identification backwards recovers the convolution: because the output 12π∫φ(ω)x^(ω)eiωtdω\frac{1}{2\pi}\int\varphi(\omega)\hat x(\omega)\mathrm{e}^{i\omega t}d\omega is the inverse transform of a product, it is a convolution, which is how Arfken, Weber and Harris reach their Eq. (20.104). For a cascade of two filters the transfer functions multiply, φ=φ2φ1\varphi = \varphi_2\varphi_1, and the impulse responses convolve.

3. Real weights make the gain even and the phase odd; symmetric weights make the phase zero. If every aka_k is real then A(−λ)=A(λ)‾A(-\lambda) = \overline{A(\lambda)}, so ∣A∣\lvert A\rvert is even and arg⁡A\arg A is odd, and a real input gives a real output. If in addition a−k=aka_{-k} = a_k, then

A(λ)=a0+2∑k≥1akcos⁡kλA(\lambda) = a_0 + 2\sum_{k\ge1}a_k\cos k\lambda

is real, so the filter delays nothing: the only phase it can apply is a sign, 00 where A>0A>0 and π\pi where A<0A<0. A symmetric filter is never causal, apart from the trivial multiple of the identity, and a causal filter is never zero-phase; Arfken, Weber and Harris (Arfken, Weber & Harris (2013), §20.5, Eqs. (20.110)-(20.113), pp. 1000-1001) show the continuous-time form of the obstruction, that causality ties the real and imaginary parts of φ\varphi together through the relation

∫0∞u(ω)cos⁡ωt dω=−∫0∞v(ω)sin⁡ωt dω(t>0),φ=u+iv.\int_0^{\infty}u(\omega)\cos\omega t\,d\omega = -\int_0^{\infty}v(\omega)\sin\omega t\,d\omega \qquad (t>0), \qquad \varphi = u+iv .

A filter run forwards and then backwards over a stored record has transfer function ∣A∣2\lvert A\rvert^2, which is real and non-negative: that is how zero phase is obtained in practice from a causal design.

4. Spectral transfer. Let X={Xn}X = \{X_n\} be real, weakly stationary, with autocovariance cXc_X and power spectral density gX(λ)=(2π)−1∑ncX(n)e−inλg_X(\lambda) = (2\pi)^{-1}\sum_n c_X(n)\mathrm{e}^{-in\lambda}, and let Yn=∑kakXn−kY_n = \sum_k a_kX_{n-k} with real weights and ∑k∣ak∣<∞\sum_k\lvert a_k\rvert<\infty. Then YY is weakly stationary, with

cY(m)  =  ∑j∑kajak cX(m−k+j)and  gY(λ)  =  ∣A(λ)∣2 gX(λ)  c_Y(m) \;=\; \sum_{j}\sum_{k} a_ja_k\,c_X(m-k+j) \qquad\text{and}\qquad \boxed{\;g_Y(\lambda) \;=\; \bigl\lvert A(\lambda)\bigr\rvert^{2}\,g_X(\lambda)\;}

for every λ∈(−π,π]\lambda\in(-\pi,\pi]. In particular, for white noise input of variance σ2\sigma^2, where gX≡σ2/2πg_X \equiv \sigma^2/2\pi,

gY(λ)=σ22π∣A(λ)∣2,var⁡Yn=σ2∑kak2.g_Y(\lambda) = \frac{\sigma^2}{2\pi}\lvert A(\lambda)\rvert^{2}, \qquad \operatorname{var}Y_n = \sigma^{2}\sum_k a_k^{2} .

Grimmett and Stirzaker (Grimmett & Stirzaker (2020), §9.7, Problem 2, p. 468) state this as Problem 2 of §9.7, for a one-sided finite filter Xn=∑k=0rakYn−kX_n = \sum_{k=0}^{r}a_kY_{n-k} and in terms of the normalised spectral density of the autocorrelation function, in which form a ratio of variances appears:

fout(λ)=σin2σout2 fin(λ) ∣Ga(eiλ)∣2,Ga(z)=∑k=0rakzk.f_{\text{out}}(\lambda) = \frac{\sigma_{\text{in}}^2}{\sigma_{\text{out}}^2}\,f_{\text{in}}(\lambda)\,\bigl\lvert G_a(\mathrm{e}^{i\lambda})\bigr\rvert^{2}, \qquad G_a(z) = \sum_{k=0}^{r}a_kz^{k} .

Multiplying both sides by σout2\sigma^2_{\text{out}} turns their statement into the boxed one, since g=σ2fg = \sigma^2f and ∣Ga(eiλ)∣=∣A(λ)∣\lvert G_a(\mathrm{e}^{i\lambda})\rvert = \lvert A(\lambda)\rvert for real weights. The boxed form is the one used below.

Idea of the proofOriginal

A filter commutes with time shifts, and the complex exponentials are exactly the signals that a time shift multiplies by a constant. So in the basis of exponentials the filter must be diagonal, and the number sitting on the diagonal at frequency λ\lambda is the transfer function. Everything in the statement is a restatement of that one sentence: the convolution form is the diagonal operator written in the time domain, the cascade rule is that diagonal matrices commute and multiply entrywise, and the spectral transfer is the same diagonalisation applied to the second moments rather than to the signal.

For part 4 the only extra ingredient is that the autocovariance is itself a superposition of exponentials, cX(h)=∫eihλgX(λ)dλc_X(h) = \int\mathrm{e}^{ih\lambda}g_X(\lambda)d\lambda. Expanding cYc_Y as a double sum over the weights and substituting that representation lets the two sums be done separately, one producing ∑jajeijλ\sum_ja_j\mathrm{e}^{ij\lambda} and the other its complex conjugate; their product is ∣A∣2\lvert A\rvert^2. The squaring is not an accident of the algebra: covariance is quadratic in the signal, so a filter that halves an amplitude quarters the power at that frequency.

Proof(Parts 1-4)AdaptedAdapted from Arfken, Weber & Harris (2013), §20.5, pp. 998-999; Grimmett & Stirzaker (2020), §9.7, Problem 2, p. 468

Part 1. Substitute xn=einλx_n = \mathrm{e}^{in\lambda} into the definition:

yn=∑kak ei(n−k)λ=(∑kake−ikλ)einλ=A(λ) einλ,y_n = \sum_k a_k\,\mathrm{e}^{i(n-k)\lambda} = \Bigl(\sum_k a_k\mathrm{e}^{-ik\lambda}\Bigr)\mathrm{e}^{in\lambda} = A(\lambda)\,\mathrm{e}^{in\lambda} ,

the factorisation being legitimate because ei(n−k)λ=einλe−ikλ\mathrm{e}^{i(n-k)\lambda} = \mathrm{e}^{in\lambda}\mathrm{e}^{-ik\lambda} and the series converges absolutely, by the hypothesis ∑k∣ak∣<∞\sum_k\lvert a_k\rvert<\infty and ∣e−ikλ∣=1\lvert\mathrm{e}^{-ik\lambda}\rvert = 1. The continuous-time computation is the same with an integral: ∫Φ(t−t′)eiωt′dt′=eiωt∫Φ(u)e−iωudu\int\Phi(t-t')\mathrm{e}^{i\omega t'}dt' = \mathrm{e}^{i\omega t}\int\Phi(u)\mathrm{e}^{-i\omega u}du after the substitution u=t−t′u = t-t'.

Part 2. The identity Φ∗x^=Φ^x^=φx^\widehat{\Phi*x} = \hat\Phi\hat x = \varphi\hat x is the convolution theorem of The convolution theorem, which needs only Φ,x∈L1(R)\Phi, x\in L^1(\mathbb{R}). For the cascade, apply it twice: L2L1x^=φ2L1x^=φ2φ1x^\widehat{L_2L_1x} = \varphi_2\widehat{L_1x} = \varphi_2\varphi_1\hat x, and by uniqueness of the transform (Fourier inversion) the composite filter is the one with transfer function φ2φ1\varphi_2\varphi_1, whose impulse response is Φ2∗Φ1\Phi_2*\Phi_1.

Part 3. If the aka_k are real then A(λ)‾=∑kakeikλ=A(−λ)\overline{A(\lambda)} = \sum_k a_k\mathrm{e}^{ik\lambda} = A(-\lambda), from which ∣A(−λ)∣=∣A(λ)∣\lvert A(-\lambda)\rvert = \lvert A(\lambda)\rvert and arg⁡A(−λ)=−arg⁡A(λ)\arg A(-\lambda) = -\arg A(\lambda). If moreover a−k=aka_{-k} = a_k, pair the terms kk and −k-k:

A(λ)=a0+∑k≥1ak(e−ikλ+eikλ)=a0+2∑k≥1akcos⁡kλ,A(\lambda) = a_0 + \sum_{k\ge1}a_k\bigl(\mathrm{e}^{-ik\lambda}+\mathrm{e}^{ik\lambda}\bigr) = a_0 + 2\sum_{k\ge1}a_k\cos k\lambda ,

a real number. A real AA has argument 00 or π\pi, which is the claim. Symmetry forces a−k=ak≠0a_{-k} = a_k \ne 0 for some k>0k>0 unless the filter is a multiple of the identity, so a symmetric filter is not causal. For the forward-backward trick, running the filter backwards over a stored record applies the weights a−ka_{-k}, whose transfer function is ∑ka−ke−ikλ=A(λ)‾\sum_ka_{-k}\mathrm{e}^{-ik\lambda} = \overline{A(\lambda)} for real weights, and by the cascade rule the two passes compose to AA‾=∣A∣2A\overline{A} = \lvert A\rvert^2. The causality relations are Arfken, Weber and Harris's (Arfken, Weber & Harris (2013), §20.5, Eqs. (20.111)-(20.113), pp. 1000-1001) Eqs. (20.111)-(20.113), obtained by splitting φ(ω)=∫0∞Φ(t)e−iωtdt\varphi(\omega) = \int_0^{\infty}\Phi(t)\mathrm{e}^{-i\omega t}dt into real and imaginary parts, observing that the first is even and the second odd in ω\omega, and inverting each as a cosine and as a sine transform of the same Φ\Phi.

Part 4. YnY_n has constant mean EYn=(∑kak)EX0\mathbb{E}Y_n = (\sum_ka_k)\mathbb{E}X_0, finite because ∑k∣ak∣<∞\sum_k\lvert a_k\rvert<\infty. Take EXn=0\mathbb{E}X_n = 0 without loss of generality, by subtracting the mean from both sides. Then

cY(m)=E(YnYn+m)=E(∑jajXn−j∑kakXn+m−k)=∑j∑kajak cX(m−k+j),c_Y(m) = \mathbb{E}\bigl(Y_nY_{n+m}\bigr) = \mathbb{E}\Bigl(\sum_ja_jX_{n-j}\sum_ka_kX_{n+m-k}\Bigr) = \sum_j\sum_k a_ja_k\,c_X\bigl(m-k+j\bigr) ,

where the expectation has been taken inside the double sum — justified because ∑j,k∣ajak∣ E∣Xn−jXn+m−k∣≤cX(0)(∑k∣ak∣)2<∞\sum_{j,k}\lvert a_ja_k\rvert\,\mathbb{E}\lvert X_{n-j}X_{n+m-k}\rvert \le c_X(0)\bigl(\sum_k\lvert a_k\rvert\bigr)^2 <\infty by the Cauchy-Schwarz inequality applied to each term — and stationarity of XX has been used to write E(Xn−jXn+m−k)=cX((n+m−k)−(n−j))\mathbb{E}(X_{n-j}X_{n+m-k}) = c_X((n+m-k)-(n-j)). The right-hand side depends on mm alone, so YY is weakly stationary.

Now substitute the spectral representation cX(h)=∫−ππeihλgX(λ) dλc_X(h) = \int_{-\pi}^{\pi}\mathrm{e}^{ih\lambda}g_X(\lambda)\,d\lambda of Stationary processes and spectral densities and exchange the sums with the integral, which is permitted because ∑j,k∣ajak∣∫∣gX∣=cX(0)(∑∣ak∣)2<∞\sum_{j,k}\lvert a_ja_k\rvert\int\lvert g_X\rvert = c_X(0)(\sum\lvert a_k\rvert)^2<\infty and gX≥0g_X\ge0:

cY(m)=∫−ππeimλ(∑jajeijλ)(∑kake−ikλ)gX(λ) dλ=∫−ππeimλ ∣A(λ)∣2gX(λ) dλ,c_Y(m) = \int_{-\pi}^{\pi}\mathrm{e}^{im\lambda}\Bigl(\sum_j a_j\mathrm{e}^{ij\lambda}\Bigr)\Bigl(\sum_k a_k\mathrm{e}^{-ik\lambda}\Bigr)g_X(\lambda)\,d\lambda = \int_{-\pi}^{\pi}\mathrm{e}^{im\lambda}\,\bigl\lvert A(\lambda)\bigr\rvert^{2}g_X(\lambda)\,d\lambda ,

the last step because for real weights ∑jajeijλ=A(λ)‾\sum_ja_j\mathrm{e}^{ij\lambda} = \overline{A(\lambda)} while ∑kake−ikλ=A(λ)\sum_ka_k\mathrm{e}^{-ik\lambda} = A(\lambda). So cYc_Y is the Fourier coefficient sequence of the function ∣A∣2gX\lvert A\rvert^2g_X, which is non-negative and integrable; by the uniqueness of the spectral distribution (Stationary processes and spectral densities) this function is the power spectral density of YY, which is the boxed identity.

For the white-noise specialisation, gX=σ2/2πg_X = \sigma^2/2\pi is constant, so gY=σ2∣A∣2/2πg_Y = \sigma^2\lvert A\rvert^2/2\pi and

var⁡Yn=cY(0)=∫−ππσ22π∣A(λ)∣2 dλ=σ2∑kak2,\operatorname{var}Y_n = c_Y(0) = \int_{-\pi}^{\pi}\frac{\sigma^2}{2\pi}\lvert A(\lambda)\rvert^2\,d\lambda = \sigma^2\sum_k a_k^2 ,

the last equality being Parseval's identity for the Fourier series AA (Mean-square convergence and Parseval's identity); it also follows directly from the double sum with cX(h)=σ2δh0c_X(h) = \sigma^2\delta_{h0}. □\square

Remark(Where the hypotheses are used)Original
  • Absolute summability of the weights is used three times: to factor the series in part 1, to take the expectation inside the double sum in part 4, and to make AA a continuous function. It fails for the one filter everybody wants. The ideal low-pass, A(λ)=1A(\lambda) = 1 for ∣λ∣≤λc\lvert\lambda\rvert\le\lambda_c and 00 beyond, has weights a0=λc/πa_0 = \lambda_c/\pi and ak=sin⁡(kλc)/(πk)a_k = \sin(k\lambda_c)/(\pi k), which decay like 1/k1/k and are not absolutely summable. Truncating them to ∣k∣≤K\lvert k\rvert\le K gives a filter whose gain overshoots to about 1.091.09 just inside the passband and dips to about −0.09-0.09 just inside the stopband, however large KK is: this is the Gibbs phenomenon of The Gibbs phenomenon, and a negative gain in what was supposed to be a stopband is a real defect, not a cosmetic one. Multiplying the truncated weights by a taper (the Bartlett weights 1−∣k∣/K1-\lvert k\rvert/K give the Fejer means of Cesàro means and Fejér's theorem) removes the overshoot entirely, at the price of a transition band about twice as wide. A brick wall is not available at any finite cost.
  • Time invariance is what makes exponentials eigenfunctions, and it is the hypothesis quietly violated whenever the weights are allowed to depend on position — an edge-preserving or adaptive smoother is not a filter in this sense and none of part 1 to part 4 applies to it.
  • Stationarity of the input is used only in part 4, where it turns E(XsXt)\mathbb{E}(X_sX_t) into a function of s−ts-t. Parts 1 to 3 are statements about one signal and need no probability at all.
  • Real weights are used in part 3 and part 4. For complex weights the correct general statement is Grimmett and Stirzaker's (Grimmett & Stirzaker (2020), §9.7, Problem 2, p. 468), with ∣Ga(eiλ)∣2=∣∑kakeikλ∣2\lvert G_a(\mathrm{e}^{i\lambda})\rvert^2 = \lvert\sum_ka_k\mathrm{e}^{ik\lambda}\rvert^2, which is ∣A(−λ)∣2\lvert A(-\lambda)\rvert^2 and not ∣A(λ)∣2\lvert A(\lambda)\rvert^2. The two agree for real weights, which is every filter applied to real data, and the discrepancy is traceable to the conjugate in the definition of the covariance of complex random variables.
  • A filter cannot create power where there is none. Since gY=∣A∣2gXg_Y = \lvert A\rvert^2g_X pointwise, gX(λ)=0g_X(\lambda) = 0 forces gY(λ)=0g_Y(\lambda) = 0. In particular no filter can undo aliasing: once two frequencies have been folded onto one by sampling, no operation on the samples separates them, which is why the anti-alias filter of The sampling theorem must be analogue and must act before the sampler.
  • Deconvolution is division, and division is unstable. Inverting a filter means multiplying by 1/A(λ)1/A(\lambda), which is unbounded wherever AA is small — and a low-pass filter is designed to make AA small. The inverse of a three-point running mean does not exist as a bounded filter at all, because A(2π/3)=0A(2\pi/3) = 0 exactly. This is the ill-posedness already noted in The convolution theorem.
  • Smoothing manufactures autocorrelation. White noise through any filter comes out correlated, with ρY(m)=∑kakak+m/∑kak2\rho_Y(m) = \sum_ka_ka_{k+m}\big/\sum_ka_k^2; for both three-point filters of the example below this is 2/32/3 at lag 11. A smoothed series therefore has far fewer independent values than it has points, and any test applied to it afterwards must use the reduced count, not NN.
  • Causality is a constraint, not a property of the mathematics. Part 3 says a zero-phase filter needs future values. That is unavailable in real time and perfectly available when post-processing a stored record, which is why real-time and offline filtering are different design problems with different answers.
Method(Designing and applying a filter)AdaptedAdapted from Arfken, Weber & Harris (2013), §20.5, Eq. (20.102) and Exercises 20.5.3-20.5.4, pp. 998, 1002; Riley, Hobson & Bence (2006), §13.4, Exercise 13.12, p. 462
  1. Write down the gain you want, as a function ∣Atarget(λ)∣\lvert A_{\text{target}}(\lambda)\rvert on [0,π][0,\pi]: where it should be 11, where it should be 00, and how wide a transition you will tolerate between them. This is a specification, not yet a filter, and the width of the transition is the quantity that will cost you coefficients.
  2. Decide the phase. Zero phase (symmetric weights, offline) or causal (one-sided weights, real time). If zero phase is wanted from a causal design, plan to run the filter forwards and then backwards, which squares the gain, so specify ∣Atarget∣\sqrt{\lvert A_{\text{target}}\rvert} for the single pass.
  3. Invert the Fourier series. The weights are ak=12π∫−ππAtarget(λ)eikλ dλa_k = \frac{1}{2\pi}\int_{-\pi}^{\pi}A_{\text{target}}(\lambda)\mathrm{e}^{ik\lambda}\,d\lambda. For a low-pass with cutoff λc\lambda_c this gives ak=sin⁡(kλc)/(πk)a_k = \sin(k\lambda_c)/(\pi k); for a high-pass, subtract a low-pass from the identity, akhp=δk0−aklpa_k^{\text{hp}} = \delta_{k0}-a_k^{\text{lp}}; for a band-pass with edges λ1<λ2\lambda_1<\lambda_2, subtract two low-passes, ak=ak(λ2)−ak(λ1)a_k = a_k^{(\lambda_2)}-a_k^{(\lambda_1)}. Cascading two filters multiplies their transfer functions, which is the other way to build a band-pass, and is what Arfken, Weber and Harris (Arfken, Weber & Harris (2013), Exercises 20.5.3-20.5.4 and Fig. 20.12, p. 1002) ask for in Exercises 20.5.3 and 20.5.4 — with the warning that a physical cascade only multiplies if the second stage does not load the first.
  4. Truncate and taper. Keep ∣k∣≤K\lvert k\rvert\le K and multiply by a taper such as 1−∣k∣/(K+1)1-\lvert k\rvert/(K+1), or use a smooth target in step 1 instead of a brick wall. Without this step, see the Gibbs remark above.
  5. Renormalise. For a low-pass, divide by ∑kak\sum_ka_k so that A(0)=1A(0) = 1 exactly and constants pass untouched; for a high-pass or band-pass, check instead that ∑kak=0\sum_ka_k = 0 exactly, so that a constant is annihilated and no trend leaks through.
  6. Plot the realised gain A(λ)=a0+2∑k≥1akcos⁡kλA(\lambda) = a_0+2\sum_{k\ge1}a_k\cos k\lambda before using the filter, on a logarithmic scale, and read off the actual half-power point and the stopband level. The realised gain, not the target, is what the data will see.
  7. Apply it, and deal with the ends. A filter of half-width KK loses KK points at each end of a finite record. Either accept the loss, or state what you padded with; padding with zeros is equivalent to multiplying the record by a rectangular window and brings back the leakage of The periodogram and spectral estimation.
  8. Check against the spectrum. Verify that the periodogram of the output is the periodogram of the input times ∣A∣2\lvert A\rvert^2, to within the sampling error of The periodogram and spectral estimation, and that the variance ratio is ∑kak2\sum_ka_k^2 for a white input. For an analogue filter the corresponding check is on the impulse response: Riley, Hobson and Bence's (Riley, Hobson & Bence (2006), §13.4, Exercise 13.12, p. 462) Exercise 13.12 is the model case, where a response shaped as a triangle of base 2T2T — two rectangles convolved — has for its transfer function the square of a sinc, decaying like ω−2\omega^{-2} because the response is continuous but has a corner.
Example(Two three-point smoothers, and an RCRC low-pass)Original

Part A: gains. Consider the three-point running mean a=(13,13,13)a = (\tfrac13,\tfrac13,\tfrac13) and the binomial smoother a=(14,12,14)a = (\tfrac14,\tfrac12,\tfrac14), both symmetric about k=0k=0. By part 3,

Amean(λ)=13(1+2cos⁡λ),A121(λ)=12(1+cos⁡λ)=cos⁡2λ2.A_{\text{mean}}(\lambda) = \tfrac13\bigl(1+2\cos\lambda\bigr), \qquad A_{121}(\lambda) = \tfrac12\bigl(1+\cos\lambda\bigr) = \cos^{2}\tfrac{\lambda}{2} .

Both have A(0)=1A(0) = 1. But AmeanA_{\text{mean}} vanishes at cos⁡λ=−12\cos\lambda = -\tfrac12, that is at λ=2π/3\lambda = 2\pi/3, and is negative beyond: at the Nyquist frequency Amean(π)=13(1−2)=−13A_{\text{mean}}(\pi) = \tfrac13(1-2) = -\tfrac13. The running mean therefore inverts every oscillation faster than three samples per cycle, while A121≥0A_{121}\ge0 everywhere and decreases monotonically to A121(π)=0A_{121}(\pi) = 0. The half-power point of the binomial smoother solves cos⁡4(λ/2)=12\cos^4(\lambda/2) = \tfrac12, giving

λ1/2=2arccos⁡(2−1/4)=1.14372 rad=0.36406 π.\lambda_{1/2} = 2\arccos\bigl(2^{-1/4}\bigr) = 1.14372\ \text{rad} = 0.36406\,\pi .

Part B: the sign reversal, seen in integers. Take the seven-point record

xt=t+(−1)t,t=0,…,6,that isx=(1,0,3,2,5,4,7),x_t = t + (-1)^{t}, \qquad t = 0,\dots,6, \qquad\text{that is}\qquad x = (1,0,3,2,5,4,7) ,

a straight line with a Nyquist-frequency wobble of unit amplitude on top. Both filters pass the line exactly, because both have ∑kak=1\sum_ka_k = 1 and ∑kkak=0\sum_kka_k = 0 by symmetry. The wobble is eiπt\mathrm{e}^{i\pi t}, so by part 1 it comes out multiplied by A(π)A(\pi).

For the binomial smoother, A121(π)=0A_{121}(\pi) = 0 and the wobble should vanish completely. Computing yt=(xt−1+2xt+xt+1)/4y_t = (x_{t-1}+2x_t+x_{t+1})/4 for t=1,…,5t = 1,\dots,5:

1+0+34=1,0+6+24=2,3+4+54=3,2+10+44=4,5+8+74=5,\tfrac{1+0+3}{4} = 1,\quad \tfrac{0+6+2}{4} = 2,\quad \tfrac{3+4+5}{4} = 3,\quad \tfrac{2+10+4}{4} = 4,\quad \tfrac{5+8+7}{4} = 5 ,

exactly (1,2,3,4,5)(1,2,3,4,5) — the line, with the wobble gone.

For the running mean, Amean(π)=−13A_{\text{mean}}(\pi) = -\tfrac13, so the wobble should survive at a third of its amplitude and with its sign flipped. Computing yt=(xt−1+xt+xt+1)/3y_t = (x_{t-1}+x_t+x_{t+1})/3:

43,53,103,113,163,\tfrac43,\quad \tfrac53,\quad \tfrac{10}{3},\quad \tfrac{11}{3},\quad \tfrac{16}{3} ,

whose residuals about the line (1,2,3,4,5)(1,2,3,4,5) are +13,−13,+13,−13,+13+\tfrac13,-\tfrac13,+\tfrac13,-\tfrac13,+\tfrac13. The prediction is Amean(π)⋅(−1)t=−13(−1)tA_{\text{mean}}(\pi)\cdot(-1)^t = -\tfrac13(-1)^t, which at t=1,2,3,4,5t=1,2,3,4,5 is +13,−13,+13,−13,+13+\tfrac13,-\tfrac13,+\tfrac13,-\tfrac13,+\tfrac13. The two agree exactly, including the sign.

Part C: variance reduction on white noise. By part 4, var⁡Y/var⁡X=∑kak2\operatorname{var}Y/\operatorname{var}X = \sum_ka_k^2, which is 3⋅19=13=0.33333\cdot\tfrac19 = \tfrac13 = 0.3333 for the running mean and 116+14+116=38=0.3750\tfrac1{16}+\tfrac14+\tfrac1{16} = \tfrac38 = 0.3750 for the binomial smoother. The cross-check through the spectrum is Parseval: for the binomial filter,

12π∫−ππcos⁡4λ2 dλ=38,\frac{1}{2\pi}\int_{-\pi}^{\pi}\cos^{4}\tfrac{\lambda}{2}\,d\lambda = \frac38 ,

since the mean value of cos⁡4\cos^4 over a whole period is 3/83/8. So the running mean removes slightly more variance — and pays for it by reversing the sign of the highest frequencies. That is the trade the two filters illustrate, and it is why the binomial weights, not the equal weights, are the default three-point smoother.

Part D: the continuous analogue. A resistance RR in series with a capacitance CC to ground, with the output read across the capacitor, is the low-pass companion of the circuit in Arfken, Weber and Harris's (Arfken, Weber & Harris (2013), Example 20.5.1 and Exercise 20.5.1, pp. 999-1001) Example 20.5.1. Driving it at a single frequency, with VineiωtV_{\text{in}}\mathrm{e}^{i\omega t}, VouteiωtV_{\text{out}}\mathrm{e}^{i\omega t} and IeiωtI\mathrm{e}^{i\omega t} the complex amplitudes, Kirchhoff's loop equation and its derivative give

Vineiωt=RIeiωt+1C∫ ⁣Ieiωtdt  ⟹  iωVin=iωRI+IC  ⟹  I=iωC Vin1+iωRC.V_{\text{in}}\mathrm{e}^{i\omega t} = RI\mathrm{e}^{i\omega t} + \frac1C\int\! I\mathrm{e}^{i\omega t}dt \;\Longrightarrow\; i\omega V_{\text{in}} = i\omega RI + \frac{I}{C} \;\Longrightarrow\; I = \frac{i\omega C\,V_{\text{in}}}{1+i\omega RC} .

The output is the capacitor voltage Vout=I/(iωC)V_{\text{out}} = I/(i\omega C), so

φ(ω)=VoutVin=11+iωRC,∣φ(ω)∣=11+(ωRC)2,arg⁡φ(ω)=−arctan⁡(ωRC).\varphi(\omega) = \frac{V_{\text{out}}}{V_{\text{in}}} = \frac{1}{1+i\omega RC}, \qquad \lvert\varphi(\omega)\rvert = \frac{1}{\sqrt{1+(\omega RC)^2}}, \qquad \arg\varphi(\omega) = -\arctan(\omega RC) .

The power gain is 1/21/2 exactly at ω=1/(RC)\omega = 1/(RC), and ∣φ∣\lvert\varphi\rvert falls like 1/(ωRC)1/(\omega RC) above it — a roll-off of six decibels per octave. The impulse response is the causal exponential Φ(t)=(RC)−1e−t/RC\Phi(t) = (RC)^{-1}\mathrm{e}^{-t/RC} for t>0t>0 and 00 for t<0t<0, since

∫0∞1RCe−t/RCe−iωt dt=1RC⋅1(1/RC)+iω=11+iωRC,\int_0^{\infty}\frac{1}{RC}\mathrm{e}^{-t/RC}\mathrm{e}^{-i\omega t}\,dt = \frac{1}{RC}\cdot\frac{1}{(1/RC)+i\omega} = \frac{1}{1+i\omega RC} ,

which both confirms the transfer function and shows the filter is causal, as Arfken, Weber and Harris (Arfken, Weber & Harris (2013), §20.5, Eqs. (20.105)-(20.106), p. 999) require of any physical device. With R=1 kΩR = 1\,\mathrm{k}\Omega and C=1 μFC = 1\,\mu\mathrm{F} the half-power point is at ω=103 s−1\omega = 10^{3}\,\mathrm{s}^{-1}, that is at an ordinary frequency of 159.15 Hz159.15\ \mathrm{Hz}.

ApplicationOriginal

Anti-aliasing, and why it must be analogue. Every digitiser is preceded by a low-pass filter with its cutoff below the Nyquist frequency of the sampler. Part 4 says why no digital alternative exists: filtering after sampling multiplies the already-folded spectrum by ∣A∣2\lvert A\rvert^2 and cannot unfold it. The RCRC section of the example is the cheapest such filter, and its six decibels per octave is usually not enough; cascading nn sections gives 6n6n decibels per octave, with the transfer functions multiplying as in part 2.

Climate and geophysical time series. A monthly series is routinely passed through a low-pass before the decadal signal is examined, and through a band-pass to isolate, say, the two-to-seven-year band in which El Nino lives. Both the remarks above bite here. The negative side lobes of a badly designed filter put spurious anticorrelations into the output; and because smoothing manufactures autocorrelation, a significance test applied to a filtered series using the raw number of months will reject the null far too often. The standard practice of quoting an effective sample size N/(1+2∑m≥1ρY(m))N\big/\bigl(1+2\sum_{m\ge1}\rho_Y(m)\bigr) is a direct consequence of part 4.

Matched filtering. When the signal shape ss is known and the noise is white, the filter maximising the output signal-to-noise ratio at the arrival time is the time-reverse of the signal, ak=s−ka_k = s_{-k}, with transfer function s^‾\overline{\hat s}. The output is then the cross-correlation of data with template, and the detection statistic is its peak. This is how a gravitational-wave chirp, a radar return or a seismic arrival is pulled out of noise; for coloured noise of density gg, the weights are those of s^‾/g\overline{\hat s}/g, which is a filter that whitens first and then matches.

Instrument response and its removal. A seismometer, a thermometer in a housing and an amplifier each impose their own φ(ω)\varphi(\omega) on what they measure, and recovering the true input means dividing by it. Part 2 makes this division trivial in principle; the deconvolution remark makes it delicate in practice, and the standard compromise is to divide only over the band where ∣φ∣\lvert\varphi\rvert is comfortably above the noise and to taper to zero outside it.

Method

Autoregressive models and red noise

Adapted

Builds the AR(1) process from uncorrelated noise, derives its autocorrelation α∣m∣\alpha^{|m|} and its power spectrum, obtains the Yule-Walker equations that fit an AR(pp) scheme to data, and uses the fitted AR(1) spectrum as the red-noise null against which a spectral peak is tested, with a worked twelve-point series whose apparent cycle survives a white-noise test and fails a red-noise one.

Prerequisites: Stationary processes and spectral densities, Expectation, variance and covariance, Power series

Note(Why a null hypothesis has to be red)Original

A geophysical record almost never looks like white noise. Yesterday's temperature anomaly, last month's sea level, last year's sunspot count all carry over into the next value, because the system has inertia: an ocean mixed layer, a reservoir, a population. Persistence alone, with no oscillator anywhere in the system, already produces a spectrum that rises towards low frequency — more power in the slow fluctuations than in the fast ones. Such a spectrum is called red, by analogy with light.

That is a nuisance, because it is also what a long-period cycle looks like. A peak in an estimated spectrum is evidence of a cycle only if it stands above what mere persistence would have produced, and to say how much is "above" one needs a quantitative null hypothesis. The AR(1) process supplies it with a single fitted number. This unit builds the process, computes its spectrum exactly, and shows how to fit it and test against it. The example below is a series whose apparent twelve-point cycle is comfortably significant against white noise and not significant at all against red noise; that reversal is the whole point of the method.

Definition(Autoregressive schemes)AdaptedAdapted from Grimmett & Stirzaker (2020), §8.2, the definition of an autoregressive scheme, p. 410, and §9.3, Example (9.3.23), p. 444

Let {Zn:n∈Z}\{Z_n : n \in \mathbb{Z}\} be uncorrelated real random variables with E(Zn)=0\mathbb{E}(Z_n) = 0 and var⁡(Zn)=σZ2\operatorname{var}(Z_n) = \sigma_Z^{2}, the same finite value for every nn. Such a sequence is called discrete white noise, or the innovations.

A real sequence {Xn:n∈Z}\{X_n : n \in \mathbb{Z}\} is an autoregressive scheme of order pp, written AR(pp), if

Xn  =  ∑i=1pαiXn−i  +  Zn,n∈Z,X_n \;=\; \sum_{i=1}^{p}\alpha_i X_{n-i} \;+\; Z_n , \qquad n \in \mathbb{Z} ,

for real constants α1,…,αp\alpha_1,\dots,\alpha_p. The case p=1p = 1,

Xn  =  αXn−1+Zn,X_n \;=\; \alpha X_{n-1} + Z_n ,

is the one this unit is mostly about. Grimmett and Stirzaker introduce these schemes, alongside moving averages Yn=∑i=0rαiXn−iY_n = \sum_{i=0}^{r}\alpha_i X_{n-i}, as the two families a statistician fits to an observed series; they take σZ2=1\sigma_Z^{2} = 1 throughout, and we keep σZ2\sigma_Z^{2} explicit, which multiplies every covariance below by σZ2\sigma_Z^{2} and leaves every correlation and every normalised spectral density unchanged.

Two conventions. Frequency λ\lambda runs over (−π,π](-\pi,\pi], one unit of nn being one sampling interval, as in Stationary processes and spectral densities; a frequency λ\lambda corresponds to a period of 2π/λ2\pi/\lambda sampling intervals, and λ=π\lambda = \pi is the Nyquist frequency. And beside the normalised spectral density ff of that unit, with ∫−ππf=1\int_{-\pi}^{\pi} f = 1, we use the unnormalised power spectrum

P(λ)  =  ∑m=−∞∞c(m) e−imλ  =  2πc(0) f(λ),12π∫−ππP(λ) dλ  =  c(0),P(\lambda) \;=\; \sum_{m=-\infty}^{\infty} c(m)\,e^{-im\lambda} \;=\; 2\pi c(0)\,f(\lambda) , \qquad \frac{1}{2\pi}\int_{-\pi}^{\pi} P(\lambda)\,d\lambda \;=\; c(0) ,

which is the discrete-time form of the physicists' S(ω)S(\omega) in the conventions table of that unit. PP is what a spectrum estimate is compared against, because it carries the units of variance.

Method(The stationary AR(1) process, its correlations and its spectrum)AdaptedAdapted from Grimmett & Stirzaker (2020), §9.2, Example (9.2.5), p. 437, and §9.3, Example (9.3.23) including the general AR($r$) criterion, p. 444

Let ∣α∣<1\lvert\alpha\rvert < 1. Then:

  1. Existence and uniqueness. The series Xn=∑k=0∞αkZn−kX_n = \sum_{k=0}^{\infty}\alpha^{k}Z_{n-k} converges in mean square, and the sequence so defined is the unique weakly stationary solution of Xn=αXn−1+ZnX_n = \alpha X_{n-1}+Z_n.
  2. Moments. E(Xn)=0\mathbb{E}(X_n) = 0 and c(m)  =  cov⁡(Xn,Xn+m)  =  σZ2 α∣m∣1−α2,ρ(m)  =  α∣m∣,m∈Z.c(m) \;=\; \operatorname{cov}(X_n, X_{n+m}) \;=\; \frac{\sigma_Z^{2}\,\alpha^{\lvert m\rvert}}{1-\alpha^{2}} , \qquad \rho(m) \;=\; \alpha^{\lvert m\rvert} , \qquad m \in \mathbb{Z} . In particular c(0)=σZ2/(1−α2)c(0) = \sigma_Z^{2}/(1-\alpha^{2}) and α=ρ(1)\alpha = \rho(1).
  3. Spectrum. The spectral density and power spectrum are f(λ)  =  1−α22π(1−2αcos⁡λ+α2),P(λ)  =  σZ2∣1−αe−iλ∣2  =  σZ21−2αcos⁡λ+α2,f(\lambda) \;=\; \frac{1-\alpha^{2}}{2\pi\bigl(1 - 2\alpha\cos\lambda + \alpha^{2}\bigr)} , \qquad P(\lambda) \;=\; \frac{\sigma_Z^{2}}{\bigl\lvert 1-\alpha e^{-i\lambda}\bigr\rvert^{2}} \;=\; \frac{\sigma_Z^{2}}{1-2\alpha\cos\lambda+\alpha^{2}} , for −π≤λ≤π-\pi \le \lambda \le \pi. For 0<α<10 < \alpha < 1 the spectrum decreases monotonically from P(0)=σZ2(1−α)2=c(0) 1+α1−αtoP(π)=σZ2(1+α)2=c(0) 1−α1+α,P(0) = \frac{\sigma_Z^{2}}{(1-\alpha)^{2}} = c(0)\,\frac{1+\alpha}{1-\alpha} \qquad\text{to}\qquad P(\pi) = \frac{\sigma_Z^{2}}{(1+\alpha)^{2}} = c(0)\,\frac{1-\alpha}{1+\alpha} , a ratio of ((1+α)/(1−α))2\bigl((1+\alpha)/(1-\alpha)\bigr)^{2} between the two ends of the band: this is the red shape. For −1<α<0-1<\alpha<0 the same formula increases monotonically (a blue spectrum), and α=0\alpha = 0 returns the flat spectrum P≡σZ2P \equiv \sigma_Z^{2} of white noise.
  4. Prediction. The best linear predictor of Xr+kX_{r+k}, k≥1k\ge1, from Xr,Xr−1,…,Xr−sX_r, X_{r-1},\dots,X_{r-s} is αkXr\alpha^{k}X_r, with mean squared error σZ2(1−α2k)/(1−α2)\sigma_Z^{2}(1-\alpha^{2k})/(1-\alpha^{2}). Only the most recent value is used, whatever ss is.

General order. Grimmett and Stirzaker state, for the AR(pp) scheme with unit-variance innovations, that XX is stationary if the complex roots θ1,…,θp\theta_1,\dots,\theta_p of

A(z)  =  zp−α1zp−1−⋯−αpA(z) \;=\; z^{p} - \alpha_1 z^{p-1} - \cdots - \alpha_p

all satisfy ∣θj∣<1\lvert\theta_j\rvert < 1, and that the spectral density is then f(λ)=1/(2πσ2∣A(e−iλ)∣2)f(\lambda) = 1/\bigl(2\pi\sigma^{2}\lvert A(e^{-i\lambda})\rvert^{2}\bigr) with σ2=var⁡(X0)\sigma^{2} = \operatorname{var}(X_0). With a general innovation variance this reads

P(λ)  =  σZ2∣A(e−iλ)∣2  =  σZ2∣1−α1e−iλ−⋯−αpe−ipλ∣2,P(\lambda) \;=\; \frac{\sigma_Z^{2}}{\bigl\lvert A(e^{-i\lambda})\bigr\rvert^{2}} \;=\; \frac{\sigma_Z^{2}}{\bigl\lvert 1 - \alpha_1e^{-i\lambda} - \cdots - \alpha_pe^{-ip\lambda}\bigr\rvert^{2}} ,

the two forms of the denominator agreeing because ∣e−ipλ∣=1\lvert e^{-ip\lambda}\rvert = 1 and because the αi\alpha_i are real, so that conjugating the bracket leaves its modulus unchanged. Part 3 is the case p=1p=1.

Proposition(The Yule-Walker equations)Original

Let {Xn}\{X_n\} be a weakly stationary AR(pp) scheme with autocovariance function cc, driven by innovations {Zn}\{Z_n\} that are uncorrelated with zero mean and variance σZ2\sigma_Z^{2}, and suppose each ZnZ_n is uncorrelated with every earlier value Xn−1,Xn−2,…X_{n-1}, X_{n-2},\dots of the process. Then

c(j)  =  ∑i=1pαi c(j−i),j=1,2,…,p,(YW)c(j) \;=\; \sum_{i=1}^{p}\alpha_i\,c(j-i) , \qquad j = 1, 2, \dots, p , \tag{YW}

and

σZ2  =  c(0)−∑i=1pαi c(i).\sigma_Z^{2} \;=\; c(0) - \sum_{i=1}^{p}\alpha_i\,c(i) .

Dividing (YW) by c(0)c(0) gives the same system in the correlations, ρ(j)=∑iαiρ(j−i)\rho(j) = \sum_i \alpha_i\rho(j-i), which in matrix form is

(ρ(0)ρ(1)⋯ρ(p−1)ρ(1)ρ(0)⋯ρ(p−2)⋮⋱⋮ρ(p−1)ρ(p−2)⋯ρ(0))(α1α2⋮αp)=(ρ(1)ρ(2)⋮ρ(p)).\begin{pmatrix} \rho(0) & \rho(1) & \cdots & \rho(p-1)\\ \rho(1) & \rho(0) & \cdots & \rho(p-2)\\ \vdots & & \ddots & \vdots\\ \rho(p-1) & \rho(p-2) & \cdots & \rho(0) \end{pmatrix} \begin{pmatrix}\alpha_1\\ \alpha_2\\ \vdots\\ \alpha_p\end{pmatrix} = \begin{pmatrix}\rho(1)\\ \rho(2)\\ \vdots\\ \rho(p)\end{pmatrix} .

The matrix is the symmetric Toeplitz matrix of correlations; it is non-singular whenever the first pp values of the process are not almost surely linearly dependent. For p=1p=1 the system is the single equation α=ρ(1)\alpha = \rho(1).

These are the Yule-Walker equations. The name is standard in the time-series literature but is not used by our source; what Grimmett and Stirzaker give, as their prediction equations (9.2.3), is the system ∑i=0saic(∣i−j∣)=c(k+j)\sum_{i=0}^{s}a_i c(\lvert i-j\rvert) = c(k+j), 0≤j≤s0\le j\le s, satisfied by the coefficients of the best linear predictor of Xr+kX_{r+k} from Xr,…,Xr−sX_r,\dots,X_{r-s}. Taking k=1k=1 and s=p−1s=p-1 there, and relabelling ai−1a_{i-1} as αi\alpha_i, reproduces (YW) exactly. So the Yule-Walker system has two readings: it fits an AR(pp) model, and it finds the best one-step linear predictor from pp past values. They coincide because an AR(pp) scheme is precisely a process whose one-step prediction error is uncorrelated with the past.

Idea of the proofOriginal

Why the AR(1) process is a geometric smoothing of the noise. Substituting the recursion into itself kk times gives Xn=αkXn−k+∑j<kαjZn−jX_n = \alpha^{k}X_{n-k} + \sum_{j<k}\alpha^{j}Z_{n-j}. If ∣α∣<1\lvert\alpha\rvert<1 the memory term αkXn−k\alpha^{k}X_{n-k} dies away, and what is left is a geometrically weighted sum of all past shocks. Every statement about the process is then a geometric series: the variance is σZ2∑α2k\sigma_Z^{2}\sum\alpha^{2k}, the lag-mm covariance is the same sum shifted, and the spectrum is the squared modulus of the geometric series ∑αke−ikλ=(1−αe−iλ)−1\sum\alpha^{k}e^{-ik\lambda} = (1-\alpha e^{-i\lambda})^{-1}.

Why the spectrum is red. That last expression is largest when αe−iλ\alpha e^{-i\lambda} points along the positive real axis, which for α>0\alpha>0 happens at λ=0\lambda = 0, and smallest when it points the other way, at λ=π\lambda=\pi. Positive α\alpha therefore piles power at low frequency. Geometrically, ∣1−αe−iλ∣\lvert 1-\alpha e^{-i\lambda}\rvert is the distance from the point αe−iλ\alpha e^{-i\lambda} on a circle of radius α\alpha to the point 11, and that distance is smallest when the circle point is nearest 11.

Why the Yule-Walker equations are an orthogonality statement. The defining feature of an AR(pp) scheme is that the residual Zn=Xn−∑αiXn−iZ_n = X_n - \sum\alpha_iX_{n-i} carries no linear information about the past. Multiplying the recursion by a past value Xn−jX_{n-j} and taking expectations records exactly that: the residual term drops out, and what survives is a linear relation among covariances. This is the projection theorem of Conditional expectation in coordinates, with "orthogonal" meaning "uncorrelated".

Why red noise is the right null. A test needs a null that is sceptical in the right direction. Against white noise, any persistent record shows a spuriously significant low-frequency peak, because the null underestimates the low-frequency power that persistence alone supplies. The AR(1) null absorbs persistence into one parameter, estimated from the same record, and asks whether a peak beats what that persistence would have delivered. It is the cheapest null that is not obviously wrong.

Proof(The AR(1) process: existence, moments and spectrum)AdaptedAdapted from Grimmett & Stirzaker (2020), §9.2, Example (9.2.5), p. 437, and §9.3, Example (9.3.23), p. 444

Throughout ∣α∣<1\lvert\alpha\rvert<1.

Step 1: the series converges. Put SK=∑k=0KαkZn−kS_K = \sum_{k=0}^{K}\alpha^{k}Z_{n-k}. For L>KL > K, the increments SL−SKS_L - S_K involve distinct, hence uncorrelated, innovations, so

E((SL−SK)2)=σZ2∑k=K+1Lα2k  ≤  σZ2 α2(K+1)1−α2  →K→∞  0,\mathbb{E}\bigl((S_L-S_K)^{2}\bigr) = \sigma_Z^{2}\sum_{k=K+1}^{L}\alpha^{2k} \;\le\; \sigma_Z^{2}\,\frac{\alpha^{2(K+1)}}{1-\alpha^{2}} \;\xrightarrow[K\to\infty]{}\; 0 ,

using ∣α∣<1\lvert\alpha\rvert<1 to sum the geometric series. So {SK}\{S_K\} is Cauchy in mean square and converges to a limit XnX_n with E(Xn)=0\mathbb{E}(X_n)=0.

Step 2: it solves the recursion. Splitting off the k=0k=0 term, SK=Zn+α∑k=0K−1αkZn−1−kS_K = Z_n + \alpha\sum_{k=0}^{K-1}\alpha^{k}Z_{n-1-k}. Letting K→∞K\to\infty in mean square gives Xn=Zn+αXn−1X_n = Z_n + \alpha X_{n-1}.

Step 3: the covariances. For m≥0m \ge 0, the products Zn−jZn+m−kZ_{n-j}Z_{n+m-k} have zero expectation unless n−j=n+m−kn-j = n+m-k, that is k=j+mk = j+m; the surviving terms contribute σZ2\sigma_Z^{2} each. Hence

c(m)=E(XnXn+m)=∑j,k≥0αj+k E(Zn−jZn+m−k)=σZ2∑j≥0α jα j+m=σZ2αm1−α2.c(m) = \mathbb{E}(X_nX_{n+m}) = \sum_{j,k\ge0}\alpha^{j+k}\,\mathbb{E}(Z_{n-j}Z_{n+m-k}) = \sigma_Z^{2}\sum_{j\ge0}\alpha^{\,j}\alpha^{\,j+m} = \frac{\sigma_Z^{2}\alpha^{m}}{1-\alpha^{2}} .

This does not depend on nn, so the process is weakly stationary; and c(−m)=c(m)c(-m)=c(m) because the process is real, giving c(m)=σZ2α∣m∣/(1−α2)c(m) = \sigma_Z^{2}\alpha^{\lvert m\rvert}/(1-\alpha^{2}) and ρ(m)=α∣m∣\rho(m)=\alpha^{\lvert m\rvert}.

Step 4: uniqueness. Let YY be any weakly stationary solution and set Dn=Yn−XnD_n = Y_n - X_n. Subtracting the two recursions gives Dn=αDn−1D_n = \alpha D_{n-1}, hence Dn=αkDn−kD_n = \alpha^{k}D_{n-k} for every k≥1k\ge1. Both XX and YY are stationary, so E(Dn2)\mathbb{E}(D_n^{2}) is a constant δ\delta independent of nn, and δ=α2kδ\delta = \alpha^{2k}\delta for all kk. Since ∣α∣<1\lvert\alpha\rvert<1, letting k→∞k\to\infty forces δ=0\delta = 0, so Yn=XnY_n = X_n almost surely.

Step 5: the spectrum. Since ∑m∣ρ(m)∣=1+2∑m≥1∣α∣m<∞\sum_m\lvert\rho(m)\rvert = 1 + 2\sum_{m\ge1}\lvert\alpha\rvert^{m} < \infty, the proposition on absolutely summable autocorrelations in Stationary processes and spectral densities applies, and P(λ)=∑mc(m)e−imλP(\lambda) = \sum_m c(m)e^{-im\lambda}. Split the sum at m=0m=0 and sum two geometric series:

P(λ)c(0)=1+∑m≥1αme−imλ+∑m≥1αmeimλ=1+αe−iλ1−αe−iλ+αeiλ1−αeiλ.\frac{P(\lambda)}{c(0)} = 1 + \sum_{m\ge1}\alpha^{m}e^{-im\lambda} + \sum_{m\ge1}\alpha^{m}e^{im\lambda} = 1 + \frac{\alpha e^{-i\lambda}}{1-\alpha e^{-i\lambda}} + \frac{\alpha e^{i\lambda}}{1-\alpha e^{i\lambda}} .

Put the three terms over the common denominator ∣1−αe−iλ∣2=1−2αcos⁡λ+α2\lvert 1-\alpha e^{-i\lambda}\rvert^{2} = 1-2\alpha\cos\lambda+\alpha^{2}. The two numerators from the fractions are αe−iλ(1−αeiλ)+αeiλ(1−αe−iλ)=2αcos⁡λ−2α2\alpha e^{-i\lambda}(1-\alpha e^{i\lambda}) + \alpha e^{i\lambda}(1-\alpha e^{-i\lambda}) = 2\alpha\cos\lambda - 2\alpha^{2}, so

P(λ)c(0)=(1−2αcos⁡λ+α2)+(2αcos⁡λ−2α2)1−2αcos⁡λ+α2=1−α21−2αcos⁡λ+α2.\frac{P(\lambda)}{c(0)} = \frac{\bigl(1-2\alpha\cos\lambda+\alpha^{2}\bigr) + \bigl(2\alpha\cos\lambda-2\alpha^{2}\bigr)}{1-2\alpha\cos\lambda+\alpha^{2}} = \frac{1-\alpha^{2}}{1-2\alpha\cos\lambda+\alpha^{2}} .

Multiplying by c(0)=σZ2/(1−α2)c(0) = \sigma_Z^{2}/(1-\alpha^{2}) gives P(λ)=σZ2/(1−2αcos⁡λ+α2)P(\lambda) = \sigma_Z^{2}/(1-2\alpha\cos\lambda+\alpha^{2}), and dividing PP by 2πc(0)2\pi c(0) gives ff. Monotonicity in λ\lambda on [0,π][0,\pi] is immediate, since cos⁡λ\cos\lambda decreases there and the denominator is 1+α2−2αcos⁡λ1+\alpha^{2}-2\alpha\cos\lambda.

Step 6: prediction. By Grimmett and Stirzaker's Theorem (9.2.1) the coefficients a0,…,asa_0,\dots,a_s of the best linear predictor of Xr+kX_{r+k} satisfy ∑iaic(∣i−j∣)=c(k+j)\sum_{i}a_ic(\lvert i-j\rvert) = c(k+j) for 0≤j≤s0\le j\le s. Try a0=αka_0 = \alpha^{k} and ai=0a_i = 0 otherwise: the left side becomes αkc(j)=σZ2αk+j/(1−α2)\alpha^{k}c(j) = \sigma_Z^{2}\alpha^{k+j}/(1-\alpha^{2}), which is c(k+j)c(k+j) because k+j≥0k+j\ge0. So the trial solves the system and X^r+k=αkXr\widehat X_{r+k} = \alpha^{k}X_r. Its error is

var⁡(Xr+k−αkXr)=c(0)−2αkc(k)+α2kc(0)=σZ21−α2(1−2α2k+α2k)=σZ2(1−α2k)1−α2.□\operatorname{var}(X_{r+k} - \alpha^{k}X_r) = c(0) - 2\alpha^{k}c(k) + \alpha^{2k}c(0) = \frac{\sigma_Z^{2}}{1-\alpha^{2}}\bigl(1 - 2\alpha^{2k} + \alpha^{2k}\bigr) = \frac{\sigma_Z^{2}\bigl(1-\alpha^{2k}\bigr)}{1-\alpha^{2}} . \qquad\square
Proof(The Yule-Walker equations)Original

Assume the hypotheses of the proposition, so E(Xn)=0\mathbb{E}(X_n) = 0 and c(j)=E(XnXn+j)c(j) = \mathbb{E}(X_nX_{n+j}).

Step 1: multiply by a past value. Fix jj with 1≤j≤p1\le j\le p. Multiply Xn=∑i=1pαiXn−i+ZnX_n = \sum_{i=1}^{p}\alpha_iX_{n-i} + Z_n by Xn−jX_{n-j} and take expectations:

E(XnXn−j)=∑i=1pαi E(Xn−iXn−j)+E(ZnXn−j).\mathbb{E}(X_nX_{n-j}) = \sum_{i=1}^{p}\alpha_i\,\mathbb{E}(X_{n-i}X_{n-j}) + \mathbb{E}(Z_nX_{n-j}) .

Step 2: kill the noise term. Here the hypothesis that ZnZ_n is uncorrelated with Xn−1,Xn−2,…X_{n-1},X_{n-2},\dots is used: since j≥1j\ge1 and both factors have zero mean, E(ZnXn−j)=0\mathbb{E}(Z_nX_{n-j}) = 0.

Step 3: read off the covariances. By stationarity E(XnXn−j)=c(−j)=c(j)\mathbb{E}(X_nX_{n-j}) = c(-j) = c(j) and E(Xn−iXn−j)=c(j−i)\mathbb{E}(X_{n-i}X_{n-j}) = c(j-i), which gives (YW).

Step 4: the variance equation. Now take j=0j=0, that is multiply by XnX_n itself:

c(0)=∑i=1pαic(i)+E(ZnXn).c(0) = \sum_{i=1}^{p}\alpha_i c(i) + \mathbb{E}(Z_nX_n) .

Substituting the recursion once more inside the last expectation,

E(ZnXn)=∑i=1pαi E(ZnXn−i)+E(Zn2)=0+σZ2,\mathbb{E}(Z_nX_n) = \sum_{i=1}^{p}\alpha_i\,\mathbb{E}(Z_nX_{n-i}) + \mathbb{E}(Z_n^{2}) = 0 + \sigma_Z^{2} ,

again by step 2 and by var⁡(Zn)=σZ2\operatorname{var}(Z_n)=\sigma_Z^{2}. Rearranging gives the stated expression for σZ2\sigma_Z^{2}. □\square

For p=1p=1 the two equations are c(1)=αc(0)c(1) = \alpha c(0) and σZ2=c(0)−αc(1)=c(0)(1−α2)\sigma_Z^{2} = c(0)-\alpha c(1) = c(0)(1-\alpha^{2}), consistent with part 2 of the statement above.

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

∣α∣<1\lvert\alpha\rvert<1 is used in step 1 (convergence), step 4 (uniqueness) and step 5 (summing the series) of the first proof, and it cannot be dropped.

  • At α=1\alpha = 1 the recursion is a random walk (Random walks). It has no stationary solution: starting from X0=0X_0 = 0, var⁡(Xn)=nσZ2\operatorname{var}(X_n) = n\sigma_Z^{2} grows without bound. Formally the spectrum σZ2/(2−2cos⁡λ)∼σZ2/λ2\sigma_Z^{2}/(2-2\cos\lambda) \sim \sigma_Z^{2}/\lambda^{2} diverges at the origin and is not integrable, which is the frequency-domain image of the infinite variance. A red-noise test is therefore meaningless on an undifferenced random walk, and a fitted α^\hat\alpha very close to 11 is a warning that one is looking at a trend rather than at a stationary process.
  • At ∣α∣>1\lvert\alpha\rvert>1 the backwards series diverges, but there is still a stationary solution, the non-causal one Xn=−∑k≥1α−kZn+kX_n = -\sum_{k\ge1}\alpha^{-k}Z_{n+k} built from future innovations; substituting it into the recursion verifies it directly. Its autocorrelation is α−∣m∣\alpha^{-\lvert m\rvert}, the same as that of an AR(1) with parameter 1/α1/\alpha. So correlations alone cannot distinguish α\alpha from 1/α1/\alpha, and the condition ∣α∣<1\lvert\alpha\rvert<1 is what picks the one solution that depends only on the past. This paragraph is our own observation, not something our source states.

Uncorrelated innovations with constant variance are used in step 3 of the first proof (only matching indices survive) and in step 2 of the second (the noise term vanishes). If the innovations are themselves correlated, (YW) acquires extra terms and fitting an AR(pp) by Yule-Walker returns biased coefficients; the usual symptom is that the residuals of the fit are not white, which is why a residual autocorrelation check belongs in the recipe below.

ZnZ_n uncorrelated with the past of XX, not with all of it. This is automatic for the causal solution of step 1, since Xn−jX_{n-j} is built from Zn−j,Zn−j−1,…Z_{n-j},Z_{n-j-1},\dots. It is false for the non-causal solution above, and that is exactly why Yule-Walker estimation always returns a causal model.

Uncorrelated is weaker than independent. Nothing above uses independence or normality, so the autocovariance and spectrum hold for any white-noise innovations. The red-noise test below is a different matter: its distributional statement needs the process to be Gaussian, and the chi-squared law for a periodogram ordinate is in any case only asymptotic in the record length.

Conventions to check before comparing numbers. Three are easy to get wrong. Some authors write the AR(1) recursion with a minus sign, Xn+ϕXn−1=ZnX_n + \phi X_{n-1} = Z_n, which flips the sign of the correlation. Some define the spectrum over [0,π][0,\pi] only, doubling it. And the "lag-1 autocorrelation" quoted with a record is sometimes computed dividing by NN and sometimes by N−mN-m; the two differ by a factor 1−m/N1-m/N, which matters at the long lags and is why the NN divisor, used below, is preferred — it is the one that always yields a non-negative definite estimated covariance sequence.

Method(Fitting an AR(1) null and testing a spectral peak against it)Original

Given a record x1,…,xNx_1,\dots,x_N sampled at equal intervals:

  1. Remove the mean, and any trend you do not want tested. Put xˉ=N−1∑nxn\bar x = N^{-1}\sum_n x_n and dn=xn−xˉd_n = x_n - \bar x. A linear trend left in the record inflates the lowest frequencies and will inflate α^\hat\alpha with them; if a trend is physically expected, fit and subtract it first, and say so.
  2. Estimate the autocovariances at lags 00 and 11: c^0=1N∑n=1Ndn2,c^1=1N∑n=1N−1dndn+1.\hat c_0 = \frac1N\sum_{n=1}^{N}d_n^{2} , \qquad \hat c_1 = \frac1N\sum_{n=1}^{N-1}d_nd_{n+1} .
  3. Solve Yule-Walker. For p=1p=1 this is just α^=c^1/c^0\hat\alpha = \hat c_1/\hat c_0, and the innovation variance is σ^Z2=c^0(1−α^2)\hat\sigma_Z^{2} = \hat c_0\bigl(1-\hat\alpha^{2}\bigr). For order pp, solve the Toeplitz system of the proposition, for example by the Levinson-Durbin recursion.
  4. Check the fit. Require ∣α^∣<1\lvert\hat\alpha\rvert<1 (for order pp, that the roots of AA lie inside the unit circle). Compare ρ^(2)\hat\rho(2) with α^2\hat\alpha^{2}: a serious mismatch means AR(1) is the wrong null and a higher order, or a different model, is needed.
  5. Form the null spectrum. Pnull(λ)  =  σ^Z21−2α^cos⁡λ+α^2,λ∈[0,π].P_{\text{null}}(\lambda) \;=\; \frac{\hat\sigma_Z^{2}}{1 - 2\hat\alpha\cos\lambda + \hat\alpha^{2}} , \qquad \lambda \in [0,\pi] .
  6. Compute the spectral estimate on the same scale. At the Fourier frequencies λj=2πj/N\lambda_j = 2\pi j/N use the periodogram I(λj)  =  1N∣∑n=1Ndne−iλjn∣2,I(\lambda_j) \;=\; \frac1N\Bigl\lvert\sum_{n=1}^{N}d_n e^{-i\lambda_j n}\Bigr\rvert^{2} , whose properties, and whose smoothed and windowed variants, are the subject of The periodogram and spectral estimation. The normalisation is fixed by Parseval: N−1∑j=0N−1I(λj)=c^0N^{-1}\sum_{j=0}^{N-1}I(\lambda_j) = \hat c_0, the same total variance that 12π∫P\frac{1}{2\pi}\int P carries.
  7. Set the threshold. For a Gaussian stationary process, and λj\lambda_j neither 00 nor π\pi, the ratio 2I(λj)/P(λj)2I(\lambda_j)/P(\lambda_j) is approximately χ2\chi^{2} with two degrees of freedom. A one-sided test at level qq therefore rejects the null when I(λj)  >  12 χ2, q2  Pnull(λj),12χ2, 0.952=2.995732,12χ2, 0.992=4.605170.I(\lambda_j) \;>\; \tfrac12\,\chi^{2}_{2,\,q}\;P_{\text{null}}(\lambda_j) , \qquad \tfrac12\chi^{2}_{2,\,0.95} = 2.995732 , \quad \tfrac12\chi^{2}_{2,\,0.99} = 4.605170 . (If the estimate is a smoothed or Welch-averaged one with ν\nu effective degrees of freedom, replace this factor by χν,q2/ν\chi^{2}_{\nu,q}/\nu; see Hypothesis testing for the vocabulary.)
  8. Allow for multiple testing. You are usually scanning all ⌊N/2⌋\lfloor N/2\rfloor frequencies at once, so at the nominal 5%5\% level about one ordinate in twenty will exceed the threshold under the null. Either nominate the frequency of interest in advance, or apply a correction: the probability that no ordinate among MM roughly independent ones exceeds the level-qq threshold is about qMq^{M}, so testing at q=0.951/Mq = 0.95^{1/M} controls the chance of any false peak at 5%5\%.
  9. Quote the effective sample size. For other statistics computed from the same record, persistence costs degrees of freedom. Since ∑mρ(m)=(1+α)/(1−α)\sum_{m}\rho(m) = (1+\alpha)/(1-\alpha) for AR(1), the variance of the sample mean is approximately c^0(1+α^)/{N(1−α^)}\hat c_0(1+\hat\alpha)/\{N(1-\hat\alpha)\}, so the record is worth Neff  =  N 1−α^1+α^N_{\text{eff}} \;=\; N\,\frac{1-\hat\alpha}{1+\hat\alpha} independent observations. Report it: it is usually smaller than people expect.
Example(A twelve-point record: significant against white noise, not against red)Original

A twelve-year index, one value per year, reads

x=(11, 10, 13, 13, 13, 10, 7, 8, 6, 9, 9, 11).x = (11,\,10,\,13,\,13,\,13,\,10,\,7,\,8,\,6,\,9,\,9,\,11) .

The eye sees a cycle: high for the first five years, low for the next four, recovering at the end — one oscillation in twelve years. Is it real?

Step 1: mean and deviations. The twelve values sum to 120120, so xˉ=10\bar x = 10 exactly and

d=(1, 0, 3, 3, 3, 0, −3, −2, −4, −1, −1, 1),∑ndn=0.d = (1,\,0,\,3,\,3,\,3,\,0,\,-3,\,-2,\,-4,\,-1,\,-1,\,1) , \qquad \sum_n d_n = 0 .

Step 2: autocovariances. Summing squares, ∑dn2=1+0+9+9+9+0+9+4+16+1+1+1=60\sum d_n^{2} = 1+0+9+9+9+0+9+4+16+1+1+1 = 60, and summing the eleven lagged products,

∑n=111dndn+1=0+0+9+9+0+0+6+8+4+1−1=36.\sum_{n=1}^{11} d_nd_{n+1} = 0+0+9+9+0+0+6+8+4+1-1 = 36 .

Hence c^0=60/12=5\hat c_0 = 60/12 = 5 and c^1=36/12=3\hat c_1 = 36/12 = 3.

Step 3: the fitted AR(1).

α^=c^1c^0=35=0.6,σ^Z2=c^0(1−α^2)=5×0.64=3.2.\hat\alpha = \frac{\hat c_1}{\hat c_0} = \frac{3}{5} = 0.6 , \qquad \hat\sigma_Z^{2} = \hat c_0\bigl(1-\hat\alpha^{2}\bigr) = 5\times 0.64 = 3.2 .

A check on the order: an AR(1) predicts ρ(2)=α2=0.36\rho(2) = \alpha^{2} = 0.36, while the lag-2 sample correlation is c^2/c^0\hat c_2/\hat c_0 with ∑n=110dndn+2=3+0+9+0−9+0+12+2+4−1=20\sum_{n=1}^{10}d_nd_{n+2} = 3+0+9+0-9+0+12+2+4-1 = 20, giving c^2=20/12=5/3\hat c_2 = 20/12 = 5/3 and ρ^(2)=(5/3)/5=1/3=0.3333\hat\rho(2) = (5/3)/5 = 1/3 = 0.3333. That is within a few hundredths of 0.360.36, so AR(1) is an acceptable null.

Step 4: the null spectrum. With α^=0.6\hat\alpha = 0.6,

Pnull(λ)=3.21.36−1.2cos⁡λ,Pnull(0)=3.20.16=20,Pnull(π)=3.22.56=1.25.P_{\text{null}}(\lambda) = \frac{3.2}{1.36 - 1.2\cos\lambda} , \qquad P_{\text{null}}(0) = \frac{3.2}{0.16} = 20 , \qquad P_{\text{null}}(\pi) = \frac{3.2}{2.56} = 1.25 .

The spectrum is red by a factor 16=(1.6/0.4)216 = (1.6/0.4)^{2} across the band, as part 3 of the statement predicts.

Step 5: the periodogram at the frequency of interest. The suspected cycle has period 1212, which is j=1j=1, λ1=π/6\lambda_1 = \pi/6. Computing the two sums,

∑n=112dncos⁡(nπ/6)=0,∑n=112dnsin⁡(nπ/6)=11+33,\sum_{n=1}^{12} d_n\cos(n\pi/6) = 0 , \qquad \sum_{n=1}^{12} d_n\sin(n\pi/6) = 11 + 3\sqrt3 ,

the first vanishing by an exact cancellation. Hence

I(λ1)=(11+33)212=373+1132=21.859613.I(\lambda_1) = \frac{\bigl(11+3\sqrt3\bigr)^{2}}{12} = \frac{37}{3} + \frac{11\sqrt3}{2} = 21.859613 .

As an arithmetic check, the twelve periodogram ordinates average to c^0\hat c_0: N−1∑jI(λj)=5N^{-1}\sum_j I(\lambda_j) = 5, which they do.

Step 6: the two tests.

Against white noise. The white null has Pwhite≡c^0=5P_{\text{white}}\equiv\hat c_0 = 5 at every frequency, so the 95%95\% threshold is 2.995732×5=14.9786612.995732\times 5 = 14.978661. Since 21.859613>14.97866121.859613 > 14.978661, the peak is significant at 5%5\%: on a white-noise null one would announce a twelve-year cycle.

Against red noise. Here

Pnull(π/6)=3.21.36−0.63=9.976010,P_{\text{null}}(\pi/6) = \frac{3.2}{1.36 - 0.6\sqrt3} = 9.976010 ,

so the 95%95\% threshold is 2.995732×9.976010=29.8854562.995732\times 9.976010 = 29.885456. Now 21.859613<29.88545621.859613 < 29.885456: the peak is not significant. Its ratio to the null is 21.859613/9.976010=2.19121.859613/9.976010 = 2.191, which under the null would be exceeded with probability e−2.191=0.112e^{-2.191} = 0.112 — about one chance in nine, before any correction for having scanned the five interior frequencies of a twelve-point record.

Step 7: the effective sample size. Finally,

Neff=N 1−α^1+α^=12×0.41.6=3.N_{\text{eff}} = N\,\frac{1-\hat\alpha}{1+\hat\alpha} = 12\times\frac{0.4}{1.6} = 3 .

Twelve years of this index carry the information of three independent observations. That single number explains the whole result: one is not going to establish a cycle from three effective points, and the red-noise test is the formal statement of that intuition.

Application(Where red-noise tests are used)Original

Climate variability. Almost every climate index — the North Atlantic Oscillation, the Southern Oscillation Index, a basin-mean sea surface temperature, a borehole temperature profile — is first characterised by its lag-1 autocorrelation and its AR(1) spectrum, and claims of periodicity in them are tested against that spectrum rather than against white noise. The physical justification is Hasselmann's model of climate variability: a slow component (the ocean mixed layer) integrates fast weather forcing, and the resulting first-order stochastic equation is exactly the continuous-time limit of AR(1), the Ornstein-Uhlenbeck process of Stochastic differential equations, whose spectrum is the Lorentzian that the discrete formula above approximates for λ≪1\lambda\ll1. So the null is not an arbitrary convenience: it is the spectrum of a system with one reservoir and no oscillator, which is the simplest hypothesis a claimed climate cycle has to beat.

Degrees of freedom in correlation and trend tests. The step-9 figure Neff=N(1−α)/(1+α)N_{\text{eff}} = N(1-\alpha)/(1+\alpha) is used far more often than the spectral test. A correlation between two autocorrelated records, or the significance of a fitted trend, must be assessed with NeffN_{\text{eff}} in place of NN; using NN is the commonest way to manufacture a significant result from two unrelated red series. For α=0.9\alpha = 0.9 the factor is 1/191/19, so a century of monthly data can be worth only a handful of independent numbers.

Instrument and detector noise. Amplifier drift, detector dark current and laser frequency noise all show spectra rising at low frequency, and an AR(1) fit gives a quick corner frequency: the spectrum of the fitted process falls to half its zero-frequency value at

cos⁡λ1/2  =  1+α2−2(1−α)22α,\cos\lambda_{1/2} \;=\; \frac{1+\alpha^{2}-2(1-\alpha)^{2}}{2\alpha} ,

which for α\alpha near 11 gives λ1/2≈1−α\lambda_{1/2}\approx 1-\alpha (at α=0.9\alpha = 0.9 the exact value is 0.1054300.105430 against the estimate 0.10.1), an inverse correlation time in units of the sampling interval. Deciding how long to integrate before a reference measurement is, in effect, choosing a sampling rate against that corner.

Prefiltering and prewhitening. Part 4 of the statement says the best one-step linear predictor of an AR(1) is αXn−1\alpha X_{n-1}, so the residual series xn−α^xn−1x_n - \hat\alpha x_{n-1} is an estimate of the innovations and should be white. "Prewhitening" a record this way before a spectral analysis makes the null flat and the test easier to read, at the cost of also flattening any genuine low-frequency signal; the transfer function 1−α^e−iλ1-\hat\alpha e^{-i\lambda} that does it is a high-pass filter in the sense of Linear filters. Whether to prewhiten, or to test against a red null without filtering, is a question of which distortion you prefer; the two are algebraically the same test when the null is correct.

Model selection in econometrics and geophysics. The Yule-Walker equations are the entry point to the whole ARMA apparatus: fit increasing pp, watch the estimated innovation variance σ^Z2\hat\sigma_Z^{2} stop falling, and penalise the extra parameters with an information criterion. For many physical records p=1p=1 is enough, which is why the AR(1) null is the default and not merely the first case.

Method · advanced

The Kalman filter

Adapted

Sets up the linear Gaussian state-space model, proves by induction on the Gaussian conditioning formula that the filtering distribution stays normal and obeys a forecast step and an update step with gain Kk=PkfHkTSk−1K_k = P_k^{f}H_k^{\mathsf T}S_k^{-1}, identifies the update with a Bayesian posterior and with weighted least squares, and runs the recursion on a four-point scalar record where the forecast variance falls 1.875→1.0380→1.0023→1.000151.875 \to 1.0380 \to 1.0023 \to 1.00015 towards the fixed point 11 and the final estimate −0.000376±0.7071-0.000376 \pm 0.7071 reproduces the exact nine-dimensional Gaussian conditional.

Prerequisites: The multivariate normal distribution, Least-squares fitting, Conditional expectation, Discrete-time Markov chains, Bayesian inference, Autoregressive models and red noise, Quadratic forms and the Rayleigh quotient, Linear systems and rank

Note(What this unit is for)Original

A satellite is tracked, a reactor's core temperature is inferred from thermocouples, a tide gauge is read every hour: in each case a system evolves according to a model that is only approximately right, and is measured by instruments that are only approximately accurate. Neither the model nor the data alone answers the question "where is the system now?".

The Kalman filter answers it, and answers it recursively. At every step it carries one mean vector and one covariance matrix, and the arrival of a new observation updates both in closed form. Nothing earlier than the current summary is ever revisited, so the cost per observation does not grow with the length of the record. The reason this is possible is a single structural fact: within the linear Gaussian model, the conditional distribution of the state given all data so far is normal, and a normal distribution is exactly described by a mean and a covariance.

Everything here is a consequence of two results already proved in The multivariate normal distribution: an affine image of a normal vector is normal, and the conditional law of one block of a normal vector given another is normal with a mean affine in the observed block and a covariance that does not depend on it. The first gives the forecast step, the second gives the update step, and induction does the rest.

Definition(The linear Gaussian state-space model)Original

Fix integers n,p≥1n, p \ge 1. A linear Gaussian state-space model consists of an unobserved state sequence x0,x1,x2,…x_0, x_1, x_2, \dots in Rn\mathbb{R}^{n} and an observed sequence y1,y2,…y_1, y_2, \dots in Rp\mathbb{R}^{p} satisfying, for k≥1k \ge 1,

xk  =  Fk xk−1+wk,yk  =  Hk xk+vk,x_k \;=\; F_k\,x_{k-1} + w_k , \qquad y_k \;=\; H_k\,x_k + v_k ,

where

  • FkF_k (the transition matrix, n×nn \times n) and HkH_k (the observation matrix, p×np \times n) are known and non-random;
  • the process noise wk∼N(0,Qk)w_k \sim N(0, Q_k) on Rn\mathbb{R}^{n} and the observation noise vk∼N(0,Rk)v_k \sim N(0, R_k) on Rp\mathbb{R}^{p} have known covariances, with each RkR_k symmetric positive definite and each QkQ_k symmetric positive semi-definite;
  • the initial state is x0∼N(m0,P0)x_0 \sim N(m_0, P_0) with m0m_0 and P0P_0 known, P0P_0 symmetric positive semi-definite;
  • the whole collection x0,w1,w2,…,v1,v2,…x_0, w_1, w_2, \dots, v_1, v_2, \dots is independent.

Normal vectors are understood in the sense of The multivariate normal distribution, the singular case included: N(μ,V)N(\mu, V) with VV singular means a vector every linear combination of whose components is univariate normal, with mean vector μ\mu and covariance matrix VV. This is why QkQ_k and P0P_0 are allowed to be semi-definite — a noiseless component of the dynamics is a legitimate model — while RkR_k must be definite, because an observation with no error at all would determine a linear combination of the state exactly and is excluded here.

Write Yk=(y1,…,yk)Y_k = (y_1, \dots, y_k) for the data up to time kk, with Y0Y_0 empty. The three distributions one wants are

p(xk∣Yk−1)⏟forecast,p(xk∣Yk)⏟filtering,p(yk∣Yk−1)⏟predictive.\underbrace{p(x_k \mid Y_{k-1})}_{\text{forecast}}, \qquad \underbrace{p(x_k \mid Y_{k})}_{\text{filtering}}, \qquad \underbrace{p(y_k \mid Y_{k-1})}_{\text{predictive}} .

Computing the filtering distribution sequentially in kk is filtering; computing p(xj∣Yk)p(x_j \mid Y_k) for j<kj < k is smoothing and is not treated here.

The state sequence is a Markov chain in the sense of Discrete-time Markov chains with a continuous state space: xkx_k depends on the past only through xk−1x_{k-1}. The pair (hidden Markov state, noisy observation) is the structure the filter exploits.

Method(The Kalman filter)Original

In the model above, for every k≥1k \ge 1:

(i) The filtering distribution is normal. Conditional on Yk=(y1,…,yk)Y_k = (y_1,\dots,y_k),

xk  ∼  N(mk, Pk),x_k \;\sim\; N\bigl(m_k,\, P_k\bigr) ,

where mkm_k depends on the data and PkP_k does not: PkP_k is a deterministic function of F1,…,FkF_1,\dots,F_k, H1,…,HkH_1,\dots,H_k, Q1,…,QkQ_1,\dots,Q_k, R1,…,RkR_1,\dots,R_k and P0P_0 alone.

(ii) The recursion. Starting from m0,P0m_0, P_0, the pairs (mk,Pk)(m_k, P_k) are generated by two steps.

Forecast (time update).

mkf=Fk mk−1,Pkf=Fk Pk−1 FkT+Qk.m_k^{f} = F_k\,m_{k-1} , \qquad P_k^{f} = F_k\,P_{k-1}\,F_k^{\mathsf T} + Q_k .

Conditional on Yk−1Y_{k-1}, xk∼N(mkf,Pkf)x_k \sim N(m_k^{f}, P_k^{f}).

Update (measurement update). Form the innovation and its covariance,

dk=yk−Hk mkf,Sk=Hk PkfHkT+Rk,d_k = y_k - H_k\,m_k^{f} , \qquad S_k = H_k\,P_k^{f}H_k^{\mathsf T} + R_k ,

then the Kalman gain

Kk  =  Pkf HkT Sk−1,K_k \;=\; P_k^{f}\,H_k^{\mathsf T}\,S_k^{-1} ,

and set

mk  =  mkf+Kk dk,Pk  =  (I−KkHk)Pkf.m_k \;=\; m_k^{f} + K_k\,d_k , \qquad P_k \;=\; \bigl(I - K_kH_k\bigr)P_k^{f} .

The matrix SkS_k is invertible, so KkK_k is well defined.

(iii) The predictive distribution. Conditional on Yk−1Y_{k-1}, yk∼N(Hkmkf,Sk)y_k \sim N(H_km_k^{f}, S_k). Hence the innovations d1,d2,…d_1, d_2, \dots are independent, with dk∼N(0,Sk)d_k \sim N(0, S_k) unconditionally, and the log-likelihood of the whole record is

log⁡p(y1,…,yN)  =  −12∑k=1N(dkTSk−1dk+log⁡det⁡Sk+plog⁡2π).\log p(y_1,\dots,y_N) \;=\; -\tfrac12\sum_{k=1}^{N}\Bigl( d_k^{\mathsf T}S_k^{-1}d_k + \log\det S_k + p\log 2\pi \Bigr) .

(iv) Equivalent forms of the update. If in addition PkfP_k^{f} is invertible, then PkP_k is invertible and

Pk−1  =  (Pkf)−1+HkTRk−1Hk,Kk  =  Pk HkTRk−1,P_k^{-1} \;=\; \bigl(P_k^{f}\bigr)^{-1} + H_k^{\mathsf T}R_k^{-1}H_k , \qquad K_k \;=\; P_k\,H_k^{\mathsf T}R_k^{-1} ,

the information form: precisions add. Whether or not PkfP_k^{f} is invertible,

Pk  =  (I−KkHk)Pkf(I−KkHk)T+KkRkKkT,P_k \;=\; \bigl(I-K_kH_k\bigr)P_k^{f}\bigl(I-K_kH_k\bigr)^{\mathsf T} + K_kR_kK_k^{\mathsf T} ,

the Joseph form, which is manifestly symmetric and positive semi-definite.

Idea of the proofOriginal

Only two facts about normal vectors are needed, and the filter is the alternation of them.

Affine images of normal vectors are normal. So if the state at time k−1k-1 is normal given the data so far, then xk=Fkxk−1+wkx_k = F_kx_{k-1} + w_k — an affine function of that state and of fresh noise independent of everything already seen — is normal too, and its mean and covariance follow from the usual rules. That is the forecast step; no new idea is involved.

Conditioning a normal vector on part of itself gives a normal vector. So if, given the data so far, the pair (xk,yk)(x_k, y_k) is jointly normal, then conditioning on the newly observed yky_k leaves xkx_k normal, with mean shifted by cov⁡(xk,yk)var⁡(yk)−1\operatorname{cov}(x_k,y_k)\operatorname{var}(y_k)^{-1} times the surprise yk−E(yk)y_k - \mathbb{E}(y_k) and with covariance reduced by the Schur complement, which is where KkK_k comes from. That is the update step.

The only thing to watch is that both steps must be carried out conditionally on the earlier data, and that this is legitimate: conditioning on Yk−1Y_{k-1} and then on yky_k is the same as conditioning on YkY_k at one stroke. The induction then runs, and the reason the covariance recursion decouples from the data is that the conditional covariance in the Gaussian conditioning formula does not involve the value conditioned on.

Proof(The filter, by induction on kk)AdaptedAdapted from Grimmett & Stirzaker (2020), §4.9, Theorem (4.9.6) and Definition (4.9.7), p. 133, and Exercises (4.9.7) and (4.9.9), pp. 134-135

Throughout, "normal" includes the singular case, in the linear-combination sense of Definition (4.9.7) of Grimmett and Stirzaker, as in The multivariate normal distribution.

Step 0: the induction hypothesis. Let Hk\mathcal{H}_k be the statement: conditional on Yk=(y1,…,yk)Y_k = (y_1,\dots,y_k), the state xkx_k is N(mk,Pk)N(m_k, P_k), with PkP_k non-random. For k=0k=0 this is the assumption x0∼N(m0,P0)x_0 \sim N(m_0,P_0), since Y0Y_0 is empty. Assume Hk−1\mathcal{H}_{k-1} and fix an observed value Yk−1=ηY_{k-1} = \eta.

Step 1: the new noises are untouched by the old data. Write Gk−1\mathcal{G}_{k-1} for the σ\sigma-field generated by x0,w1,…,wk−1,v1,…,vk−1x_0, w_1,\dots,w_{k-1}, v_1,\dots,v_{k-1}. By the model equations every xjx_j with j≤k−1j \le k-1 and every yjy_j with j≤k−1j \le k-1 is a function of these variables, so both xk−1x_{k-1} and Yk−1Y_{k-1} are Gk−1\mathcal{G}_{k-1}-measurable. The independence assumption says that the pair (wk,vk)(w_k, v_k) is independent of Gk−1\mathcal{G}_{k-1}. Hence, conditionally on Yk−1=ηY_{k-1}=\eta:

  • xk−1∼N(mk−1,Pk−1)x_{k-1} \sim N(m_{k-1}, P_{k-1}), by Hk−1\mathcal{H}_{k-1} (here mk−1m_{k-1} is the number obtained from the observed η\eta);
  • wk∼N(0,Qk)w_k \sim N(0,Q_k) and vk∼N(0,Rk)v_k \sim N(0,R_k), with the same laws as unconditionally;
  • xk−1x_{k-1}, wkw_k and vkv_k are mutually independent.

Only the independence hypothesis of the model is used here; without it the conditional law of wkw_k would depend on η\eta and nothing below would survive.

Step 2: the forecast. Conditionally on Yk−1=ηY_{k-1}=\eta, the vector (xk−1,wk,vk)(x_{k-1}, w_k, v_k) is normal with block-diagonal covariance diag⁡(Pk−1,Qk,Rk)\operatorname{diag}(P_{k-1}, Q_k, R_k): each block is normal and the three are independent, so every linear combination of all the components is a sum of three independent univariate normals and is therefore univariate normal. Now

(xkyk)=(FkI0HkFkHkI)(xk−1wkvk)\begin{pmatrix} x_k \\ y_k \end{pmatrix} = \begin{pmatrix} F_k & I & 0 \\ H_kF_k & H_k & I \end{pmatrix} \begin{pmatrix} x_{k-1} \\ w_k \\ v_k\end{pmatrix}

is an affine (here linear) image of it, substituting yk=Hk(Fkxk−1+wk)+vky_k = H_k(F_kx_{k-1}+w_k) + v_k. By Theorem (4.9.6) of Grimmett and Stirzaker in the form stated in The multivariate normal distribution, the pair (xk,yk)(x_k,y_k) is jointly normal conditionally on Yk−1=ηY_{k-1}=\eta. Its moments come from linearity of expectation and the covariance law V↦AVATV \mapsto AVA^{\mathsf T}:

E(xk∣Yk−1)=Fkmk−1=:mkf,var⁡(xk∣Yk−1)=FkPk−1FkT+Qk=:Pkf,\mathbb{E}(x_k \mid Y_{k-1}) = F_km_{k-1} =: m_k^{f} , \qquad \operatorname{var}(x_k\mid Y_{k-1}) = F_kP_{k-1}F_k^{\mathsf T} + Q_k =: P_k^{f} ,

the cross-term vanishing because xk−1x_{k-1} and wkw_k are conditionally independent. Likewise

E(yk∣Yk−1)=Hkmkf,var⁡(yk∣Yk−1)=HkPkfHkT+Rk=Sk,\mathbb{E}(y_k\mid Y_{k-1}) = H_km_k^{f} , \qquad \operatorname{var}(y_k\mid Y_{k-1}) = H_kP_k^{f}H_k^{\mathsf T} + R_k = S_k ,cov⁡(xk,yk∣Yk−1)=cov⁡(xk, Hkxk+vk)=PkfHkT,\operatorname{cov}(x_k, y_k \mid Y_{k-1}) = \operatorname{cov}\bigl(x_k,\, H_kx_k + v_k\bigr) = P_k^{f}H_k^{\mathsf T} ,

again because vkv_k is conditionally independent of xkx_k. This proves the forecast step and part (iii) of the statement, the predictive law being the second block of a jointly normal pair and hence normal by the marginal rule.

Step 3: SkS_k is invertible. For u∈Rpu \in \mathbb{R}^{p} with u≠0u \ne 0,

uTSku  =  (HkTu)TPkf(HkTu)+uTRku  >  0,u^{\mathsf T}S_ku \;=\; \bigl(H_k^{\mathsf T}u\bigr)^{\mathsf T}P_k^{f}\bigl(H_k^{\mathsf T}u\bigr) + u^{\mathsf T}R_ku \;>\; 0 ,

the first term being ≥0\ge 0 because Pkf=FkPk−1FkT+QkP_k^{f} = F_kP_{k-1}F_k^{\mathsf T}+Q_k is positive semi-definite as a sum of two such, and the second being >0>0 because RkR_k is positive definite. So SkS_k is positive definite, hence invertible (Quadratic forms and the Rayleigh quotient). This is the one place the hypothesis Rk≻0R_k \succ 0 is used.

Step 4: the update. Conditioning in stages is legitimate: for any integrable gg, the tower property of Conditional expectation applied inside the conditional law gives E(g(xk)∣Yk−1,yk)=E(g(xk)∣Yk)\mathbb{E}(g(x_k) \mid Y_{k-1}, y_k) = \mathbb{E}(g(x_k)\mid Y_k), since YkY_k is exactly the pair (Yk−1,yk)(Y_{k-1},y_k). So the conditional law of xkx_k given YkY_k may be computed by conditioning the jointly normal pair of Step 2 on its second block.

Apply the conditional formula of The multivariate normal distribution, statement (c), with V11=PkfV_{11} = P_k^{f}, V12=PkfHkTV_{12} = P_k^{f}H_k^{\mathsf T}, V22=SkV_{22} = S_k. It gives a normal law with

mean=mkf+PkfHkTSk−1(yk−Hkmkf)=mkf+Kkdk,\text{mean} = m_k^{f} + P_k^{f}H_k^{\mathsf T}S_k^{-1}\bigl(y_k - H_km_k^{f}\bigr) = m_k^{f} + K_kd_k ,covariance=Pkf−PkfHkTSk−1HkPkf=Pkf−KkHkPkf=(I−KkHk)Pkf.\text{covariance} = P_k^{f} - P_k^{f}H_k^{\mathsf T}S_k^{-1}H_kP_k^{f} = P_k^{f} - K_kH_kP_k^{f} = (I-K_kH_k)P_k^{f} .

The covariance is the Schur complement and does not contain yky_k; since Pk−1P_{k-1} was non-random by Hk−1\mathcal{H}_{k-1}, so are PkfP_k^{f}, SkS_k, KkK_k and PkP_k. This establishes Hk\mathcal{H}_k and completes the induction.

Step 5: independence of the innovations. By Step 2, dk=yk−Hkmkfd_k = y_k - H_km_k^{f} has conditional law N(0,Sk)N(0,S_k) given Yk−1Y_{k-1}, and SkS_k is non-random. The conditional law therefore does not depend on Yk−1Y_{k-1}, so dkd_k is independent of Yk−1Y_{k-1} with unconditional law N(0,Sk)N(0,S_k). Since d1,…,dk−1d_1,\dots,d_{k-1} are functions of Yk−1Y_{k-1}, the whole sequence is independent. The likelihood identity is then the factorisation p(y1,…,yN)=∏kp(yk∣Yk−1)p(y_1,\dots,y_N) = \prod_k p(y_k\mid Y_{k-1}) with each factor the N(Hkmkf,Sk)N(H_km_k^{f},S_k) density evaluated at yky_k, whose logarithm is −12(dkTSk−1dk+log⁡det⁡Sk+plog⁡2π)-\tfrac12(d_k^{\mathsf T}S_k^{-1}d_k + \log\det S_k + p\log2\pi).

Step 6: the Joseph form. Expand, abbreviating K=KkK = K_k, H=HkH = H_k, Pf=PkfP^{f} = P_k^{f}, R=RkR = R_k, S=SkS = S_k:

(I−KH)Pf(I−KH)T+KRKT=Pf−KHPf−PfHTKT+K(HPfHT+R)KT.(I-KH)P^{f}(I-KH)^{\mathsf T} + KRK^{\mathsf T} = P^{f} - KHP^{f} - P^{f}H^{\mathsf T}K^{\mathsf T} + K\bigl(HP^{f}H^{\mathsf T}+R\bigr)K^{\mathsf T} .

The last bracket is SS, and KSKT=PfHTS−1SS−1HPf=PfHTS−1HPf=KHPfKSK^{\mathsf T} = P^{f}H^{\mathsf T}S^{-1}SS^{-1}HP^{f} = P^{f}H^{\mathsf T}S^{-1}HP^{f} = KHP^{f}, a symmetric matrix; hence also PfHTKT=(KHPf)T=KHPfP^{f}H^{\mathsf T}K^{\mathsf T} = (KHP^{f})^{\mathsf T} = KHP^{f}. The right-hand side collapses to Pf−KHPf=(I−KH)Pf=PkP^{f} - KHP^{f} = (I-KH)P^{f} = P_k.

Step 7: the information form. Suppose PfP^{f} is invertible. First,

KHPfHT=PfHTS−1(S−R)=PfHT−KR,soPfHT−KHPfHT=KR.KHP^{f}H^{\mathsf T} = P^{f}H^{\mathsf T}S^{-1}\bigl(S - R\bigr) = P^{f}H^{\mathsf T} - KR , \qquad\text{so}\qquad P^{f}H^{\mathsf T} - KHP^{f}H^{\mathsf T} = KR .

Now multiply out, using this identity at the marked step:

(I−KH)Pf((Pf)−1+HTR−1H)=(I−KH)+(PfHT−KHPfHT)R−1H=(∗)I−KH+KRR−1H=I.(I-KH)P^{f}\Bigl(\bigl(P^{f}\bigr)^{-1} + H^{\mathsf T}R^{-1}H\Bigr) = (I-KH) + \bigl(P^{f}H^{\mathsf T} - KHP^{f}H^{\mathsf T}\bigr)R^{-1}H \overset{(\ast)}{=} I - KH + KRR^{-1}H = I .

So Pk=(I−KH)PfP_k = (I-KH)P^{f} is invertible with inverse (Pf)−1+HTR−1H(P^{f})^{-1} + H^{\mathsf T}R^{-1}H. Finally

PkHTR−1=(I−KH)PfHTR−1=(PfHT−KHPfHT)R−1=KRR−1=K,P_kH^{\mathsf T}R^{-1} = (I-KH)P^{f}H^{\mathsf T}R^{-1} = \bigl(P^{f}H^{\mathsf T} - KHP^{f}H^{\mathsf T}\bigr)R^{-1} = KRR^{-1} = K ,

by the same identity. □\square

Remark(Where the hypotheses are used, and what fails without them)Original
  • Linearity of the dynamics and of the observation operator is used in Step 2, and only there: it is what makes (xk,yk)(x_k,y_k) an affine image of a normal vector. Replace HkxkH_k x_k by a non-linear h(xk)h(x_k) and the pair is no longer jointly normal; the filtering distribution is then generally not normal and is not determined by two moments. The standard repairs — linearising hh about the forecast (the extended filter) or propagating a sample (ensemble and sigma-point filters) — are approximations, not identities.
  • Gaussianity is used only to go from "the conditional mean and covariance are these" to "the conditional distribution is this". Drop it and keep the first and second moments, and the recursion still computes something meaningful: mkm_k remains the best linear unbiased estimate of xkx_k from YkY_k, by the Projection theorem (7.9.14) of Grimmett and Stirzaker quoted in Conditional expectation, because the orthogonality condition E((xk−mk)djT)=0\mathbb{E}\bigl((x_k-m_k)d_j^{\mathsf T}\bigr) = 0 holds for j≤kj \le k by construction. What is lost is that it is the best predictor of any kind: for a non-normal law the conditional mean is a non-linear function of the data and beats every linear rule.
  • Independence of the noises from each other and from the past is Step 1. If cov⁡(wk,vk)=Ck≠0\operatorname{cov}(w_k,v_k) = C_k \ne 0 — common when the "observation" is a derived quantity contaminated by the same error as the forecast — then cov⁡(xk,yk∣Yk−1)=PkfHkT+Ck\operatorname{cov}(x_k,y_k\mid Y_{k-1}) = P_k^{f}H_k^{\mathsf T} + C_k and the gain acquires that extra term. Using the stated formula anyway produces a PkP_k that understates the true error.
  • RkR_k positive definite is Step 3, and nothing else. A perfect observation, Rk=0R_k = 0, makes SkS_k singular whenever HkPkfHkTH_kP_k^{f}H_k^{\mathsf T} is, and the conditional law degenerates onto an affine subspace. QkQ_k and P0P_0, by contrast, may be singular, which is why the model is stated with them only semi-definite.
  • Known Fk,Hk,Qk,RkF_k,H_k,Q_k,R_k. In practice QQ and RR are not known. Part (iii) is the escape: the log-likelihood of the record is available as a by-product of the filter, so the covariances can be estimated by maximising it, which is the method of Maximum likelihood applied to a dependent sample.
  • Numerical caution. The form Pk=(I−KkHk)PkfP_k = (I-K_kH_k)P_k^{f} is the cheapest but is not symmetric as written, and rounding can make it indefinite after many steps. The Joseph form costs more and keeps symmetry and positivity, because it is a sum of two expressions of the form MVMTMVM^{\mathsf T} with VV positive semi-definite; square-root (Cholesky) implementations go further and propagate a factor of PkP_k instead of PkP_k itself (Linear systems and rank).
Remark(Three readings of the update step)AdaptedAdapted from Riley, Hobson & Bence (2006), §31.6.1, eqs. (31.95)-(31.99), pp. 1273-1274; Riley, Hobson & Bence (2006), §31.5.5, eqs. (31.81)-(31.83), pp. 1264-1265

The same two formulas can be reached from three directions, and it is worth seeing that they agree.

As a conditional law. The route taken above.

As a Bayesian posterior. Treat the forecast N(mkf,Pkf)N(m_k^{f},P_k^{f}) as the prior for xkx_k and yk=Hkxk+vky_k = H_kx_k+v_k as the likelihood. Posterior ∝\propto prior ×\times likelihood (Bayesian inference) gives an exponent

−12[(x−mkf)T(Pkf)−1(x−mkf)+(yk−Hkx)TRk−1(yk−Hkx)],-\tfrac12\Bigl[(x-m_k^{f})^{\mathsf T}(P_k^{f})^{-1}(x-m_k^{f}) + (y_k-H_kx)^{\mathsf T}R_k^{-1}(y_k-H_kx)\Bigr] ,

a quadratic in xx whose matrix is (Pkf)−1+HkTRk−1Hk(P_k^{f})^{-1}+H_k^{\mathsf T}R_k^{-1}H_k — the information form of part (iv). The scalar normal-normal conjugacy recorded in Bayesian inference, "precisions add and the mean is the precision-weighted average", is the case n=p=1n=p=1, H=1H=1.

As weighted least squares. Regard the forecast as an extra block of data. In the notation of Least-squares fitting, take the stacked observation vector, design (response) matrix and noise covariance

z=(mkfyk),Rdes=(IHk),N=(Pkf00Rk),z = \begin{pmatrix} m_k^{f} \\ y_k\end{pmatrix}, \qquad R_{\text{des}} = \begin{pmatrix} I \\ H_k \end{pmatrix}, \qquad \mathsf{N} = \begin{pmatrix} P_k^{f} & 0 \\ 0 & R_k\end{pmatrix} ,

and estimate the parameter vector xkx_k. Riley, Hobson and Bence's normal equations give the estimator (RdesTN−1Rdes)−1RdesTN−1z(R_{\text{des}}^{\mathsf T}\mathsf{N}^{-1}R_{\text{des}})^{-1}R_{\text{des}}^{\mathsf T}\mathsf{N}^{-1}z with covariance (RdesTN−1Rdes)−1(R_{\text{des}}^{\mathsf T}\mathsf{N}^{-1}R_{\text{des}})^{-1}; here

RdesTN−1Rdes=(Pkf)−1+HkTRk−1Hk,RdesTN−1z=(Pkf)−1mkf+HkTRk−1yk,R_{\text{des}}^{\mathsf T}\mathsf{N}^{-1}R_{\text{des}} = (P_k^{f})^{-1}+H_k^{\mathsf T}R_k^{-1}H_k , \qquad R_{\text{des}}^{\mathsf T}\mathsf{N}^{-1}z = (P_k^{f})^{-1}m_k^{f} + H_k^{\mathsf T}R_k^{-1}y_k ,

which is again the information form. So mkm_k is a least-squares estimate and PkP_k is the least-squares covariance matrix, and by the Gauss-Markov theorem of that unit it is the best linear unbiased combination of forecast and observation. This reading is the one the next unit, Optimal interpolation and variational data assimilation, develops.

Method(Running the filter)Original
  1. Write the model. Choose the state xx so that the dynamics are linear and the observations are a linear function of it. Fix Fk,Hk,Qk,RkF_k, H_k, Q_k, R_k and the prior m0,P0m_0, P_0. A deliberately inflated P0P_0 costs little: its influence decays.
  2. Forecast. mf←Fkmk−1m^{f} \leftarrow F_km_{k-1} and Pf←FkPk−1FkT+QkP^{f} \leftarrow F_kP_{k-1}F_k^{\mathsf T}+Q_k.
  3. Innovation. d←yk−Hkmfd \leftarrow y_k - H_km^{f} and S←HkPfHkT+RkS \leftarrow H_kP^{f}H_k^{\mathsf T}+R_k.
  4. Gain. Solve S KT=HkPfS\,K^{\mathsf T} = H_kP^{f} for KTK^{\mathsf T} by Cholesky factorisation of SS rather than forming S−1S^{-1} (Linear systems and rank); SS is positive definite, so the factorisation exists. Cost O(p3+np2)O(p^3 + np^2) per step, independent of kk.
  5. Update. mk←mf+Kdm_k \leftarrow m^{f}+Kd and Pk←(I−KHk)PfP_k \leftarrow (I-KH_k)P^{f}, or the Joseph form if the record is long.
  6. Monitor. Accumulate dTS−1dd^{\mathsf T}S^{-1}d and log⁡det⁡S\log\det S for the likelihood of part (iii). The standardised innovations should look like independent standard normal variables; if dTS−1dd^{\mathsf T}S^{-1}d is persistently larger than pp, the assumed QQ or RR is too small or the model is wrong, and the test of Hypothesis testing on ∑kdkTSk−1dk∼χ2(Np)\sum_k d_k^{\mathsf T}S_k^{-1}d_k \sim \chi^2(Np) makes this quantitative.
  7. If the model is time-invariant, iterate step 2-5 covariances alone until PfP^{f} stops changing, and use the limiting gain throughout; see the example.
Example(A scalar red-noise record: four steps, by hand and by brute force)Original

The model. A quantity follows the AR(1) scheme of Autoregressive models and red noise and is measured with independent error:

xk=12xk−1+wk,wk∼N(0,78),yk=xk+vk,vk∼N(0,1),x_k = \tfrac12 x_{k-1} + w_k , \quad w_k \sim N(0,\tfrac78) , \qquad y_k = x_k + v_k , \quad v_k \sim N(0,1) ,

so n=p=1n=p=1, F=12F=\tfrac12, H=1H=1, Q=78Q=\tfrac78, R=1R=1. The prior is x0∼N(0,4)x_0 \sim N(0,4): deliberately vague, four times the observation variance. The four observations are

y1=1.2,y2=0.4,y3=−0.6,y4=0.1.y_1 = 1.2, \quad y_2 = 0.4, \quad y_3 = -0.6, \quad y_4 = 0.1 .

Step 1: the fixed point first. For a time-invariant scalar model the forecast variance obeys Pf↦F2(Pf−(Pf)2/(Pf+R))+QP^{f} \mapsto F^2\bigl(P^{f} - (P^{f})^2/(P^{f}+R)\bigr)+Q, whose fixed point solves

(Pf)2+Pf(R−F2R−Q)−QR=0.\bigl(P^{f}\bigr)^2 + P^{f}\bigl(R - F^2R - Q\bigr) - QR = 0 .

With R=1R=1, F2=14F^2 = \tfrac14 and Q=78Q = \tfrac78 the coefficient of PfP^{f} is 1−14−78=−181-\tfrac14-\tfrac78 = -\tfrac18 and the constant term is −78-\tfrac78, so

(Pf)2−18Pf−78=0⟹P∞f=1,\bigl(P^{f}\bigr)^2 - \tfrac18P^{f} - \tfrac78 = 0 \quad\Longrightarrow\quad P^{f}_{\infty} = 1 ,

the other root −78-\tfrac78 being negative and so inadmissible for a variance.

The limiting gain and filtered variance are then K∞=1/(1+1)=12K_\infty = 1/(1+1) = \tfrac12 and P∞=(1−12)⋅1=12P_\infty = (1-\tfrac12)\cdot 1 = \tfrac12. Consistency check of the fixed point: F2P∞+Q=14⋅12+78=18+78=1=P∞fF^2P_\infty + Q = \tfrac14\cdot\tfrac12+\tfrac78 = \tfrac18+\tfrac78 = 1 = P^{f}_\infty.

Step 2: the four steps, in exact arithmetic. With m0=0m_0=0, P0=4P_0=4:

kk mkfm_k^{f} PkfP_k^{f} SkS_k KkK_k dkd_k mkm_k PkP_k
1 00 158=1.875\tfrac{15}{8}=1.875 238\tfrac{23}{8} 1523=0.652174\tfrac{15}{23}=0.652174 1.21.2 1823=0.782609\tfrac{18}{23}=0.782609 0.6521740.652174
2 0.3913040.391304 191184=1.038043\tfrac{191}{184}=1.038043 375184\tfrac{375}{184} 191375=0.509333\tfrac{191}{375}=0.509333 0.0086960.008696 0.3957330.395733 0.5093330.509333
3 0.1978670.197867 30073000=1.002333\tfrac{3007}{3000}=1.002333 60073000\tfrac{6007}{3000} 30076007=0.500583\tfrac{3007}{6007}=0.500583 −0.797867-0.797867 −0.201532-0.201532 0.5005830.500583
4 −0.100766-0.100766 4806348056=1.000146\tfrac{48063}{48056}=1.000146 9611948056\tfrac{96119}{48056} 4806396119=0.500036\tfrac{48063}{96119}=0.500036 0.2007660.200766 −0.000376-0.000376 0.5000360.500036

One line in full, to show the arithmetic. At k=2k=2: m2f=12⋅1823=923=0.391304m_2^{f} = \tfrac12\cdot\tfrac{18}{23} = \tfrac{9}{23} = 0.391304 and P2f=14⋅1523+78=1592+78=30+161184=191184P_2^{f} = \tfrac14\cdot\tfrac{15}{23}+\tfrac78 = \tfrac{15}{92}+\tfrac78 = \tfrac{30+161}{184} = \tfrac{191}{184}. Then S2=191184+1=375184S_2 = \tfrac{191}{184}+1 = \tfrac{375}{184}, K2=191375K_2 = \tfrac{191}{375}, d2=0.4−923=1115=0.008696d_2 = 0.4 - \tfrac{9}{23} = \tfrac{1}{115} = 0.008696, and m2=923+191375⋅1115=7421875=0.395733m_2 = \tfrac{9}{23}+\tfrac{191}{375}\cdot\tfrac{1}{115} = \tfrac{742}{1875} = 0.395733, P2=(1−191375)191184=191375P_2 = \bigl(1-\tfrac{191}{375}\bigr)\tfrac{191}{184} = \tfrac{191}{375}. (With R=1R=1 one always has Pk=KkP_k = K_k here, since Pk=PkfR/(Pkf+R)P_k = P_k^{f}R/(P_k^{f}+R).)

Step 3: how fast the variance converges. The departures from the fixed point are

Pkf−1:0.875,  0.0380435,  0.00233333,  0.000145663,P_k^{f}-1 : \quad 0.875,\ \ 0.0380435,\ \ 0.00233333,\ \ 0.000145663 ,

with successive ratios 0.043480.04348, 0.061330.06133, 0.062430.06243, approaching F2(1−K∞)2=14⋅14=116=0.0625F^2(1-K_\infty)^2 = \tfrac14\cdot\tfrac14 = \tfrac{1}{16} = 0.0625. Three observations have already wiped out the vague prior: by k=3k=3 the variance is within 0.2%0.2\% of its limit.

Step 4: the answer, and an independent check. The filtered estimate after four observations is

 x4∣Y4  ∼  N(−0.000376,  0.500036) ,i.e. x4=−0.0004±0.7071.\boxed{\,x_4 \mid Y_4 \;\sim\; N\bigl(-0.000376,\; 0.500036\bigr)\,}, \qquad \text{i.e. } x_4 = -0.0004 \pm 0.7071 .

As a check that owes nothing to the recursion, note that (x0,x1,…,x4,y1,…,y4)(x_0,x_1,\dots,x_4,y_1,\dots,y_4) is one nine-dimensional normal vector: it is the image of the nine independent variables (x0,w1,…,w4,v1,…,v4)(x_0,w_1,\dots,w_4,v_1,\dots,v_4) under an explicit 9×99\times 9 matrix MM, so its covariance is Mdiag⁡(4,78,78,78,78,1,1,1,1)MTM\operatorname{diag}(4,\tfrac78,\tfrac78,\tfrac78,\tfrac78,1,1,1,1)M^{\mathsf T}. Conditioning the x4x_4 component on the four yy components by the single Schur-complement formula of The multivariate normal distribution — one 4×44\times4 inversion, no recursion — was carried out in exact rational arithmetic and gave

mean=−361961190=−0.00037558,variance=4806396119=0.50003641,\text{mean} = -\tfrac{361}{961190} = -0.00037558 , \qquad \text{variance} = \tfrac{48063}{96119} = 0.50003641 ,

the same rationals the table produces. The point of the filter is that the direct route needs a k×kk \times k inversion that grows with the record, while the recursion needs one 1×11\times1 division per step.

Reading the numbers. The data are noisy (R=1R=1) and the signal is modestly persistent (F=12F=\tfrac12), so the filter settles on trusting each new observation exactly half as much as it trusts its own forecast, and halves the variance from 11 to 12\tfrac12 at each update. The final estimate is near zero although the last observation was +0.1+0.1: the previous value was estimated at −0.20-0.20, the forecast from it was −0.10-0.10, and the innovation +0.20+0.20 was only half believed.

Application(Where the recursion earns its keep)Original

Navigation and tracking. The original use. The state is position, velocity and attitude; FF encodes the equations of motion over one time step, QQ the unmodelled accelerations, and the observations are ranges, Doppler shifts or inertial readings. Every satellite navigation receiver runs a filter of this kind, and the reported accuracy is the diagonal of PkP_k.

Estimating a trend as it happens. A trend plus red noise is a two-component state, xk=(level,slope)x_k = (\text{level},\text{slope}), with F=(1101)F = \begin{pmatrix}1 & 1\\ 0 & 1\end{pmatrix}. The filter then produces an estimate of the current level and slope from all data so far, with uncertainties, and does not need to be refitted when a new point arrives. This is the recursive counterpart of Least-squares fitting, and the two agree when the model is static (F=IF=I, Q=0Q=0).

Calibration and fault detection. Part (iii) turns the filter into a test. The standardised innovations are independent standard normals when the model is right, so a run of same-signed innovations, or a dkTSk−1dkd_k^{\mathsf T}S_k^{-1}d_k far above pp, is evidence of a drifting instrument or a wrong FF. Monitoring the innovations is cheaper and more sensitive than monitoring the state estimate itself.

Geophysical and climate analysis. When the state is a discretised field with nn in the millions, PkP_k cannot be stored, let alone propagated, and the exact recursion is replaced by approximations that keep its structure: the gain is built from a prescribed or ensemble-estimated covariance. That is the subject of Optimal interpolation and variational data assimilation, where the forecast covariance PkfP_k^{f} becomes the prescribed background covariance BB and the update step becomes optimal interpolation.

Method · advanced

Optimal interpolation and variational data assimilation

Adapted

Derives the best linear unbiased analysis xa=xb+K(y−Hxb)x_a = x_b + K(y-Hx_b) with K=BHT(HBHT+R)−1K = BH^{\mathsf T}(HBH^{\mathsf T}+R)^{-1} by completing the square in the gain, proves that it also minimises the 3D-Var cost function and that the two routes agree exactly when BB is invertible, and interpolates a temperature analysis from two stations, obtaining weights 0.7404450.740445 and −0.135366-0.135366, an analysis of 1.9490 K1.9490\,\mathrm{K} and an analysis error variance 0.425475 K20.425475\,\mathrm{K^2} against a background variance of 11.

Prerequisites: The Kalman filter, Least-squares fitting, The multivariate normal distribution, Stationary processes and spectral densities, Bayesian inference, Quadratic forms and the Rayleigh quotient, Linear systems and rank, Propagation of uncertainty

Note(The problem this solves)Original

A weather forecast starts from a state of the atmosphere: wind, temperature and humidity on a grid with far more unknowns than there are measurements. Observations are sparse, irregularly placed, of mixed type, and noisy. The only reason the problem is solvable at all is that a previous forecast, valid now, supplies a first guess everywhere. Data assimilation is the business of correcting that guess with the observations, and reporting the uncertainty of the result.

Two formulations are in use, and they look quite different. Optimal interpolation writes the correction as a matrix times the observed discrepancies and chooses the matrix to minimise the error variance. Three-dimensional variational assimilation (3D-Var) writes down a cost function measuring disagreement with the guess and with the observations, and minimises it. This unit derives the first, derives the second, and shows that under the stated hypotheses they produce the same analysis and the same error covariance. The difference is computational, not statistical: one inverts a matrix of the size of the observation vector, the other descends a function of the size of the state vector, and in operational practice the sizes differ by several orders of magnitude.

The update step of The Kalman filter is the same calculation. There the prior covariance was the forecast covariance PkfP_k^{f} produced by the filter's own recursion; here it is a prescribed background covariance BB, because a state of dimension 10810^{8}-10910^{9}, depending on the model resolution, makes the recursion impossible to run.

Definition(Background, observations and the analysis)Original

Let the unknown true state be a fixed (non-random) vector x∈Rnx \in \mathbb{R}^{n}. Two sources of information about it are given.

  • A background (or first guess) xb∈Rnx_b \in \mathbb{R}^{n}, with background error eb=xb−xe_b = x_b - x satisfying E[eb]=0,Cov⁡[eb]=E[ebebT]=B,\mathbb{E}[e_b] = 0 , \qquad \operatorname{Cov}[e_b] = \mathbb{E}\bigl[e_be_b^{\mathsf T}\bigr] = B , with BB symmetric positive semi-definite and known.
  • An observation vector y∈Rpy \in \mathbb{R}^{p}, related to the state by a known p×np\times n observation operator HH (linear here), y=Hx+ε,E[ε]=0,Cov⁡[ε]=R,y = Hx + \varepsilon , \qquad \mathbb{E}[\varepsilon] = 0 , \qquad \operatorname{Cov}[\varepsilon] = R , with RR symmetric positive definite and known.

Assume further that the two error vectors are uncorrelated, E[ebεT]=0\mathbb{E}\bigl[e_b\varepsilon^{\mathsf T}\bigr] = 0. No distributional assumption is made: only first and second moments enter until the final remark.

The quantities built from these are

d  =  y−Hxb(the innovation, or observation-minus-background),S  =  HBHT+R(its covariance),d \;=\; y - Hx_b \quad (\text{the \textbf{innovation}, or observation-minus-background}), \qquad S \;=\; HBH^{\mathsf T} + R \quad (\text{its covariance}) ,

the second because d=y−Hxb=ε−Hebd = y - Hx_b = \varepsilon - He_b, whence Cov⁡[d]=HBHT+R\operatorname{Cov}[d] = HBH^{\mathsf T}+R by the covariance law of Propagation of uncertainty and the assumed lack of correlation.

An analysis is any estimate xax_a of xx built from xbx_b and yy; it is linear if xa=Lxb+Kyx_a = Lx_b + Ky for fixed matrices L,KL, K, and unbiased if E[xa−x]=0\mathbb{E}[x_a - x] = 0 whatever the true xx. Its quality is measured by the analysis error covariance A=E[(xa−x)(xa−x)T]A = \mathbb{E}\bigl[(x_a-x)(x_a-x)^{\mathsf T}\bigr].

Method(The best linear unbiased analysis)Original

Under the hypotheses above:

(i) Unbiasedness fixes LL. A linear analysis xa=Lxb+Kyx_a = Lx_b + Ky is unbiased for every true xx exactly when L=I−KHL = I - KH, equivalently exactly when it takes the form

xa  =  xb+K (y−Hxb)  =  xb+Kd.x_a \;=\; x_b + K\,(y - Hx_b) \;=\; x_b + Kd .

The correction is thus always a matrix times the innovation; only KK, the gain, is free.

(ii) The error covariance as a function of the gain. For such an analysis,

A(K)  =  (I−KH) B (I−KH)T+K R KT.A(K) \;=\; (I-KH)\,B\,(I-KH)^{\mathsf T} + K\,R\,K^{\mathsf T} .

(iii) The optimal gain. With S=HBHT+RS = HBH^{\mathsf T}+R (invertible, since RR is positive definite), put

K∗  =  B HTS−1.K_\ast \;=\; B\,H^{\mathsf T}S^{-1} .

Then for every KK,

A(K)  =  A(K∗)+(K−K∗) S (K−K∗)T,A(K∗)=(I−K∗H)B=B−BHTS−1HB,A(K) \;=\; A(K_\ast) + (K-K_\ast)\,S\,(K-K_\ast)^{\mathsf T} , \qquad A(K_\ast) = (I - K_\ast H)B = B - BH^{\mathsf T}S^{-1}HB ,

so A(K)−A(K∗)A(K) - A(K_\ast) is positive semi-definite for every KK, and is zero only for K=K∗K = K_\ast. The analysis xa=xb+K∗dx_a = x_b + K_\ast d is therefore the best linear unbiased estimate (BLUE) of xx: it has the smallest error variance for every component, and indeed for every linear functional uTxu^{\mathsf T}x of the state, among all linear unbiased analyses. Computing xax_a and AA from these formulas is optimal interpolation.

(iv) Orthogonality. The optimal analysis error is uncorrelated with the innovation: E[(xa−x) dT]=0\mathbb{E}\bigl[(x_a-x)\,d^{\mathsf T}\bigr] = 0. Conversely this property determines K∗K_\ast.

(v) The information form. If in addition BB is invertible, then A=A(K∗)A = A(K_\ast) is invertible and

A−1  =  B−1+HTR−1H,K∗  =  A HTR−1.A^{-1} \;=\; B^{-1} + H^{\mathsf T}R^{-1}H , \qquad K_\ast \;=\; A\,H^{\mathsf T}R^{-1} .
Method(3D-Var, and its equivalence with optimal interpolation)Original

Assume in addition that BB is invertible, and define the 3D-Var cost function J:Rn→RJ : \mathbb{R}^{n}\to\mathbb{R},

J(x)  =  12 (x−xb)TB−1(x−xb)  +  12 (y−Hx)TR−1(y−Hx).J(x) \;=\; \tfrac12\,(x-x_b)^{\mathsf T}B^{-1}(x-x_b) \;+\; \tfrac12\,(y-Hx)^{\mathsf T}R^{-1}(y-Hx) .

Then:

  1. JJ is strictly convex with Hessian ∇2J=B−1+HTR−1H\nabla^2 J = B^{-1}+H^{\mathsf T}R^{-1}H, constant in xx and positive definite, so JJ has exactly one minimiser.
  2. That minimiser is the best linear unbiased analysis of the previous statement: arg min⁡xJ(x)  =  xb+K∗(y−Hxb)  =  xa.\operatorname*{arg\,min}_{x} J(x) \;=\; x_b + K_\ast(y - Hx_b) \;=\; x_a .
  3. The inverse Hessian is the analysis error covariance: (∇2J)−1=A\bigl(\nabla^2J\bigr)^{-1} = A.
  4. The minimum value is J(xa)=12 dTS−1dJ(x_a) = \tfrac12\,d^{\mathsf T}S^{-1}d, a quadratic form in the innovation alone.

So optimal interpolation and 3D-Var are two ways of computing one object. If the errors are in addition jointly normal, both coincide with the Bayesian posterior: x∣y∼N(xa,A)x \mid y \sim N(x_a, A), since −log⁡-\log of (prior ×\times likelihood) is JJ up to a constant, by Bayesian inference and The multivariate normal distribution.

Idea of the proofOriginal

Three short arguments, one for each part.

Unbiasedness. The analysis error of Lxb+KyLx_b+Ky contains a term (L+KH−I)x(L+KH-I)x in the unknown true state. Since the estimate must be unbiased for every xx, and xx is not random, that term has to vanish identically, which pins LL down with no optimisation at all.

Optimality. A(K)A(K) is a quadratic function of the matrix KK with positive-definite "second derivative" SS. Completing the square in KK — exactly as one minimises aK2+bK+caK^2+bK+c — exhibits A(K)A(K) as a constant matrix plus (K−K∗)S(K−K∗)T(K-K_\ast)S(K-K_\ast)^{\mathsf T}, and the second term is positive semi-definite and vanishes only at K∗K_\ast. Because the comparison is between whole matrices, this gives optimality for every linear functional of the state at once, not merely for the trace.

Equivalence. Setting the gradient of JJ to zero gives (B−1+HTR−1H)x=B−1xb+HTR−1y(B^{-1}+H^{\mathsf T}R^{-1}H)x = B^{-1}x_b + H^{\mathsf T}R^{-1}y. One algebraic identity, verified by multiplying out, says that the matrix on the left is A−1A^{-1} and that AHTR−1=K∗AH^{\mathsf T}R^{-1} = K_\ast; with it the solution rearranges into xb+K∗dx_b + K_\ast d in two lines. The same identity shows why 2J2J is Riley, Hobson and Bence's weighted χ2\chi^2 for the design matrix that stacks the background on top of the observations: the factor 12\tfrac12 is a convention of the variational literature, and it is the same factor that turns their 12 ∂2χ2/∂ai∂aj\tfrac12\,\partial^2\chi^2/\partial a_i\partial a_j into our ∇2J\nabla^2 J.

Proof(Unbiasedness, optimality, the identity, and 3D-Var)AdaptedAdapted from Riley, Hobson & Bence (2006), §31.8, Exercise 31.6, p. 1299; Riley, Hobson & Bence (2006), §31.6.1, eqs. (31.92)-(31.99), pp. 1272-1274

(i) Unbiasedness. Substituting xb=x+ebx_b = x + e_b and y=Hx+εy = Hx+\varepsilon,

xa−x=Lxb+Ky−x=(L+KH−I) x+L eb+K ε.x_a - x = Lx_b + Ky - x = (L + KH - I)\,x + L\,e_b + K\,\varepsilon .

Taking expectations and using E[eb]=E[ε]=0\mathbb{E}[e_b] = \mathbb{E}[\varepsilon] = 0 leaves E[xa−x]=(L+KH−I)x\mathbb{E}[x_a-x] = (L+KH-I)x. This vanishes for every x∈Rnx \in \mathbb{R}^{n} exactly when the matrix L+KH−IL+KH-I is zero, since a matrix annihilating all of Rn\mathbb{R}^{n} is the zero matrix. Hence L=I−KHL = I-KH and xa=(I−KH)xb+Ky=xb+K(y−Hxb)x_a = (I-KH)x_b + Ky = x_b + K(y-Hx_b). This is the matrix version of the step in Riley, Hobson and Bence's Exercise 31.6 where unbiasedness of a linear estimator is imposed before efficiency is optimised. Note that the hypothesis that xx is a fixed unknown vector, not a random one, is what forces the condition to hold for all xx.

(ii) The error covariance. With L=I−KHL = I-KH the display above gives

xa−x=(I−KH) eb+K ε.x_a - x = (I-KH)\,e_b + K\,\varepsilon .

Since E[ebεT]=0\mathbb{E}\bigl[e_b\varepsilon^{\mathsf T}\bigr] = 0, the cross terms in E[(xa−x)(xa−x)T]\mathbb{E}\bigl[(x_a-x)(x_a-x)^{\mathsf T}\bigr] vanish and

A(K)=(I−KH) E[ebebT] (I−KH)T+K E[εεT] KT=(I−KH)B(I−KH)T+KRKT.A(K) = (I-KH)\,\mathbb{E}\bigl[e_be_b^{\mathsf T}\bigr]\,(I-KH)^{\mathsf T} + K\,\mathbb{E}\bigl[\varepsilon\varepsilon^{\mathsf T}\bigr]\,K^{\mathsf T} = (I-KH)B(I-KH)^{\mathsf T} + KRK^{\mathsf T} .

It is the lack of correlation between background and observation errors, and nothing else, that is used here.

(iii) Completing the square. S=HBHT+RS = HBH^{\mathsf T}+R is positive definite: for u≠0u\ne0, uTSu=(HTu)TB(HTu)+uTRu>0u^{\mathsf T}Su = (H^{\mathsf T}u)^{\mathsf T}B(H^{\mathsf T}u) + u^{\mathsf T}Ru > 0, the first term being ≥0\ge 0 because BB is positive semi-definite and the second >0>0 because RR is positive definite (Quadratic forms and the Rayleigh quotient). So S−1S^{-1} exists and is positive definite, and K∗=BHTS−1K_\ast = BH^{\mathsf T}S^{-1} is defined.

Expand (ii):

A(K)=B−KHB−BHTKT+K(HBHT+R)KT=B−KHB−BHTKT+KSKT.A(K) = B - KHB - BH^{\mathsf T}K^{\mathsf T} + K\bigl(HBH^{\mathsf T}+R\bigr)K^{\mathsf T} = B - KHB - BH^{\mathsf T}K^{\mathsf T} + KSK^{\mathsf T} .

Separately, since SK∗T=SS−1HB=HBSK_\ast^{\mathsf T} = SS^{-1}HB = HB and K∗SK∗T=BHTS−1HBK_\ast S K_\ast^{\mathsf T} = BH^{\mathsf T}S^{-1}HB,

(K−K∗)S(K−K∗)T=KSKT−KHB−BHTKT+BHTS−1HB.(K-K_\ast)S(K-K_\ast)^{\mathsf T} = KSK^{\mathsf T} - KHB - BH^{\mathsf T}K^{\mathsf T} + BH^{\mathsf T}S^{-1}HB .

Subtracting, every KK-dependent term cancels:

A(K)−(K−K∗)S(K−K∗)T=B−BHTS−1HB,A(K) - (K-K_\ast)S(K-K_\ast)^{\mathsf T} = B - BH^{\mathsf T}S^{-1}HB ,

a matrix independent of KK. Putting K=K∗K = K_\ast identifies it as A(K∗)=B−K∗HB=(I−K∗H)BA(K_\ast) = B - K_\ast HB = (I-K_\ast H)B, and the stated decomposition follows.

For any u∈Rnu \in \mathbb{R}^{n}, uT(A(K)−A(K∗))u=vTSv≥0u^{\mathsf T}\bigl(A(K)-A(K_\ast)\bigr)u = v^{\mathsf T}Sv \ge 0 with v=(K−K∗)Tuv = (K-K_\ast)^{\mathsf T}u, so the difference is positive semi-definite; taking uu to be a coordinate vector gives the componentwise variance statement. If the difference is the zero matrix then vTSv=0v^{\mathsf T}Sv = 0 for every uu, and positive definiteness of SS forces v=0v = 0 for every uu, that is K=K∗K = K_\ast.

(iv) Orthogonality. From (ii), xa−x=(I−KH)eb+Kεx_a - x = (I-KH)e_b + K\varepsilon and d=ε−Hebd = \varepsilon - He_b, so

E[(xa−x)dT]=−(I−KH)BHT+KR=−BHT+K(HBHT+R)=KS−BHT,\mathbb{E}\bigl[(x_a-x)d^{\mathsf T}\bigr] = -(I-KH)BH^{\mathsf T} + KR = -BH^{\mathsf T} + K\bigl(HBH^{\mathsf T}+R\bigr) = KS - BH^{\mathsf T} ,

using E[ebεT]=0\mathbb{E}[e_b\varepsilon^{\mathsf T}]=0 twice. This vanishes precisely when K=BHTS−1=K∗K = BH^{\mathsf T}S^{-1} = K_\ast. Geometrically this is the Projection theorem (7.9.14) of Grimmett and Stirzaker, applied not to xx itself — which is a fixed vector, not a member of any L2L^2 space — but to the random part of the problem: the correction KdKd is the orthogonal projection of the background error −eb-e_b onto the span of the components of dd, since xa−x=(xb−x)+Kd=eb+Kdx_a - x = (x_b - x) + Kd = e_b + Kd is exactly minus the residual (−eb)−Kd(-e_b) - Kd of that projection. Vanishing of the display above is, up to sign, the orthogonality condition E[((−eb)−Kd)dT]=0\mathbb{E}\bigl[\bigl((-e_b) - Kd\bigr)d^{\mathsf T}\bigr] = 0 of that theorem, and it says that the analysis error is uncorrelated with every linear function of the data: dd carries all the information the data hold about ebe_b.

(v) The information identity. Assume BB invertible. First note

K∗HBHT=BHTS−1(S−R)=BHT−K∗R,soBHT−K∗HBHT=K∗R.(∗)K_\ast HBH^{\mathsf T} = BH^{\mathsf T}S^{-1}\bigl(S-R\bigr) = BH^{\mathsf T} - K_\ast R , \qquad\text{so}\qquad BH^{\mathsf T} - K_\ast HBH^{\mathsf T} = K_\ast R . \tag{$\ast$}

Then

A(B−1+HTR−1H)=(I−K∗H)B(B−1+HTR−1H)=(I−K∗H)+(BHT−K∗HBHT)R−1H,A\bigl(B^{-1}+H^{\mathsf T}R^{-1}H\bigr) = (I-K_\ast H)B\bigl(B^{-1}+H^{\mathsf T}R^{-1}H\bigr) = (I-K_\ast H) + \bigl(BH^{\mathsf T}-K_\ast HBH^{\mathsf T}\bigr)R^{-1}H ,

and by (∗)(\ast) the last bracket is K∗RK_\ast R, so the whole expression is I−K∗H+K∗RR−1H=II - K_\ast H + K_\ast RR^{-1}H = I. Hence AA is invertible with A−1=B−1+HTR−1HA^{-1} = B^{-1}+H^{\mathsf T}R^{-1}H. The same identity gives

AHTR−1=(I−K∗H)BHTR−1=(BHT−K∗HBHT)R−1=K∗RR−1=K∗.AH^{\mathsf T}R^{-1} = (I-K_\ast H)BH^{\mathsf T}R^{-1} = \bigl(BH^{\mathsf T}-K_\ast HBH^{\mathsf T}\bigr)R^{-1} = K_\ast RR^{-1} = K_\ast .

(vi) 3D-Var. Differentiating the two quadratic forms,

∇J(x)=B−1(x−xb)−HTR−1(y−Hx),∇2J=B−1+HTR−1H,\nabla J(x) = B^{-1}(x-x_b) - H^{\mathsf T}R^{-1}(y-Hx) , \qquad \nabla^2 J = B^{-1}+H^{\mathsf T}R^{-1}H ,

the Hessian being constant because JJ is quadratic. It is positive definite (B−1B^{-1} is, and HTR−1HH^{\mathsf T}R^{-1}H is positive semi-definite), so JJ is strictly convex and its unique stationary point is its unique minimum. Setting ∇J=0\nabla J = 0,

(B−1+HTR−1H)x=B−1xb+HTR−1y.\bigl(B^{-1}+H^{\mathsf T}R^{-1}H\bigr)x = B^{-1}x_b + H^{\mathsf T}R^{-1}y .

By (v) the matrix on the left is A−1A^{-1}. Adding and subtracting HTR−1HxbH^{\mathsf T}R^{-1}Hx_b on the right,

x=A((B−1+HTR−1H)xb+HTR−1(y−Hxb))=xb+AHTR−1d=xb+K∗d=xa,x = A\Bigl(\bigl(B^{-1}+H^{\mathsf T}R^{-1}H\bigr)x_b + H^{\mathsf T}R^{-1}(y-Hx_b)\Bigr) = x_b + AH^{\mathsf T}R^{-1}d = x_b + K_\ast d = x_a ,

using (v) once more for AHTR−1=K∗AH^{\mathsf T}R^{-1}=K_\ast. Claim 3 is the first sentence of (v). For claim 4, write xa−xb=K∗dx_a - x_b = K_\ast d and y−Hxa=d−HK∗d=(I−HK∗)dy - Hx_a = d - HK_\ast d = (I - HK_\ast)d. Since HK∗=HBHTS−1=(S−R)S−1=I−RS−1HK_\ast = HBH^{\mathsf T}S^{-1} = (S-R)S^{-1} = I - RS^{-1}, this is RS−1dRS^{-1}d, so

2J(xa)=dTK∗TB−1K∗d+dTS−1R R−1R S−1d=dTS−1(HBHT)S−1d+dTS−1RS−1d=dTS−1d,2J(x_a) = d^{\mathsf T}K_\ast^{\mathsf T}B^{-1}K_\ast d + d^{\mathsf T}S^{-1}R\,R^{-1}R\,S^{-1}d = d^{\mathsf T}S^{-1}\bigl(HBH^{\mathsf T}\bigr)S^{-1}d + d^{\mathsf T}S^{-1}RS^{-1}d = d^{\mathsf T}S^{-1}d ,

where K∗TB−1K∗=S−1HB B−1BHTS−1=S−1HBHTS−1K_\ast^{\mathsf T}B^{-1}K_\ast = S^{-1}HB\,B^{-1}BH^{\mathsf T}S^{-1} = S^{-1}HBH^{\mathsf T}S^{-1} and the two terms recombine through HBHT+R=SHBH^{\mathsf T}+R = S. □\square

Remark(Where the hypotheses are used, and what fails without them)Original
  • Uncorrelated background and observation errors is used once, in part (ii), and it is the hypothesis most often violated in practice. If E[ebεT]=C≠0\mathbb{E}[e_b\varepsilon^{\mathsf T}] = C \ne 0 — for instance when an observation has already been used to make the background, as happens if the same radiosonde enters two successive analyses — then A(K)A(K) acquires the cross terms (I−KH)CKT+KCT(I−KH)T(I-KH)CK^{\mathsf T} + KC^{\mathsf T}(I-KH)^{\mathsf T}, and repeating the derivative of part (ii) gives the optimal gain
K∗C=(BHT−C)(HBHT+R−HC−CTHT)−1.K_\ast^{C} = \bigl(BH^{\mathsf T} - C\bigr)\bigl(HBH^{\mathsf T} + R - HC - C^{\mathsf T}H^{\mathsf T}\bigr)^{-1} .

The minus signs are forced by our conventions, and are worth tracing: with eb=xb−xe_b = x_b - x and y=Hx+εy = Hx + \varepsilon the innovation is d=ε−Hebd = \varepsilon - He_b, so

Cov⁡[d]=HBHT+R−HC−CTHT,E[ebdT]=C−BHT,\operatorname{Cov}[d] = HBH^{\mathsf T} + R - HC - C^{\mathsf T}H^{\mathsf T} , \qquad \mathbb{E}\bigl[e_b d^{\mathsf T}\bigr] = C - BH^{\mathsf T} ,

and K∗C=−E[ebdT]Cov⁡[d]−1K_\ast^{C} = -\mathbb{E}[e_bd^{\mathsf T}]\operatorname{Cov}[d]^{-1} exactly as in the uncorrelated case; writing a plus in the denominator would not even give a covariance. A scalar check, H=1H = 1, B=2B = 2, R=0.5R = 0.5, C=0.6C = 0.6: the analysis variance is A(K)=2(1−K)2+12K2+1.2 K(1−K)A(K) = 2(1-K)^2 + \tfrac12 K^2 + 1.2\,K(1-K), minimised at K=1413=1.076923K = \tfrac{14}{13} = 1.076923 with A=3265=0.492308A = \tfrac{32}{65} = 0.492308, and the formula above returns 1.4/1.3=14131.4/1.3 = \tfrac{14}{13} exactly. The plus-sign version would give K=2.6/3.7=0.702703K = 2.6/3.7 = 0.702703, where A=0.674361A = 0.674361 — worse by 37%37\%.

Using the uncorrelated K∗K_\ast anyway leaves the analysis unbiased, but its true error no longer matches the reported AA. The cross terms above give the discrepancy exactly:

Atrue−A  =  (I−K∗H) C K∗T+K∗CT(I−K∗H)T.A_{\text{true}} - A \;=\; (I-K_\ast H)\,C\,K_\ast^{\mathsf T} + K_\ast C^{\mathsf T}(I-K_\ast H)^{\mathsf T} .

A matrix of this form is in general indefinite, whatever the sign of CC, so the reported covariance can err in either direction, and in different directions in different components. Take n=p=2n = p = 2, H=IH = I and

B=(5445),R=(4−3−35),C=(2121214),B = \begin{pmatrix}5&4\\4&5\end{pmatrix} , \qquad R = \begin{pmatrix}4&-3\\-3&5\end{pmatrix} , \qquad C = \begin{pmatrix}2&\tfrac12\\\tfrac12&\tfrac14\end{pmatrix} ,

all three positive definite, and the joint error covariance (BCCTR)\left(\begin{smallmatrix}B&C\\C^{\mathsf T}&R\end{smallmatrix}\right) positive definite as well (its eigenvalues are 0.1083280.108328, 1.9389881.938988, 7.3237697.323769, 9.6289159.628915). Then S=(91110)S = \left(\begin{smallmatrix}9&1\\1&10\end{smallmatrix}\right), the reported variances are diag⁡A=(91/89, 100/89)=(1.022472, 1.123596)\operatorname{diag}A = (91/89,\,100/89) = (1.022472,\,1.123596) and the true ones are (1.948933, 0.660144)(1.948933,\,0.660144): the first component is understated, the second overstated, although CC is positive definite. Replacing CC by −C-C keeps the joint covariance positive definite — it is congruent to the original by diag⁡(I,−I)\operatorname{diag}(I,-I) — and simply exchanges the two directions of error.

Only in the scalar case is there a clean rule, and only for H>0H > 0. There 0<K∗H<10 < K_\ast H < 1, the discrepancy is 2(1−K∗H)K∗C2(1-K_\ast H)K_\ast C, and it carries the sign of CC: positive correlation — the radiosonde case, where the shared observation has pushed background and observation errors the same way — makes the true error exceed the reported AA, so that the system is overconfident, which is worse than being wrong, while negative correlation leaves the reported AA merely pessimistic. The check above, H=1H=1, B=2B=2, R=12R=\tfrac12, C=0.6C=0.6, is of this kind: the reported A=(1−K∗)B=0.4A = (1-K_\ast)B = 0.4 against a true 0.5920.592. Even here the sign of HH matters: H=−1H = -1, B=2B = 2, R=12R = \tfrac12, C=0.4C = 0.4 gives K∗=−0.8K_\ast = -0.8, a reported A=0.4A = 0.4 and a true 0.2720.272. Overconfidence is the danger to watch for, but which way the error goes has to be computed, not inferred from the sign of CC.

  • Unbiased errors. Part (i) needs E[eb]=0\mathbb{E}[e_b] = 0. A systematic model bias β=E[eb]≠0\beta = \mathbb{E}[e_b] \ne 0 propagates straight through: the analysis inherits the bias (I−KH)β(I-KH)\beta, and no choice of gain removes it, because the derivation of (i) then yields E[xa−x]=(I−KH)β\mathbb{E}[x_a-x] = (I-KH)\beta for every admissible KK. Bias must be estimated and removed separately; this is why operational systems carry a bias-correction stage ahead of the analysis.
  • RR positive definite is used to invert SS in parts (iii)-(iv), and again as R−1R^{-1} itself from part (v) onwards, in the cost function and throughout (vi). BB may be singular — a background known exactly along some direction is allowed — and parts (i)-(iv) survive. Part (v) and the whole of 3D-Var need B−1B^{-1}, so the variational form is strictly less general than optimal interpolation. This matters: ensemble-based background covariances have rank below nn and are singular, which is why they are used through the gain formula, or regularised before B−1B^{-1} is formed.
  • Linearity of HH. With a non-linear observation operator hh the cost function J(x)=12(x−xb)TB−1(x−xb)+12(y−h(x))TR−1(y−h(x))J(x) = \tfrac12(x-x_b)^{\mathsf T}B^{-1}(x-x_b)+\tfrac12(y-h(x))^{\mathsf T}R^{-1}(y-h(x)) is still minimised numerically, but it need not be convex and the minimiser is no longer a linear function of yy. Linearising hh about the background and iterating (incremental 3D-Var) recovers a sequence of problems of the kind treated here; it converges to a stationary point of JJ, not necessarily the global one.
  • No normality is needed for the BLUE statement, exactly as in the Gauss-Markov theorem of Least-squares fitting: only the first two moments enter. Normality buys one extra thing, stated in the last line of the 3D-Var statement, namely that xax_a is the conditional mean and therefore the best estimate of any form, linear or not.
  • Which costs less. Optimal interpolation inverts SS, of size p×pp\times p; 3D-Var minimises over Rn\mathbb{R}^{n}, usually by a conjugate-gradient method whose cost per iteration is one multiplication by BB and one by HH. For a modern forecasting system n∼108n \sim 10^{8}-10910^{9} and p∼107p \sim 10^{7}, so neither matrix can be formed and both routes are run in a reduced space; the variational form is preferred because BB can be applied as a sequence of filters without ever being stored.
Method(Optimal interpolation at a point)Original

The classical use is to analyse one grid point at a time from nearby observations, which keeps every matrix small. Let the analysis point be PP and let pp observations be selected within some radius of it.

  1. Specify the background error statistics. Write Bij=σb(i) σb(j) ρ(rij)B_{ij} = \sigma_b(i)\,\sigma_b(j)\,\rho(r_{ij}), with σb\sigma_b the background error standard deviation and ρ\rho a correlation function of the separation rijr_{ij}, decreasing from ρ(0)=1\rho(0)=1. The choice of ρ\rho must be a valid correlation function, i.e. non-negative definite (Stationary processes and spectral densities); the Gaussian ρ(r)=e−r2/(2L2)\rho(r) = e^{-r^2/(2L^2)} is the usual default, LL being the correlation length.
  2. Form S=HBHT+RS = HBH^{\mathsf T}+R, the p×pp\times p matrix of background error covariances between the observation locations, plus the observation error covariance RR (diagonal if instrument errors are independent).
  3. Form b=b = the column of background error covariances between PP and the observation locations, that is the row of BHTBH^{\mathsf T} belonging to PP.
  4. Solve S w=bS\,w = b for the weight vector ww, by Cholesky factorisation (Linear systems and rank); do not invert SS.
  5. Analyse. xa(P)=xb(P)+wTdx_a(P) = x_b(P) + w^{\mathsf T}d with dd the vector of innovations at the observation locations.
  6. Report the uncertainty. The analysis error variance at PP is σb(P)2−wTb\sigma_b(P)^2 - w^{\mathsf T}b, the diagonal entry of A=B−BHTS−1HBA = B - BH^{\mathsf T}S^{-1}HB. It is never larger than σb(P)2\sigma_b(P)^2, and the reduction wTbw^{\mathsf T}b measures what the observations were worth.
  7. Check. Verify 2J(xa)=dTS−1d2J(x_a) = d^{\mathsf T}S^{-1}d against its expectation pp: the innovations have covariance SS, so E[dTS−1d]=tr⁡(S−1S)=p\mathbb{E}\bigl[d^{\mathsf T}S^{-1}d\bigr] = \operatorname{tr}\bigl(S^{-1}S\bigr) = p. A value far above pp means BB or RR is too small, far below means they are too large.
Example(A temperature analysis from two stations)Original

Set-up. Three points lie on a line: the analysis point PP at 00, station 11 at 60 km60\,\mathrm{km} and station 22 at 150 km150\,\mathrm{km}. We analyse a temperature anomaly. The background field is uniform, xb=1.00 Kx_b = 1.00\,\mathrm{K} at all three points, with background error standard deviation σb=1 K\sigma_b = 1\,\mathrm{K} everywhere and correlation

ρ(r)=exp⁡(−r2/(2L2)),L=100 km.\rho(r) = \exp\bigl(-r^2/(2L^2)\bigr) , \qquad L = 100\,\mathrm{km} .

Both stations measure with independent error of standard deviation 0.5 K0.5\,\mathrm{K}, so R=0.25 I2R = 0.25\,I_2 in K2\mathrm{K^2} and HH simply picks out the two station values. The readings are y1=2.30 Ky_1 = 2.30\,\mathrm{K} and y2=1.10 Ky_2 = 1.10\,\mathrm{K}.

Step 1: the covariances. The three separations needed are 6060, 150150 and 9090 km:

ρP1=e−0.18=0.835270,ρP2=e−1.125=0.324652,ρ12=e−0.405=0.666977.\rho_{P1} = e^{-0.18} = 0.835270 , \qquad \rho_{P2} = e^{-1.125} = 0.324652 , \qquad \rho_{12} = e^{-0.405} = 0.666977 .

Hence, in K2\mathrm{K^2},

b=(0.8352700.324652),S=HBHT+R=(10.6669770.6669771)+(0.25000.25)=(1.250.6669770.6669771.25).b = \begin{pmatrix}0.835270\\ 0.324652\end{pmatrix} , \qquad S = HBH^{\mathsf T}+R = \begin{pmatrix}1 & 0.666977\\ 0.666977 & 1\end{pmatrix} + \begin{pmatrix}0.25&0\\0&0.25\end{pmatrix} = \begin{pmatrix}1.25 & 0.666977\\ 0.666977 & 1.25\end{pmatrix} .

Step 2: the weights. det⁡S=1.252−0.6669772=1.5625−0.444858=1.117642\det S = 1.25^2 - 0.666977^2 = 1.5625 - 0.444858 = 1.117642, so solving Sw=bSw = b,

w1=1.25 (0.835270)−0.666977 (0.324652)1.117642=0.8275521.117642=0.740445,w_1 = \frac{1.25\,(0.835270) - 0.666977\,(0.324652)}{1.117642} = \frac{0.827552}{1.117642} = 0.740445 ,w2=1.25 (0.324652)−0.666977 (0.835270)1.117642=−0.1512911.117642=−0.135366.w_2 = \frac{1.25\,(0.324652) - 0.666977\,(0.835270)}{1.117642} = \frac{-0.151291}{1.117642} = -0.135366 .

The second weight is negative. This is not an error and it is the most instructive number here. Station 11 alone would receive weight ρP1/1.25=0.668216\rho_{P1}/1.25 = 0.668216; it is also strongly correlated with station 22, and through station 11 the scheme already predicts an innovation of ρ12×\rho_{12} \times (station 1's innovation) at station 22. Since ρP1ρ12=0.557106\rho_{P1}\rho_{12} = 0.557106 exceeds ρP2=0.324652\rho_{P2} = 0.324652, that prediction overshoots what station 22 is worth at PP, and the optimal scheme subtracts the excess. Observations are never weighted in isolation: S−1S^{-1} decorrelates them first. This is the same screening effect that makes the far station's residual informative mainly as a correction to the near one.

Step 3: the analysis. The innovations are d1=2.30−1.00=1.30 Kd_1 = 2.30-1.00 = 1.30\,\mathrm{K} and d2=1.10−1.00=0.10 Kd_2 = 1.10-1.00 = 0.10\,\mathrm{K}, so

xa(P)=1.00+(0.740445)(1.30)+(−0.135366)(0.10)=1.00+0.9625785−0.0135366=1.949042 K.x_a(P) = 1.00 + (0.740445)(1.30) + (-0.135366)(0.10) = 1.00 + 0.9625785 - 0.0135366 = 1.949042\,\mathrm{K} .

Step 4: the error bar. By step 6 of the method,

APP=σb2−wTb=1−[(0.740445)(0.835270)+(−0.135366)(0.324652)]=1−0.574525=0.425475 K2,A_{PP} = \sigma_b^2 - w^{\mathsf T}b = 1 - \bigl[(0.740445)(0.835270) + (-0.135366)(0.324652)\bigr] = 1 - 0.574525 = 0.425475\,\mathrm{K^2} ,

that is ±0.652285 K\pm 0.652285\,\mathrm{K}, against the background's ±1 K\pm 1\,\mathrm{K}. Station 11 alone would have given 1−(0.835270)2/1.25=0.441859 K21 - (0.835270)^2/1.25 = 0.441859\,\mathrm{K^2}: the second station, negative weight and all, is worth a further reduction of only 0.016384 K20.016384\,\mathrm{K^2}, because almost everything it knows about PP is already known through station 11.

Step 5: the same answer from 3D-Var. Take the state to be the three-vector (xP,x1,x2)(x_P, x_1, x_2) with the full 3×33\times3 background covariance built from the same ρ\rho (its eigenvalues are 0.0741270.074127, 0.6851170.685117, 2.2407562.240756, all positive, so B−1B^{-1} exists) and H=(010001)H = \begin{pmatrix}0&1&0\\0&0&1\end{pmatrix}. Minimising

J(x)=12(x−xb)TB−1(x−xb)+12(y−Hx)TR−1(y−Hx)J(x) = \tfrac12 (x-x_b)^{\mathsf T}B^{-1}(x-x_b) + \tfrac12 (y-Hx)^{\mathsf T}R^{-1}(y-Hx)

numerically from the background as starting point returned

xa=(1.949042,  1.951431,  1.265990),J(xa)=0.873082,x_a = (1.949042,\; 1.951431,\; 1.265990) , \qquad J(x_a) = 0.873082 ,

whose first component is the analysis of Step 3, to all digits shown; the largest discrepancy between the whole minimiser and xb+K∗dx_b + K_\ast d computed from the gain formula was 1.1×10−151.1\times10^{-15}. The inverse Hessian had diagonal (0.425475, 0.180098, 0.180098)(0.425475,\,0.180098,\,0.180098), the first entry reproducing Step 4 and agreeing with (I−K∗H)B(I-K_\ast H)B to 1.7×10−161.7\times10^{-16}.

Step 6: the consistency check. Independently, 12dTS−1d=12[(1.30)(1.394277)+(0.10)(−0.663960)]=0.873082\tfrac12 d^{\mathsf T}S^{-1}d = \tfrac12\bigl[(1.30)(1.394277)+(0.10)(-0.663960)\bigr] = 0.873082, matching the minimum value above, as claim 4 of the 3D-Var statement requires. Its expectation is 12p=1\tfrac12 p = 1, and the observed 0.8730.873 is unremarkable for a 12χ2(2)\tfrac12\chi^2(2) variable, so the assumed BB and RR are not contradicted by these two innovations.

Application(Where this is done)Original

Numerical weather prediction. Every operational forecast centre runs an analysis of this type every few hours. Optimal interpolation was the standard method from the 1970s until the 1990s, when 3D-Var replaced it, chiefly because the variational form handles observations that are non-local functions of the state — satellite radiances, which are weighted vertical integrals, and radar reflectivities — simply by putting the right HH into JJ, whereas optimal interpolation needs the covariance between the analysis point and each such integral. The 4D-Var now used in several centres is the same cost function with the model's time evolution added as a constraint over an assimilation window, so that observations are compared with the forecast at their own observation times.

Reanalysis. The long gridded records used in climate research are produced by running a fixed forecast model and a fixed assimilation scheme over decades of archived observations. The point of freezing the scheme is that trends in the analysis should then reflect trends in the atmosphere rather than changes in the method, though changes in the observing network still leak in through K∗K_\ast, which depends on which observations exist.

Ocean, land surface and atmospheric composition. The same algebra analyses sea-surface temperature from satellite and buoy data, soil moisture, and ozone fields. In each case BB carries the physics: its correlation length sets how far a single observation is allowed to spread, and anisotropy in BB is how flow-dependent structure is injected into an otherwise static scheme.

Back to filtering. Cycling the analysis - use the forecast model to propagate xax_a forward to the next analysis time, call the result the new background, repeat - is exactly the loop of The Kalman filter, with the one difference that BB is prescribed rather than propagated as Pkf=FkPk−1FkT+QkP_k^{f} = F_kP_{k-1}F_k^{\mathsf T}+Q_k. Ensemble Kalman filters close that gap by estimating BB from the spread of a small ensemble of forecasts, and so sit between the two units: the gain formula of this unit, with a BB obtained from the recursion of the previous one.