Moving-Average Smoothing

Inside the classical algorithm sat a quiet workhorse: the moving average. It deserves a page of its own, because it is the simplest and most widely used smoother in all of applied data analysis — the thing your fitness app draws through your jagged daily weight, the thing a trader means by "the 200-day". The idea is almost too plain to state: to see the slow signal under the noise, replace each point with the average of its neighbours. Averaging cancels the fast random jitter (it is as often up as down) while leaving the slow trend nearly untouched.

The m-term moving average centered at time t is

\hat T_t = \frac{1}{m}\sum_{j=-k}^{k} y_{t+j}, \qquad m = 2k+1.

For an odd window m = 2k+1 this is beautifully symmetric: k points on each side and the point itself, all weighted equally. A 3-term average smooths gently; a 25-term average smooths hard.

Why it works: a low-pass filter

A moving average is a low-pass filter — it lets slow (low-frequency) movement through and blocks fast (high-frequency) wiggle. The reason is intuitive: over a short window the trend is nearly constant, so averaging returns it almost unchanged; the noise, being a fresh independent kick at each step, largely cancels because the pluses and minuses average out. If the noise has variance \sigma^2, averaging m independent points cuts the noise variance to \sigma^2/m — a factor-of-m calming. Wider window, quieter output.

This is the same tension you will meet everywhere in statistics; the moving average is the cleanest place to feel it in your hands.

Even windows and the 2×m average

There is a snag when the window length is even — and even windows are exactly what seasonal data forces on you (m = 12 for months, m = 4 for quarters). An even-length average is not centered on an integer time: a 12-term average of months 1–12 sits at time 6.5, not on any real observation. The fix is the 2×m moving average — take a moving average of the moving average, i.e. average two adjacent even-length windows. The net effect is an (m+1)-term weighted average with half weight on the two end points:

\hat T_t = \frac{1}{2m}\Big(\tfrac12 y_{t-k} + y_{t-k+1} + \dots + y_{t+k-1} + \tfrac12 y_{t+k}\Big), \quad k = m/2.

The half-weighted ends re-center the window symmetrically on t. That "2×12" centered average is precisely the trend estimator inside classical decomposition for monthly data.

Weighted moving averages

Equal weights are the crudest choice. A weighted moving average \hat T_t = \sum_j w_j\, y_{t+j} (with \sum_j w_j = 1) can put more emphasis on the centre and taper toward the edges, which smooths noise without blurring turns as much. Famous weight sets — the Spencer 15-point average, the Henderson filters buried inside census seasonal-adjustment software — are just carefully chosen w_j that pass a local cubic trend perfectly while suppressing noise. The equally-weighted average is the special case w_j = 1/m.

Feel the trade-off

The faint line is a fixed, noisy series (a gentle trend-plus-wiggle). The bold line is its centered moving average. Drag the window width m: at m = 1 the smoother is the raw series; widen it and watch the bold line calm down and stiffen, tracking the underlying trend but responding ever more slowly to the bumps.

Somewhere in the middle is the sweet spot: smooth enough to see the trend, sharp enough to trust the turns. There is no universal "right" m — it depends on how fast your real signal moves relative to the noise.

This is a genuine landmine of terminology. The moving average on this page is a smoother: you compute it from data by averaging neighbouring observations to estimate a trend. The moving-average model, MA(q), is something completely different: a generative model in which the series is a weighted average of past unobservable shocks \varepsilon_t, i.e. x_t = \varepsilon_t + \theta_1 \varepsilon_{t-1} + \dots + \theta_q \varepsilon_{t-q}. One is a data-smoothing operation you apply; the other is a stochastic model you fit. They share three words and almost nothing else. Whenever you read "MA" in time series, check which one is meant.

A centered m-term average needs k = (m-1)/2 points on each side, so it simply cannot be computed for the first and last k observations — the window runs off the edge of the data. These end-effects are why a smoothed line often stops short of the latest point, or why software quietly switches to a lopsided one-sided average there (which is noisier and biased). It is a real cost: forecasting cares most about the newest data, exactly where the symmetric smoother is blind. Trailing moving averages (only past data, used by traders) dodge the missing-endpoint problem but pay for it with a built-in lag — they always trail the truth by about k steps.