Tutorials › Stochastic Processes › Moving-Average Filters and Spectral Zeros

Weak Stationarity and Spectral Representation · Tutorial 908 of 994

Moving-Average Filters and Spectral Zeros

Compute a finite filter’s frequency response and output spectrum, then use its unit-circle roots to identify frequencies that the filter suppresses.

Advanced 11 min read

What You'll Learn

  • Write the transfer polynomial and frequency response for a finite moving-average filter.
  • Derive the output spectrum from the input spectrum and filter coefficients.
  • Locate spectral zeros by finding roots of the filter polynomial on the unit circle.
  • Interpret a zero as frequency suppression, including the effect of root multiplicity.
  • Verify spectral calculations by computing output covariances and variances directly.

Finite Filters and Frequency Response

A finite moving-average filter forms each output by combining a fixed number of present and past input values. Its coefficients determine which oscillations pass through strongly and which are attenuated or eliminated. The transfer function packages this frequency-dependent effect into a single expression; its zeros identify frequencies at which the filter removes an input component entirely.

Work on a probability space \((\Omega,\mathcal{F},\mathbb{P})\). Let \((X_n)_{n\in\mathbb{Z}}\) be a real-valued, weakly stationary process with state space \(\mathbb{R}\), mean \(\mu_X\), and autocovariance \(\gamma_X(h)=\operatorname{Cov}(X_{n+h},X_n)\). Time is discrete and indexed by all integers so that past inputs are defined at every \(n\). Use the Fourier convention \(f_X(\omega)=\frac{1}{2\pi}\sum_{h\in\mathbb{Z}}\gamma_X(h)e^{-ih\omega}\) when the covariance sequence has a spectral density. Frequencies are taken in \([-\pi,\pi]\), with the endpoints representing the same frequency.

Definition: For real coefficients \(a_0,\ldots,a_q\), a finite moving-average filter has output \(Y_n=\sum_{j=0}^{q}a_jX_{n-j}\). Its transfer polynomial is \(A(z)=\sum_{j=0}^{q}a_jz^j\), and its frequency response is \(H(\omega)=A(e^{-i\omega})=\sum_{j=0}^{q}a_je^{-ij\omega}\). A frequency \(\omega_0\) is a spectral zero of the filter if \(H(\omega_0)=0\), equivalently if \(A(e^{-i\omega_0})=0\).

The term “moving average” here describes a finite linear filter, not an assumption that the inputs are independent. If the input has a spectral density, the filter multiplies that density by the squared magnitude of its frequency response.

Theorem (Finite-filter spectral formula): Let \((X_n)_{n\in\mathbb{Z}}\) be weakly stationary with a spectral density \(f_X\), and let \(Y_n=\sum_{j=0}^{q}a_jX_{n-j}\) for fixed real coefficients. Then \((Y_n)\) is weakly stationary, its mean is \(\mu_Y=(\sum_{j=0}^{q}a_j)\mu_X\), and its spectral density is \(f_Y(\omega)=|H(\omega)|^2f_X(\omega)\), with equality understood almost everywhere.

Proof. Since the sum defining \(Y_n\) is finite, its mean is \(\mathbb{E}[Y_n]=\sum_{j=0}^{q}a_j\mathbb{E}[X_{n-j}]=(\sum_{j=0}^{q}a_j)\mu_X\), which does not depend on \(n\). Its covariance at lag \(h\) is also independent of \(n\), and direct expansion gives \(\gamma_Y(h)=\sum_{j=0}^{q}\sum_{k=0}^{q}a_ja_k\gamma_X(h-j+k)\). Taking the Fourier transform, each shifted covariance sequence contributes the factor \(e^{-i(j-k)\omega}\): with \(r=h-j+k\), we have \(h=r+j-k\), so \(e^{-ih\omega}=e^{-ir\omega}e^{-ij\omega}e^{ik\omega}\). Therefore \(f_Y(\omega)=\sum_{j,k}a_ja_ke^{-ij\omega}e^{ik\omega}f_X(\omega)=H(\omega)\overline{H(\omega)}f_X(\omega)=|H(\omega)|^2f_X(\omega)\). The finite sums introduce no convergence issue, and the formula proves the claimed spectral density relation. \(\square\)

