Module 8: Relationships and business data · Lesson 8.4 · about 20 min
Time series: trend, seasonality and moving averages
Break a daily or monthly KPI into trend, seasonal pattern and noise; smooth it with a moving average of the right length; compare like with like (week over week, year over year); and avoid the traps of autocorrelation.
Module 8 · about 20 minutes · no new maths. You’ll be able to describe a KPI series in terms of trend, seasonality and noise, smooth it properly, and make fair period-to-period comparisons.
In everyday terms: your heart rate over a day: a slow drift (trend), a daily rhythm (season: low at night, high in the afternoon), and beat-to-beat jitter (noise). Comparing 3 a.m. with 3 p.m. tells you about the rhythm, not about your fitness.
1. Three parts of a series
Most business series are a mix of:
- Trend: the slow, long-run direction (growth, decline).
- Seasonality: a pattern that repeats on a fixed cycle (weekends, months, holidays, hours of the day).
- Noise: everything else, day to day.
Plus occasional events (a promotion, an outage) and level shifts (a price change).
Weekend dots (orange) sit high every week. Set the moving average to 7 and the line rises smoothly with the trend; set it to 5 or 10 and it ripples, because each window holds a different number of weekend days.
2. Smoothing
A moving average of k periods replaces each point with the mean of the last k. Rules:
- Make k one full cycle (7 for daily data with a weekly pattern, 12 for monthly with a yearly pattern).
- A trailing average lags: it reacts to a change about k/2 periods late. A centred one doesn’t lag but needs future data, so it’s for history only.
- Exponential smoothing weights recent values more and reacts faster (next lesson).
3. Fair comparisons
- Week over week, same weekday: this Tuesday vs last Tuesday.
- Year over year: this December vs last December. Watch for moving holidays (Easter, Diwali, Black Friday), and compare the same number of weekends.
- Seasonally adjusted series remove the typical seasonal effect; most official statistics are published this way.
- Calendar effects: months have different numbers of days and weekends; daily averages are fairer than monthly totals.
4. Autocorrelation
Tomorrow is usually like today. That autocorrelation means 30 daily values hold less independent information than 30 random draws, so standard tests (which assume independence) give intervals that are too narrow. For time-based questions, compare whole weeks, use methods built for time series, or, best of all, run an experiment with a control group running at the same time.
- Trend
- The slow long-run direction.
- Seasonality
- A pattern that repeats every week, month or year.
- Moving average of k
- Average of the last k points; with k = the season length, the pattern cancels.
- Year over year
- Compare with the same period last year: the season cancels.
- Physical meaning
- A 7-day average contains exactly one of each weekday, so the weekly rhythm cancels out and only trend and noise remain. Day-to-day changes compare different parts of the rhythm and mostly show the rhythm itself.
“Saturday is up 45 % on Friday: great news.” If every Saturday beats Friday by that much, it is the weekly pattern. Compare with last Saturday, or look at the 7-day average.
Watch it happen, one step at a time:
Maths and principle
Principle: averaging over exactly one cycle removes a fixed seasonal pattern, because each seasonal effect appears once and the effects sum to zero.
Additive model:
Moving average over one cycle of length m: , so it shows the trend from half a cycle ago, with noise shrunk by about .
Multiplicative model fits when the seasonal swing grows with the level (December is +40 % whatever the size of the business); take logs to make it additive.
5. Worked example
Made-up dashboard. A manager sees “Saturday sales +45 % vs Friday!” and “Monday −30 % vs Sunday!”.
- Both are the weekly pattern, not news. Compare with the same weekday last week: Saturday +3 %, Monday +2 %.
- The 7-day average rose from 252 to 260 over the week: about +3 %, matching.
- Year over year (same week last year, same holiday timing): +11 %.
- Report: “Steady growth of about 3 % a week; nothing unusual this week.” Put the 7-day average and year-over-year line on the dashboard instead of day-to-day changes.
6. Practice
- Monthly data with a yearly pattern. Moving average length?
- Why can comparing this Black Friday week with the same calendar week last year mislead?
- A 7-day trailing average turns down 3 days after a price change. When did the real change happen?
Answers
- 12 months.
- Black Friday moves: the same calendar week may include it one year and not the other. Align on the event, not the date.
- Around the day of the price change or just after; a trailing average lags, and by day 3 only 3 of the 7 days in the window reflect the new price.
Try it on your own data: the time series tool splits your own series into trend, seasonal pattern and remainder and shows its autocorrelation; grouped data gives totals and means by weekday or month.
New words: time series, trend, seasonality, moving average, lag, year over year, seasonal adjustment, autocorrelation.
- Series = trend + seasonality + noise.
- Compare like with like: same weekday, same month last year.
- Moving averages over one full season cancel the pattern.
- Day-to-day changes in seasonal data mostly show the season.
Check yourself
Sources
- Hyndman, R. J. and Athanasopoulos, G. (2021), Forecasting: Principles and Practice, 3rd edition, OTexts, Chapters 2-3 https://otexts.com/fpp3/
- NIST/SEMATECH e-Handbook, 6.4 Introduction to Time Series Analysis https://www.itl.nist.gov/div898/handbook/pmc/section4/pmc4.htm
Your ticks stay in this browser. Save them as a file on the course home.
Updated 2026-11-22. Numbers in the examples are made up to show the idea unless a source is given. Simulations run in your browser; nothing you type is sent anywhere.