Forecasting: Weighted Moving Averages, MAD


Welcome to this Forecasting tutorial on Weighted
Moving Averages. We will be calculating Weighted Moving Averages.
We will also be comparing error measures using the Mean Absolute Deviation, MAD. We will be using these times series data from
7 weeks of sales. And we want to forecast sales using 4-week
weighted moving averages with weights 0.4, 0.3, 0.2, and 0.1.
In practice, the weighted moving average is usually employed when there is a need to place
more importance on some periods over others. In most cases, we place more importance on
more recent data. Therefore in this exercise, the 0.4 weight
will be placed on the most recent value, the 0.3 on the next most recent, and so on.
Let’s now calculate 4-week weighted moving averages using the given weights .4, .3, .2,
and .1. Since we’re computing 4-week averages, we
start by using data from the first 4 weeks to compute the moving average forecast for
week 5. So F5 (that is, forecast for week 5) equals
0.4 times 45 (notice that 45 is the most recent value)
+ .3 times 40 (the next most recent value) + .2 times 44 + .1 times 39 which gives 42.7.
For week 6, the weighted moving average is F6 which equals 0.4(38) + 0.3(45) + 0.2(40) + 0.1(44) which gives 41.1. For week 7, the weighted moving average is
0.4(43) + 0.3(38) + 0.2(45) + 0.1(40) which gives 41.6.
And the forecast for week 8 is 0.4(39) + 0.3(43) + 0.2(38) + 0.1(45) which
gives 40.6. Next we calculate the Mean Absolute Deviation
for this model. First we calculate the absolute errors. That
is, the positive difference between the actual and forecast values and then average them.
There are no errors for weeks 1 to 4 because there are no forecasts.
For week 5, the absolute error is 4.7. For week 6, it is is 1.9.
For week 7, it is 2.6. The mean absolute deviation MAD is the average
of these errors which gives 3.07. Now, note that in this first example, the
weights .4, .3, .2, and .1 added up to 1. Let’s look at the next example where the
weights do not add up to 1. Forecast sales using 2-week weighted moving
averages with weights 3 and 2. In this example we are calculating 2-week
moving averages where the weights 3 and 2 add up to 5, and not to 1.
So in calculating the weighted moving averages, we multiply the sales values by the weights
as we did before, but in this case, we also divide by the total weight which is 5.
And so the forecast for week 3, F3 is 3(44) + 2(39) divided by 5 which gives 42.
For week 4, it is 3(40) + 2(44) divided by 5 and that gives 41.6.
For week 5, it is 43, It is 40.8 for week 6,
And for week 7 it is 41 And finally for week 8, it is 40.6
Next we calculate the mean absolute deviation. The absolute forecast error for week 3 is
the absolute value of 40 – 42 which is 2. For week 4 it is 3.4
For week 5 it is 5 For week 6 it is 2.2
And for week 7 it is 2. On averaging these 5 values, we obtain a mean
absolute deviation value of 2.92. Now let’s compare the error measures. The MAD was 3.07 using the 4-week moving average
method with weights .4, .3, .2, and .1. And the MAD was 2.92 using the 2-week weighted
moving average with weights 3 and 2. Since the MAD is an error measure, smaller
MADs produce better smoothing of the data. Therefore, using MAD, the 2-week weighted
average method produced a better forecast. Please leave your question or comment below.
Thanks for watching.

73 thoughts on “Forecasting: Weighted Moving Averages, MAD

  1. If there three weights in question but two of them are given.
    How can I calculate the third weight, since it wasn't given. Thanks

  2. kindly solve this Ques ..it's taken from one of the prestigious competitive exam of India..so the Ques Is- given the numbers 2,6,1,5,3,7,2. if the weights used are 1,4,1 .then weighted moving average of order 3 are given by?.

  3. Man,
    during 3:42, I think that something went wrong. So, for week 5 we should have to calculate (3*45+2*40)/5. 2*40 not 44. Because as seen all other calculations we have done it the first 2 CONSEQUENCE numbers from back to front.

  4. if i increase number of weeks then error will decrease or increase. if error is increase as shown in ur example that 2wma give better smoothing than 4 wma then it means as number of periods increases the smoothing error get increased.

  5. so finally there are 2 types of method if we got value 1 by calculating all given weight value so we have to have solve from 1st method if we are getting another value like 5 or 7 or 10 by calcuting so we have to do by the second method

  6. I don't know who you are, I don't know what you want. If you want ransom, I can tell you I don't have money. But what I do have are a very particular skills I'm working on. Skills I am acquiring taking this QMB course. Skills that make me not a nightmare for people like you. Thank you for your videos. You have saved my ass numerous times.

  7. Can we using the method for seasonal data where the irregularity can be extreme? For example, can we know that next week the sales would be 60, which is very different than the rest of your data?

  8. Hello.. The video is great explained very clearly
    But I had a doubt, when "we assume the weights of different values the sum of their weights should be equal to 1", Here It is satisfied for 4week but not in case of 2week??

  9. Hello Joshua,I would like to thank you for wonderful explanation.i have a question will the smaller value of m will give good forecast if so then how.

  10. Well Explained, if i have the Data and i should put the weight values how i can calculate them !
    i just have Data for sales last year and want to use this method it's applicable and how !
    thank you very much for your support

  11. Thanks for this simple and straightforward explanation.
    I have a question on when do we use MSE vs MAE for error calculation

  12. Given the following data, use exponential smoothing with α = 0.2 to develop a demand forecast for period 7. (Forecast for Period 1=10).

  13. # In Python
    #Weighted Moving Average 2WMA
    sales = [39, 44, 40, 45, 38, 43, 39]
    calc = lambda x: 0 if x == 0 else (sales[x] * 3 + sales[x-1] * 2)/5
    forecast = [ calc(x) for x in range(0, len(sales) ) ]
    print(forecast)

  14. #Weighted Moving Average 4WMA
    weight = [0.4, 0.3, 0.2, 0.1]
    sales = [39, 44, 40, 45, 38, 43, 39]
    calc = lambda x: 0 if x < len(weight) else sales[x-1]*weight[0] + sales[x-2]*weight[1] + sales[x-3]*weight[2] + sales[x-4]*weight[3]
    forecast = [ calc(x) for x in range(0, len(sales) ) ]
    print(forecast)

  15. what if the ( 4 weeks ) is not given, the question only says find the forecast for a specific month? how can i solve ?

  16. Hello! I got a question, I was reading about this method, and I saw that all the weights must be equal to 1, I'm a bit confused why did you choose weight 5 on the second example.

  17. Thank you! I was so confused by this in my textbook. You broke it down to where I can understand the material!

  18. Is Moving average a suitable forecasting tool for short term forecasting. Please recommend

  19. Your videos are amazing and really easy to understand, do you have anything about Simple Linear Regression?

Leave a Reply

Your email address will not be published. Required fields are marked *