For white noise \((\varepsilon_n)\) with mean zero and variance \(\sigma^2\), the covariance is \(\gamma_\varepsilon(0)=\sigma^2\) and \(\gamma_\varepsilon(h)=0\) for \(h\ne0\). Its spectral density is the constant \(\sigma^2/(2\pi)\). Thus a finite moving average of white noise has \(f_Y(\omega)=\frac{\sigma^2}{2\pi}|A(e^{-i\omega})|^2\). The filter’s zeros can be found algebraically: solve \(A(z)=0\), then keep precisely the roots \(z\) with \(|z|=1\). Each such root corresponds to a frequency satisfying \(z=e^{-i\omega}\).

Worked Examples: Zeros and Suppression

Worked Example: First Differences Remove the Zero Frequency

Let \(Y_n=\varepsilon_n-\varepsilon_{n-1}\), where \((\varepsilon_n)_{n\in\mathbb{Z}}\) is mean-zero white noise with variance \(\sigma^2>0\). Find the transfer function, spectrum, and spectral zero.

The coefficients are \(a_0=1\) and \(a_1=-1\), so \(A(z)=1-z\) and \(H(\omega)=1-e^{-i\omega}\). The filter polynomial has root \(z=1\), which is on the unit circle and equals \(e^{-i0}\). Hence the zero is at \(\omega=0\).

Using \(|1-e^{-i\omega}|^2=(1-e^{-i\omega})(1-e^{i\omega})=2-2\cos\omega=4\sin^2(\omega/2)\), the output spectrum is

$$ f_Y(\omega)=\frac{\sigma^2}{2\pi}(2-2\cos\omega) =\frac{2\sigma^2}{\pi}\sin^2(\omega/2). $$

Check by covariance. The coefficient squares sum to \(1^2+(-1)^2=2\), so \(\gamma_Y(0)=2\sigma^2\). At lag \(1\), the only overlapping input is \(\varepsilon_n\), with coefficient \(-1\) in \(Y_{n+1}\) and coefficient \(1\) in \(Y_n\), giving \(\gamma_Y(1)=-\sigma^2\). All covariances at lags with absolute value greater than \(1\) are zero. Fourier inversion therefore gives \(f_Y(\omega)=\frac{1}{2\pi}(2\sigma^2-2\sigma^2\cos\omega)\), agreeing with the transfer-function calculation. At \(\omega=0\), the spectrum is zero; at \(\omega=\pi\), it is \(\frac{2\sigma^2}{\pi}\), its maximum.

Worked Example: A Three-Point Average Suppresses Two Frequencies

Let \(Y_n=(\varepsilon_n+\varepsilon_{n-1}+\varepsilon_{n-2})/3\) for mean-zero white noise with variance \(\sigma^2>0\). Find the zeros and the output spectrum, and verify the output variance.

Here \(A(z)=(1+z+z^2)/3\). The equation \(1+z+z^2=0\) has roots \(e^{2\pi i/3}\) and \(e^{-2\pi i/3}\): indeed, each has real part \(\cos(2\pi/3)=-1/2\) and imaginary part \(\pm\sin(2\pi/3)=\pm\sqrt{3}/2\), and substitution gives zero. Both roots lie on the unit circle. Since \(e^{-i\omega}\) equals these roots at \(\omega=-2\pi/3\) and \(\omega=2\pi/3\), the filter zeros are those two frequencies.

Factoring out \(e^{-i\omega}\) from \(1+e^{-i\omega}+e^{-2i\omega}\) gives \(e^{-i\omega}(1+2\cos\omega)\). The leading factor has magnitude \(1\), so

