How many units will we sell next month? How much cash will we need next quarter? Almost every business plan starts with a forecast, and the simplest reliable forecasts come from smoothing past data. In this article we work through simple moving averages, weighted moving averages and exponential smoothing using one small sales dataset, and then measure which method forecasts best.
Why Smooth the Data?
Monthly sales jump around for many reasons: a rainy week, a competitor's promotion, a late delivery. These random ups and downs are called noise. The underlying pattern, called the level (and possibly a trend or seasonal pattern), is what we want to project forward. Smoothing methods average out the noise so the level becomes visible.
The two families covered here are best suited to series without strong trend or seasonality. We will see what happens when that assumption is stretched.
The Dataset
A shop in Faisalabad recorded the following monthly sales of a product (units):
| Month | Sales \( A_t \) |
|---|---|
| January | 120 |
| February | 132 |
| March | 126 |
| April | 140 |
| May | 150 |
| June | 144 |
We want to forecast July.
Simple Moving Average
A \( k \)-period moving average forecasts the next period as the average of the last \( k \) actual values:
$$ F_{t+1} = \frac{A_t + A_{t-1} + \cdots + A_{t-k+1}}{k} $$
A larger \( k \) gives a smoother forecast that reacts slowly; a smaller \( k \) reacts quickly but follows the noise.
Worked Example 1: Three-Month Moving Average
Step 1: Forecast for July.
$$ F_{\text{Jul}} = \frac{140 + 150 + 144}{3} = \frac{434}{3} \approx 144.67 \text{ units} $$
Step 2: Test the method on past months. To judge accuracy, produce the forecasts we would have made:
$$ F_{\text{Apr}} = \frac{120 + 132 + 126}{3} = 126.00 $$
$$ F_{\text{May}} = \frac{132 + 126 + 140}{3} = \frac{398}{3} \approx 132.67 $$
$$ F_{\text{Jun}} = \frac{126 + 140 + 150}{3} = \frac{416}{3} \approx 138.67 $$
Step 3: Compute errors \( e_t = A_t - F_t \).
- April: \( 140 - 126.00 = 14.00 \)
- May: \( 150 - 132.67 = 17.33 \)
- June: \( 144 - 138.67 = 5.33 \)
Step 4: Mean absolute deviation (MAD).
$$ \text{MAD} = \frac{14.00 + 17.33 + 5.33}{3} = \frac{36.67}{3} \approx 12.22 \text{ units} $$
Step 5: Mean absolute percentage error (MAPE).
$$ \text{MAPE} = \frac{1}{3}\left(\frac{14.00}{140} + \frac{17.33}{150} + \frac{5.33}{144}\right) \times 100\% \approx \frac{10.00 + 11.56 + 3.70}{3}\% \approx 8.42\% $$
All three errors are positive: the forecast was too low every month. That is a warning sign of lag. Sales are rising, and a moving average always trails behind a trend because it gives old data the same weight as new.
Weighted Moving Average
To react faster, give recent months more weight. With weights 3, 2, 1 (most recent first), which sum to 6:
$$ F_{\text{Jul}} = \frac{3(144) + 2(150) + 1(140)}{6} = \frac{432 + 300 + 140}{6} = \frac{872}{6} \approx 145.33 \text{ units} $$
The weighted forecast sits a little higher than the simple average because it leans on the strong May and June figures. Choosing weights is a judgement call; managers often test several sets and keep the one with the lowest MAD.
Exponential Smoothing
Exponential smoothing uses all past data but with weights that shrink geometrically. Its updating rule is elegant:
$$ F_{t+1} = \alpha A_t + (1 - \alpha) F_t, \qquad 0 < \alpha < 1 $$
In words: new forecast = old forecast + \( \alpha \) × (latest error), because the rule can be rewritten as \( F_{t+1} = F_t + \alpha(A_t - F_t) \). The smoothing constant \( \alpha \) controls responsiveness: \( \alpha \) near 1 chases the latest value, \( \alpha \) near 0 barely moves.
Expanding the recursion shows why it is called "exponential": the weight on \( A_{t-j} \) is \( \alpha(1-\alpha)^j \), decreasing by the factor \( (1-\alpha) \) each step back in time.
Worked Example 2: Smoothing with \( \alpha = 0.3 \)
We need a starting forecast. A common choice is to set the February forecast equal to January's actual sales, \( F_{\text{Feb}} = 120 \).
Step-by-step updates:
$$ F_{\text{Mar}} = 0.3(132) + 0.7(120) = 39.6 + 84 = 123.60 $$
$$ F_{\text{Apr}} = 0.3(126) + 0.7(123.60) = 37.8 + 86.52 = 124.32 $$
$$ F_{\text{May}} = 0.3(140) + 0.7(124.32) = 42 + 87.024 = 129.02 $$
$$ F_{\text{Jun}} = 0.3(150) + 0.7(129.024) = 45 + 90.317 = 135.32 $$
$$ F_{\text{Jul}} = 0.3(144) + 0.7(135.317) = 43.2 + 94.722 = 137.92 $$
Errors (February to June): 12.00, 2.40, 15.68, 20.98, 8.68. Their MAD is
$$ \text{MAD} = \frac{12.00 + 2.40 + 15.68 + 20.98 + 8.68}{5} = \frac{59.74}{5} \approx 11.95 \text{ units}. $$
Trying \( \alpha = 0.5 \). Repeating the steps gives forecasts of 120, 126, 126, 133, 141.5 for February to June, errors of 12, 0, 14, 17, 2.5, and a MAD of 9.1 units. The July forecast becomes 142.75.
Interpretation. The larger \( \alpha \) wins here because the series is drifting upward, and a responsive forecast keeps closer to a moving target. On a flat, noisy series the opposite is often true. In practice, analysts choose \( \alpha \) by minimising MAD or mean squared error over historical data, which spreadsheets and software do automatically.
Sanity check: every July forecast we produced (137.9 to 145.3) lies within the range of recent sales (140 to 150) or just below it, which is exactly what smoothing methods should produce for a gently rising series.
When Simple Smoothing Is Not Enough
Our errors were mostly positive, which shows the methods lag a trend. Two standard extensions fix this:
- Holt's linear method adds a second smoothed equation for the trend, so the forecast moves upward each period.
- Holt–Winters method adds a third equation for seasonality, useful for products with Ramadan, Eid or winter peaks.
For data with clear causal drivers, such as price or advertising, regression models are another option.
Software
Excel offers moving averages through its Data Analysis ToolPak and exponential smoothing through the FORECAST.ETS function. In R, the forecast package fits exponential smoothing models with ets(); in Python, statsmodels provides ExponentialSmoothing.
Did You Know?
- Exponential smoothing was developed in the 1950s, notably by Robert G. Brown for US Navy inventory control, with extensions by Charles Holt and Peter Winters.
- A simple moving average of \( k \) periods and exponential smoothing with \( \alpha = 2/(k+1) \) have the same average age of data, a handy rule for choosing \( \alpha \).
- Despite their simplicity, smoothing methods have performed strongly in large international forecasting competitions against far more complex models.
Key Takeaways
- Moving averages smooth noise by averaging the last \( k \) observations; larger \( k \) means smoother but slower.
- Weighted averages and exponential smoothing put more weight on recent data.
- Exponential smoothing updates with \( F_{t+1} = F_t + \alpha(A_t - F_t) \).
- Measure accuracy with MAD and MAPE, and watch for errors that are consistently one sign (bias).
- Use Holt or Holt–Winters methods when the data show trend or seasonality.
Need a forecasting assignment solved, or help choosing and justifying a smoothing constant? Amathify's subject experts and PhD scholars offer step-by-step solutions via WhatsApp or the Ask a Question form.
Stuck on a problem or assignment?
Our experts and PhD scholars solve maths, physics and chemistry — step by step.