# 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. KETLER CAJUSTE says:

well explained! thank you

2. Chuks Ogbonna says:

you are good

3. Deebz786 says:

Joshua you are the man

4. Olaleye Ebenezer says:

Thank You.

5. Samad Khan says:

good job

6. Andrew Lian says:

In 2-week WMA case, weight 3 and 2, are they just random number? and how to get the optimal weights? thanks

7. JJ Jahed says:

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

8. Fred Tetteh says:

josh that's cool thanks

9. Daniel Yama says:

Nice one.

10. Monika Kamra says:

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?.

11. Namiq Qəfərli says:

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.

12. lotusi thok says:

nice one keep it up

13. Koat Diw Gach says:

Very incredible, wish you include more topic in that video lecture

14. Richa Handa says:

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.

15. Hyder Shaikh says:

ur great.thanks a lot . awesome explanation

16. Hyder Shaikh says:

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

17. thundercookie says:

great help … thank you

18. Nikki Taylor HM says:

19. Maame Efya Tenkorang says:

understandable

20. Fred Apex says:

his accent sounds Nigerian

21. Hannah Vandemotter says:

When calculating MAD I thought you would divide by n-1 so we would divide by 4 and not 5 ?

22. h. Sep says:

thank you for this amazing explanations 👌

23. Waqiyuddin Kerq Jaafar says:

can i forecast week 9?

24. Ataturk Turk says:

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.

25. haljordan135 says:

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?

26. A12I says:

Thank you !

27. Norlaile binti Salleh Hudin says:

thanks. This video is great!

28. Arif k.Sani says:

forecast sounds like fuckass :3

29. SUSHMA BALAKRISHNAN says:

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??

30. Issac Tsai says:

You are a better Professor than MY professor !!!! more clear and easy to understand!!! 100% GOOD for international students!

31. Piyush Choudhary says:

Man, good job. It was helpful.

32. WHaAteVaA says:

Do you have examples on Moving average ?

33. Sri Nallala says:

hi joshua

could you further evaluate for Normalised weighted Root Mean Squared logarithmatic Error,please

34. Ashutosh Chauhan says:

35. Dan Cacovean says:

coool

36. Talatu Hassan says:

How to find exp entail smoothing regression analysis, Markov chain, simulation. Thank you

37. Mania Roxy says:

How do you determine the weight values – .4, .3 etc? Or are they just a given?

38. Anurag Srivastav says:

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.

39. Adam Elclon says:

well explained and very helpful, Thank you so much Joshua

40. Hatice Kübra Gürses says:

can u explain decomposition on your nex video

41. mohamed desouky says:

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

42. Lans Salac says:

thanks! i Got great ideas for this videos!

43. Vugatri Byron says:

So what happens to the first 4 weeks that are empty? Where do we get that data from?

44. RISHI ADITYA says:

good job @joshua

45. Naveen Bali says:

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

46. To Es says:

Very good video thank you

47. Dan Pel says:

Great vid. Thank you so much!

48. ThePhysics1234 says:

How do you differentiate Mean absolute deviation vs Median absolute deviation which is also short for MAD

49. Muhammad Taha Khan says:

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

50. R. Gomes says:

# 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)

51. R. Gomes says:

#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 + sales[x-2]*weight + sales[x-3]*weight + sales[x-4]*weight
forecast = [ calc(x) for x in range(0, len(sales) ) ]
print(forecast)

52. Nour Khawari says:

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

53. Eeshah Ahsan says:

What if the sum of weights is less than 1?

54. Vanessa Irene says:

How did u get the weights

55. Dewey Sherman says:

56. Rey David Del Ángel Jiménez says:

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.

57. Kabir theKhiladi says:

Nice work nigga

58. Dany-dan Chrislain says:

Very good explanation, thanks

59. Kris Ramirez says:

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

60. Majahid Laskar (Manager-IDM- Marketing, Nerul) says:

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

61. luma essam says:

Wonderful

62. Francis Kyaruzi says:

How can you calculate the sales for week 9 and 10.

63. Vipin singh says:

Good explain

64. Nirmal Chungath says:

Week 5th 4WMA is 38.8

65. Enrico Vlotman says:

Thank you Sir

66. Divingly Inspired says:

Please Josh how would interpret the 2.92 result?

67. Chintan Vaghela says:

how do we choose the weights while calculating forecasts?

68. jeewaka jayasri says:

🙏

69. Jonathan Caicedo says:

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

70. barood khan says:

Fuck our sales?

71. Falih Abi says:

thank you

72. taha yclr says:

SMOOTH

73. Fuad Enes ARICI says:

how to decide of their weights ??