Lecture 7
Dr. Haider Shah
Continue understanding the primary tools for forecasting
Understand time series analysis and when and how to apply it
Complex and difficult
Need to consider various factors
Sales of product A over the past 7 years were as follows:
Yr Sales (‘000 units) 1 22 2 25 3 24 4 26 5 29 6 28 7 30 Noting that X becomes the years,
identify the sales in Year 8 using regression analysis
Yr X Y XY X sq1 1 22 22 12 2 25 50 43 3 24 72 94 4 26 104 165 5 29 145 256 6 28 168 367 7 30 210 49
sum 28 184 771 140
Y = a + bX
b= ((7 x 771) -(28 x 184))((7 x 140) - (28 x 28)
b= 245 / 196 = 1.25
a = (184 ) - (1.25 x 28) = 21.37 7
For Yr 8 Y = 21.3 + (1.25 x 8) = 31.3
Y= 21.3 + 1.25X
so Y = 31,300 units
A time series is a collection of observations of well-defined data items obtained through repeated measurements over time.
e.g. retail sales each month of the year Data collected irregularly or only once
are not time series.
Records a series of figures or values over time.
Time
Values e.g. sales (£)
A graph version is called a histogram
neabs t /)(
net /)( 2
nyeabs tt /%100*)/(
Mean Absolute Deviation (MAD)
Mean Square Error (MSE)
Mean Absolute Percentage Error (MAPE)
Data Type : Choice of method
If static data: Naive or Average method If trended data – Holts’s method; Regression If seasonal data – Decomposition
You must PLOT your data and then decide….
A time series can be decomposed into four components:
Trend (long term direction), Seasonal variations (time related
movements) Cyclical variations Random variations (unsystematic,
short term fluctuations).
The underlying long-term movement over time in values of data recorded
There are three types of trend:
1. Downward trend2. Upward trend3. Static trend
Short-term fluctuations in recorded values, due to different circumstances which affect results at different times of a period.
10
5
1 2 3 4 1 2 3 4 1 2 3 4Year 1 Year 2 Year 3
Customers (‘000s)
TREND
Cyclical –
◦medium-term changes in results caused by circumstances which repeat in cycles
Random
◦non-recurring caused by unforeseen circumstances e.g. a war, stock market crash
Y = T + S + C + R
Where
Y = the actual time series T = the trend series
S = the seasonal component C = the cyclical component R = the random component
Expresses a time series as
Y = T + S + R
Y = T x S x R
Aug Sep Oct Nov Dec
Sales(£000
0.02 0.04 0.04 3.20 14.50
How is the trend? Promising?
What if it’s a Christmas card company?
Post December slump in sales?
1. Use moving averages to eliminate the seasonal effect◦Odd numbered (mid point is easy)◦If it is even numbered (4, 12) we must use centred moving averages
2. Use this series to extrapolate the trend into the future3. Difference between trend and actual data =
seasonality4. Average this for similar seasonal periods (like for like
quarters)5. Project these averages (seasonal factors) into the
future6. Add the projected trend and seasonal factors together
Adequacy of forecasts can be measured with MSE etc
Can be hard to distinguish between a trend and seasonal fluctuations.
One way of doing this is using ‘moving averages’ which attempts to remove seasonal and cyclical variations
The average of the results of a fixed number of periods
Year Sales units 1 390 2 380 3 460 4 450 5 470 6 440 7 500
Required:
What is the moving average using a period of3 years
year
Sales Moving total of 3 yr sales
Moving average of 3 yr sales
1 390
2 380
3 460
4 450
5 470
6 440
7 500
1230
1290
1380
1360
1410
410
430
460
453
470
Moving Averages (MA3): Moving Averages (MA3): SolutionSolution
Find the moving average over a period of 4 qtrs
Yr Qtr Actual sales (units)
2008 1 1,350 2 1,210 3 1,080 4 1,250
2009 1 1,400 2 1,260 3 1,110 4 1,320
STEP 1 STEP 2 TREND
Year QTR Sales Moving TOTAL Average of (mid point)of 4yr sales 4 year sales
3 1 1,350
2 1,210 4,890 1222.50
3 1,080 1228.75 4,940 1235.00
4 1,250 1241.25 4,990 1247.50
4 1 1,400 1251.25 5,020 1255.00
2 1,260 1263.75 5,090 1272.50
3 1,110
4 1,320
The trend
Additive model was Y = T + S + R
Can be Y – T = S + R
If we assume random variations as negligible:
S = Y –T So if we deduct trend from actual data
we get seasonal variations
Find the trend and seasonal variations of the following sales data:
Year Quarter Actual(£k)
2008 1 600 2 840 3 420 4 720
2009 1 640 2 860 3 420 4 740 Moving average = 4 quarters
Year Quar Actual Moving Moving Trend Seasonaltotal of Average Variation4 Qtrs
2008 1 6002 840
2580 6453 420 650 -230
2620 6554 720 658 63
2640 6602009 1 640 660 -20
2640 6602 860 663 198
2660 6653 4204 740
How decomposition of Time Series can be used for
forecasting future estimates