$$ f_Y(\omega)=\frac{\sigma^2}{2\pi}\frac{(1+2\cos\omega)^2}{9}. $$

For a direct variance check, the three coefficients are each \(1/3\). The input white-noise values at distinct times have zero covariance, so expanding the variance gives \(\operatorname{Var}(Y_n)=\sigma^2[(1/3)^2+(1/3)^2+(1/3)^2]=\sigma^2/3\). This uses uncorrelatedness, not independence. Equivalently, the spectrum’s covariance expansion has \(\gamma_Y(0)=\sigma^2/3\), \(\gamma_Y(1)=\gamma_Y(-1)=2\sigma^2/9\), and \(\gamma_Y(2)=\gamma_Y(-2)=\sigma^2/9\); integrating the spectrum over \([-\pi,\pi]\) returns \(\gamma_Y(0)=\sigma^2/3\).

Interpretation: At \(\omega=\pm2\pi/3\), the three successive oscillatory contributions cancel exactly. The filter suppresses those components of the input, while frequencies near the zeros are attenuated but not necessarily eliminated.

Worked Example: A Double Zero at the Nyquist Frequency

Let \(Y_n=(\varepsilon_n+2\varepsilon_{n-1}+\varepsilon_{n-2})/4\), with mean-zero white noise of variance \(\sigma^2>0\). Determine the zero and calculate the spectrum and variance.

The transfer polynomial is \(A(z)=(1+2z+z^2)/4=(1+z)^2/4\). Its only root is \(z=-1\), with multiplicity two. Because \(-1=e^{-i\pi}=e^{i\pi}\), this is the frequency \(\pi\), equivalently \(-\pi\) under the chosen frequency convention. Also, \(H(\omega)=e^{-i\omega}(1+\cos\omega)/2\) up to the equivalent expression \(H(\omega)=e^{-i\omega}(1+\cos\omega)/2\); its squared magnitude is \(\cos^4(\omega/2)\), as follows directly from \(|1+e^{-i\omega}|^2=4\cos^2(\omega/2)\).

Consequently,

$$ f_Y(\omega)=\frac{\sigma^2}{2\pi}\cos^4(\omega/2). $$

Check by covariance. The coefficients are \(1/4,1/2,1/4\). Their squared sum gives \(\gamma_Y(0)=\sigma^2(1/16+1/4+1/16)=3\sigma^2/8\). The lag-one covariance is \(\sigma^2[(1/2)(1/4)+(1/4)(1/2)]=\sigma^2/4\), and the lag-two covariance is \(\sigma^2(1/4)(1/4)=\sigma^2/16\). Thus Fourier inversion gives \(f_Y(\omega)=\frac{\sigma^2}{2\pi}(3/8+(1/2)\cos\omega+(1/8)\cos2\omega)\). The identity \(\cos^4(\omega/2)=(3+4\cos\omega+\cos2\omega)/8\) matches the transfer-function result. The double root produces a more rapid fall to zero near \(\pi\) than a simple root.

What a Spectral Zero Means

The filter’s frequency response describes its action on an oscillation. At frequency \(\omega\), the output amplitude is multiplied by \(H(\omega)\), and the output power is multiplied by \(|H(\omega)|^2\). A zero therefore removes that frequency from the filtered signal. More generally, the finite-filter formula says that \(f_Y(\omega)=|H(\omega)|^2f_X(\omega)\) almost everywhere. If the input spectrum has positive density near a zero, the filter creates a notch there; if the input already has no spectral power there, the output cannot reveal whether the filter would have suppressed it.

Root multiplicity controls the local shape of the notch. Suppose \(A(z)=(z-z_0)^mC(z)\), where \(|z_0|=1\), \(C(z_0)\ne0\), and \(m\ge1\). Write \(z_0=e^{-i\omega_0}\). For small real \(\delta\), the differentiability of \(e^{-i\omega}\) gives \(e^{-i(\omega_0+\delta)}-z_0=-iz_0\delta+o(\delta)\). Hence \(|A(e^{-i(\omega_0+\delta)})|^2\) is proportional to \(|\delta|^{2m}\) to leading order. If \(f_X\) is continuous and strictly positive at \(\omega_0\), the output density has the same order of vanishing. In particular, a simple root produces quadratic power suppression, while a double root produces fourth-order power suppression.

