Sign in to save

Bookmark this page so you can find it later.

Sign in to save

Bookmark this page so you can find it later.

Moving averages are a simple way to smooth noisy data so that the main trend becomes easier to see. They are widely used in science, economics, weather, sports analytics, and engineering whenever measurements fluctuate from one time point to the next. Instead of reacting to every spike or dip, a moving average summarizes a small window of nearby values.

This helps separate short-term noise from longer-term behavior.

A simple moving average gives equal weight to each value in the window, while a weighted moving average gives some values more influence than others. As the window slides along the time series, it creates a new smoothed line that can be plotted on top of the original data. Larger windows smooth more strongly but also respond more slowly to real changes.

This delay is called lag, and it is one of the main tradeoffs when choosing a moving average.

Key Facts

  • Simple moving average: SMA = (x1 + x2 + ... + xn) / n
  • For a 3-point moving average at time t: MA_t = (x_{t-1} + x_t + x_{t+1}) / 3 when using a centered window
  • Trailing moving average: MA_t = (x_t + x_{t-1} + ... + x_{t-n+1}) / n
  • Weighted moving average: WMA = (w1x1 + w2x2 + ... + wnxn) / (w1 + w2 + ... + wn)
  • Increasing the window size usually decreases noise but increases lag.
  • Moving averages are best for revealing trends, not for preserving exact peaks, sudden jumps, or individual data values.

Vocabulary

Time series
A time series is a set of data values recorded in time order, such as daily temperature or monthly sales.
Moving average
A moving average is a sequence of averages calculated from sliding windows of data points.
Window size
Window size is the number of data points included in each average.
Weighted average
A weighted average multiplies each value by a chosen weight before averaging, so some values count more than others.
Lag
Lag is the delay between a change in the original data and the response of the smoothed moving average line.

Common Mistakes to Avoid

  • Using a window that is too large, which can hide important changes and make the trend appear later than it really happened.
  • Treating the moving average as the original data, which is wrong because smoothing changes the values and can remove peaks and dips.
  • Forgetting to divide by the sum of weights in a weighted moving average, which gives a result with the wrong scale.
  • Comparing moving averages with different window sizes as if they were identical, which is misleading because larger windows smooth more and usually lag more.

Practice Questions

  1. 1 The five daily values are 10, 14, 13, 17, and 21. Calculate the 3-day trailing moving average for day 3, day 4, and day 5.
  2. 2 A weighted moving average uses weights 1, 2, and 3 on the most recent three values, with the largest weight on the newest value. For values 20, 22, and 28 in time order, calculate the weighted moving average.
  3. 3 A time series suddenly rises from about 50 to about 80 and stays there. Explain why a 10-point moving average will show the rise later and more gradually than a 3-point moving average.