Welcome to this Forecasting Series. In this video, we’ll be calculating Moving
Averages. And we’ll also be computing Error Measures.
The error measures we’ll be calculating are
The Mean Absolute Deviation The Mean Squared Error
and the Mean Absolute Percent Error
We’ll be using this historical sales data here, collected over a period of 7 weeks.
We will be calculating 3 week moving averages and also compute a moving average forecast
for week 8.
We start by calculating the moving average
for the 4th week. That is, we average the sales values for the
first 3 weeks to produce a moving average forecast for week 4.
Thus, the moving average forecast for week 4 is (39+44+40) divided by 3 which gives 41.
Next we average weeks 2, 3, and 4 sales to obtain the moving average forecast for week
5. That is, (44+40+45) divided by 3 which gives
43. For week 6, the moving average is from weeks
3, 4, and 5. That is (40+45+38) divided by 3 which gives 41.
For week 7, it is (45+38+43) divided by 3 which gives 42.
And finally, the moving average forecast for week 8 is (38+43+39) divided by 3 which gives
40.
Next we calculate the forecast errors. Forecast Errors are calculated as Actual Values
minus corresponding Forecast Values. Since weeks 1 to 3 have no forecast values,
we begin calculating errors in week 4. Thus, week 4 error is 45 - 41 which equals
4. Week 5 error is 38 - 43 which equals -5.
Week 6 error is 43 - 41 which equals 2. And week 7 error is 39 - 42 which equals -3.
Next we calculate the Mean Absolute Deviation or Error.
Note that Error and Deviation are used interchangeably. The two bars around Error here denote absolute
values. That is, return a positive value whether the
original value is positive or negative. So the absolute value of 4 is 4.
The absolute value of negative 5 is 5. For 2, it is 2.
And for negative 3, it is 3. To find the mean absolute deviation (MAD or
MAE), we simply average these absolute errors. First we sum up the absolute errors, and then
divide the total by 4 (since there are 4 errors). The total is 14, and the MAD is 14 divided
by 4 which gives 3.5.
Next we calculate the Mean Squared Error. In this case, we first square the errors and
then average them. Since the square of negative values is always
positive, we can simply square the absolute errors.
Hence, 4 squared is 16, 5 squared is 25, 2 squared is 4, and 3 squared is 9.
The total of these squared errors is 54 and the mean squared error is 54 divided by 4
which gives 13.5.
Finally, let us calculate the Mean Absolute Percent Error.
The absolute percent error is a measure of the error as a percentage of actual values.
To obtain the absolute percent error, we simply divide the absolute errors by the actual Sales
values and multiply by 100%. For week 4, the absolute percent error is
calculated as 4 divided by 45 times 100%, and that gives 8.89%.
And for week 5, 5 divided by 38 times 100%, which gives 13.16%.
For week 6, 2 divided by 43 which gives 4.65% And finally for week 7, it is 3 divided by
39 which gives 7.69%. The sum of these absolute errors is 34.39%,
and on dividing it by 4, we obtain the mean absolute percent error of 8.60%.
And that pretty much how to calculate moving averages and forecast error measures.
Please leave a comment or question below and have a great day.
Thank you!