You are on page 1of 21

TIME SERIES AND FORECASTING

Module 4
SUBTOPIC 2
MOVING AVERAGE
Upon the completion of this module, the students are
expected to:
• Further understand the concept of moving average
• Simulate moving average using a sample data set
• Identify ways to measure the accuracy of the model
• If a time series is generated by a constant process subject
to random error, then mean is a useful statistic and can be
used as a forecast for the next period.
• Averaging methods are suitable for stationary time series
data where the series is in equilibrium around a constant
value ( the underlying mean) with a constant variance
over time.
• It is a technique that calculates the overall trend in sales
volume from historical data of the company.
• This technique is well-known when forecasting short-term
trends.

(𝑛1 + 𝑛2 + 𝑛3 + ⋯ 𝑛𝑥)
𝑚𝑜𝑣𝑖𝑛𝑔 𝑎𝑣𝑒𝑟𝑎𝑔𝑒 =
𝑛
Sales ($M) Company XZ sales from 2003 - 2012
Year
10
2003 4
9
2004 6 8

2005 5 7

2006 8 6

5
2007 9
4
2008 5
3
2009 4
2
2010 3 1

2011 7 0
2003 2004 2005 2006 2007 2008 2009 2010 2011 2012
2012 8
The mean sales for the first five years (2003-2007) is
calculated by finding the mean from the first five years.

$4𝑀 + $6𝑀 + $5𝑀 + $8𝑀 + $9𝑀


𝑎𝑣𝑒𝑟𝑎𝑔𝑒 =
5
𝑎𝑣𝑒𝑟𝑎𝑔𝑒 = $6.4𝑀
• Compute for the second subset of 5 years (2004-2008)
$6𝑀 + $5𝑀 + $8𝑀 + $9𝑀 + $5𝑀
𝑎𝑣𝑒 𝑜𝑓 𝑠𝑢𝑏𝑠𝑒𝑡2 =
5
𝑎𝑣𝑒 𝑜𝑓 𝑠𝑢𝑏𝑠𝑒𝑡 2 = $6.6𝑀
• Get the average of the third subset (2005-2009)
$5𝑀 + $8𝑀 + $9𝑀 + $5𝑀 + $4𝑀
𝑎𝑣𝑒 𝑜𝑓 𝑠𝑢𝑏𝑠𝑒𝑡3 =
5
𝑎𝑣𝑒 𝑜𝑓 𝑠𝑢𝑏𝑠𝑒𝑡3 = $6.2𝑀

• Continue calculating each five-year average until you reach 2009-2013.


This gives you a series of points that you can plot a chart for moving
averages.
• The Mean
• Uses the average of all the historical data as the forecast
1 t
Ft +1 =  yi
t i =1

• When new data becomes available , the forecast for time t+2 is
the new mean including the previously observed data plus this
new observation.
1 t +1
Ft + 2 = 
t + 1 i =1
yi

• This method is appropriate when there is no noticeable trend or


seasonality.
• The moving average for time period t is the mean of
the “k” most recent observations.
• The constant number k is specified at the outset.
• The smaller the number k, the more weight is given to
recent periods.
• The greater the number k, the less weight is given to
more recent periods.
• A large k is desirable when there are wide, infrequent
fluctuations in the series.
• A small k is most desirable when there are sudden
shifts in the level of series.
• For quarterly data, a four-quarter moving average,
MA(4), eliminates or averages out seasonal effects.
• For monthly data, a 12-month moving average,
MA(12), eliminate or averages out seasonal effect.
• Equal weights are assigned to each observation used
in the average.
• Each new data point is included in the average as it
becomes available, and the oldest data point is
discarded.
A moving average of order k, MA(k) is the value of k
consecutive observations.
( yt + yt −1 + yt − 2 +  + yt − k +1 )
Ft +1 = yˆ t +1 =
K
1 t
Ft +1 =  yi
k i =t − k +1

K is the number of terms in the moving average.


The moving average model does not handle trend or
seasonality very well although it can do better than the
total mean.
Period (t) Sales (y)

The weekly sales figures (in 1


2
5.3
4.4
3 5.4
millions of dollars) presented in the 4
5
5.8
5.6
following table are used by a major 6
7
4.8
5.6

department store to determine the 8


9
5.6
5.4
10 6.5
need for temporary sales 11
12
5.1
5.8
personnel. 13
14
5
6.2
15 5.6
16 6.7
17 5.2
18 5.5
19 5.8
20 5.1
21 5.8
22 6.7
23 5.2
24 6
25 5.8
Weekly Sales

5
Sales

4 Sales (y)

0
0 5 10 15 20 25 30

Weeks
• Use a three-week moving average (k=3) for the
department store sales to forecast for the week 24 and
26.
( y23 + y22 + y21) 5.2 + 6.7 + 5.8
yˆ 24 = = = 5.9
3 3
• The forecast error is
e24 = y24 − yˆ 24 = 6 − 5.9 = .1
• The forecast for the week 26 is

y25 + y24 + y23 5.8 + 6 + 5.2


yˆ 26= = = 5.7
3 3
Period (t) Sales (y) forecast

RMSE = 0.63 1
2
3
5.3
4.4
5.4
4 5.8 5.033333
Weekly Sales Forecasts
5 5.6 5.2
6 4.8 5.6
8
7 5.6 5.4
8 5.6 5.333333
9 5.4 5.333333
7
10 6.5 5.533333
11 5.1 5.833333
6 12 5.8 5.666667
13 5 5.8
14 6.2 5.3
5
15 5.6 5.666667
16 6.7 5.6
Sales

Sales (y) 17 5.2 6.166667


4
forecast 18 5.5 5.833333
19 5.8 5.8
3 20 5.1 5.5
21 5.8 5.466667
22 6.7 5.566667
2
23 5.2 5.866667
24 6 5.9

1
25 5.8 5.966667
5.666667

0
0 5 10 15 20 25 30

Weeks
If you have any question, leave a
comment on the discussion for Module
4 Subtopic 2.
• SAS. Moving Average

You might also like