How does a centred moving average estimate the trend-cycle of a seasonal series?
answer
- the window is not a free parameter
- each season counted exactly once
- even periods land between observations
- half a window missing at each end
- one spike smeared over the whole window
basics
~20 sAverage each point over a window exactly one seasonal period long, so every season appears once and the seasonal effect cancels, leaving the local level. Even periods need a two-step centred average, and the first and last half-window get no trend.
solid answer
~50 sThe window length is the whole trick: make it exactly one seasonal period, so each season is counted once and the seasonal component averages away, leaving the local level. For daily sign-ups with a weekly rhythm, a 7-term average is odd-length, so it is naturally centred on its middle day. For monthly data with a 12-month season a 12-term average falls *between* two months, so you average two consecutive 12-term averages, giving the 2x12 centred moving average with weights 1/24 on the two end months and 1/12 on the ten in between. Two costs follow. First, the estimate needs data on both sides, so you get no trend for the first and last half-window, three days at each end for a centred 7-day average. Second, a plain mean is not robust: a single day that spikes by 700 lifts the trend estimate by 100 on seven consecutive days.
go deeper
Know that the smoothing window should equal one full seasonal period, and that averaging over a whole period is what cancels the seasonal effect and leaves the level.
Be ready to explain why an even period needs a two-step centred average, state the 2x12 weights, and say exactly how many observations at each end have no trend estimate.
Show you plan around the weaknesses: no trend at the recent end where stakeholders look, and a single spike smeared across a whole window and then leaking into the seasonal indices.
Own the reporting policy: whether recent trend values that will revise as data arrives should be published at all, and what the team standard is for smoothing near the boundary.
## The idea A moving average replaces each observation with an average of itself and its nearby neighbours. Doing so suppresses fast movements and keeps slow ones, which is exactly what you want from a trend-cycle estimate. What makes it a *decomposition* step rather than generic smoothing is the choice of window. ## Why the window equals the seasonal period If the window covers exactly one full seasonal period, every season occurs in it exactly once. Because the seasonal component sums to zero over one period by construction, averaging over the window cancels it. Averaging also shrinks the remainder by roughly a factor of the square root of the window length. What survives is the local level: the trend-cycle. Use a window shorter than the period and part of the seasonal pattern leaks into the trend, which then wiggles at the seasonal frequency. Use a much longer window and you flatten genuine turns in the level, so the trend lags real changes and the remainder picks up a slow, systematic pattern. ## Odd versus even periods, and why 2x12 exists With an **odd** period there is no problem. A 7-term average of daily data has three observations on each side of a middle day, so the result is naturally aligned with that day. With an **even** period, a straight 12-term average of monthly data is centred between the sixth and seventh months: it is offset by half a month from every actual observation. The standard fix is to average two consecutive 12-term averages, which recentres the result on an actual month. Written out, the 2x12 centred moving average puts weight 1/24 on the two outermost months and 1/12 on each of the ten inner months, and those twelve weights sum to 1. The same construction gives a 2x4 for quarterly data. It is a small mechanical detail that interviewers like precisely because it separates people who have implemented a decomposition from people who have only read the equation. ## What it costs you **Lost trend at both ends.** The average needs a half-window of data on each side, so for a window of length m you get no trend estimate for the first m/2 and last m/2 observations. A centred 7-day average leaves the first three and last three days without a trend value; a 2x12 monthly average leaves six months bare at each end. This is more than an inconvenience: the missing region is the *recent* end, which is the part every stakeholder wants to talk about. Reporting "the trend flattened last week" from a smoother that cannot see last week is a classic error. Loess-based methods and one-sided smoothers give you an estimate at the boundary, at the cost of it being less stable and revising as new data arrives. **No robustness.** The arithmetic mean gives every point equal weight, including a bad one. A single day on which sign-ups spike by 700 above normal raises a 7-day centred average by 700/7 = 100 for each of the seven windows that contain it. On a plot this looks like a small plateau in the trend lasting a week, centred on the spike, and the distortion then propagates into the estimated seasonal component and the remainder. Robust alternatives down-weight or trim extreme points, or use a running median, so a spike lands in the remainder where it belongs. **No adaptivity.** One fixed window is applied to the entire history. If the series is quiet for two years and then volatile, the same amount of smoothing is applied to both stretches. ## From trend to seasonal indices Once the trend estimate exists, the classical procedure continues: detrend by subtracting the trend (additive) or dividing by it (multiplicative), then average the detrended values for each position in the season across all cycles to get the seasonal index for that position, and normalise the indices so they sum to zero additively or average to one multiplicatively. This averaging step embeds an assumption worth saying out loud: the seasonal shape is treated as identical in every cycle of the history. ## Choosing a window in practice - Daily data with a weekly rhythm: 7. - Daily data with an annual rhythm as well: a 7-term average for the weekly effect, and a much longer one, 365-ish, for the annual level. - Hourly data with a daily rhythm: 24. - Quarterly data: 2x4. Monthly data: 2x12. The rule never changes: match the window to the period you intend to cancel, not to how smooth you want the picture to look. If you find yourself picking a window because the plot looks nicer, you have stopped decomposing and started drawing.
- Why does monthly data need a 2x12 moving average rather than a plain 12-term one?A 12-term average of monthly data is centred between the sixth and seventh months, half a month away from any real observation, so it cannot be lined up with the series. Averaging two consecutive 12-term averages shifts the result back onto an actual month. The resulting weights are 1/24 on the two outer months and 1/12 on the ten inner ones.
- What happens to a centred 7-day moving average when one day has a huge one-off spike?The spike is spread across every window containing it, so the trend estimate is lifted by one seventh of the spike on seven consecutive days. That false plateau then contaminates the detrended values and hence the estimated seasonal indices. A robust smoother, such as a running median or a down-weighted fit, keeps the spike in the remainder instead.
- How would you produce a trend value for the most recent observation despite the end effect?Use a smoother that can fit at the boundary, such as a local regression using only available data on one side, or accept an asymmetric weighting near the ends. Either way the boundary estimate is less stable and will revise as new points arrive, so publish it with that caveat rather than presenting it as settled.
saying these in an interview costs you the question
- Picks the window width by how smooth the plot looks
- Uses a plain 12-term average on monthly data
- Ignores that the trend is undefined near both ends
- Assumes averaging is robust to a single extreme point
- Says a longer window is always a better trend estimate