Smooth a time series with a simple, weighted or exponential moving average of any window length, and see the trend drawn over the raw data.
SMA = (xₜ + xₜ₋₁ + … + xₜ₋ₖ₊₁) ÷ k
A moving average replaces each point in a time series with the average of a window of recent points, smoothing out short-term ups and downs so the underlying trend is easier to see. As each new value arrives, the window slides forward.
A simple moving average weights every point in the window equally. A weighted moving average gives more weight to recent points. An exponential moving average gives every past point some weight, shrinking geometrically with age, so it reacts quickly while still remembering the past.
The window length sets the trade-off. Longer windows smooth more but lag further behind turning points; shorter windows follow the data closely but leave more noise. A window matching a seasonal cycle, such as 7 days or 12 months, removes that cycle entirely.
As given in the NIST/SEMATECH e-Handbook, sections 6.4.2.1 and 6.4.3.1, and Hyndman & Athanasopoulos, Forecasting: Principles and Practice. See Sources.
The EMA here starts from the simple average of the first k values, the usual convention in finance software.
The raw figures bounce by up to £120 from week to week, which hides the steady climb. The smoothed line shows takings rising about 37% over the period.
The café data with a 4-week window, weeks 4 to 12.
| Week | Sales | SMA | WMA | EMA |
|---|---|---|---|---|
| 4 | 510 | 443.8 | 454 | 443.8 |
| 5 | 480 | 458.8 | 468.5 | 458.3 |
| 6 | 530 | 477.5 | 497 | 486.9 |
| 7 | 495 | 503.8 | 504 | 490.2 |
| 8 | 560 | 516.3 | 526.5 | 518.1 |
| 9 | 610 | 548.8 | 564 | 554.9 |
| 10 | 575 | 560 | 574.5 | 562.9 |
| 11 | 640 | 596.3 | 606.5 | 593.8 |
| 12 | 620 | 611.3 | 616 | 604.3 |
Simple for a clear, easy-to-explain trend; exponential when recent changes matter more, as in finance; weighted as a middle ground.
A k-point average needs k values, so the first k − 1 points have no average yet.
Match a natural cycle if there is one (7 days, 12 months); otherwise try a few and pick the shortest that shows the trend clearly.
The smoothing factor, 2 ÷ (k + 1). A 4-period EMA uses α = 0.4, giving the newest value 40% of the weight.
One where the window sits around each point rather than behind it. It doesn’t lag, but can’t be calculated for the latest points.
Never completely, but the weight falls geometrically: with α = 0.4, a value 10 periods old carries under 0.3% of the weight.
Convention: they show medium- and long-term trends, and their crossings are watched as signals.
Fill or remove gaps first. This page treats the values as evenly spaced.
Related Tools
Effect size measure.
Information entropy.
Species diversity.
Categorical variability.
Intraclass correlation.
Percentage change.