This conclusion follows from the factorization: the \(m\) repeated factors each contribute a magnitude of order \(|\delta|\), and squaring the total amplitude gives order \(|\delta|^{2m}\). The condition \(C(z_0)\ne0\) ensures the remaining factor does not introduce another zero at that point; if it did, the multiplicity would be larger.

Result (Unit-circle zero criterion): A finite filter has a zero at frequency \(\omega_0\) if and only if \(e^{-i\omega_0}\) is a root of \(A(z)\). When the input has positive spectral density at that frequency, the output density is zero there wherever the spectral-density equality is evaluated. Roots away from the unit circle do not produce exact zeros at real frequencies.

Proof. By definition \(H(\omega_0)=A(e^{-i\omega_0})\). Thus \(H(\omega_0)=0\) exactly when \(e^{-i\omega_0}\) is a root of \(A\), proving both directions of the criterion. The spectral formula gives \(f_Y(\omega_0)=|H(\omega_0)|^2f_X(\omega_0)=0\) when the density values are defined there and \(H(\omega_0)=0\). Conversely, if \(f_X(\omega_0)>0\) and \(f_Y(\omega_0)=0\), the same formula forces \(|H(\omega_0)|^2=0\), and therefore \(H(\omega_0)=0\). For densities defined only up to changes on sets of measure zero, these pointwise statements apply to a chosen continuous version when one exists; the almost-everywhere spectral identity itself is the general statement. \(\square\)

Common Mistakes and Practical Checks

A frequent error is to confuse white noise with independent observations. White noise, as used here, means zero mean, constant variance, and zero covariance at nonzero lags; it does not by itself assert independence. For the three-point average, one might incorrectly assume independence from the white-noise assumption. Even if the three terms were independent, the variance would be \(3\sigma^2/9=\sigma^2/3\); here, pairwise uncorrelatedness alone gives that same result. The correct computation expands the variance and uses the vanishing cross-covariances, rather than asserting independence.

Another common mistake is to locate roots of \(A(z)\) without checking whether they lie on the unit circle. Only a unit-circle root corresponds to a real frequency, since \(e^{-i\omega}\) always has modulus \(1\). Also distinguish a transfer-function zero from a zero in the input spectrum: the output spectrum is the product of both effects. For a real-coefficient filter, nonreal roots occur in conjugate pairs, so their corresponding frequencies occur as a pair modulo \(2\pi\); a root at \(-1\) is the boundary frequency represented by both \(\pi\) and \(-\pi\).

A reliable calculation follows this order: write the coefficients and polynomial, solve for roots, retain unit-circle roots, evaluate \(|H(\omega)|^2\), and multiply by the input spectrum. Then check at least one feature independently, such as the output variance from the coefficients or the covariance sequence. These checks catch missing factors of \(2\pi\), sign errors in the exponential convention, and incorrect variance assumptions.

Check Your Understanding

Use the definitions and calculations above to answer each question. When a spectrum is computed, verify its normalization against the output variance.

  1. For the filter \(Y_n=\varepsilon_n+\varepsilon_{n-1}\), find \(A(z)\), its unit-circle zero, and the frequency where white-noise power is removed.
  2. For \(Y_n=(\varepsilon_n+\varepsilon_{n-1})/2\), calculate the output variance directly from the coefficients and identify the spectral zero.
  3. Explain why a root of \(A(z)\) with modulus different from \(1\) does not correspond to a real frequency zero.
  4. If \(A(z)\) has a root of multiplicity three on the unit circle and the input density is continuous and positive there, what is the order of vanishing of the output density?
  5. For the three-point average, explain why the variance calculation requires uncorrelatedness but not independence.