31
Lecture 7 Dr. Haider Shah

Lecture 7 Dr. Haider Shah. Continue understanding the primary tools for forecasting Understand time series analysis and when and how to apply it

Embed Size (px)

Citation preview

Page 1: Lecture 7 Dr. Haider Shah.  Continue understanding the primary tools for forecasting  Understand time series analysis and when and how to apply it

Lecture 7

Dr. Haider Shah

Page 2: Lecture 7 Dr. Haider Shah.  Continue understanding the primary tools for forecasting  Understand time series analysis and when and how to apply it

Continue understanding the primary tools for forecasting

Understand time series analysis and when and how to apply it

Page 3: 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

Page 4: Lecture 7 Dr. Haider Shah.  Continue understanding the primary tools for forecasting  Understand time series analysis and when and how to apply it
Page 5: Lecture 7 Dr. Haider Shah.  Continue understanding the primary tools for forecasting  Understand time series analysis and when and how to apply it

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

Page 6: Lecture 7 Dr. Haider Shah.  Continue understanding the primary tools for forecasting  Understand time series analysis and when and how to apply it

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

Page 7: Lecture 7 Dr. Haider Shah.  Continue understanding the primary tools for forecasting  Understand time series analysis and when and how to apply it

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

Page 8: Lecture 7 Dr. Haider Shah.  Continue understanding the primary tools for forecasting  Understand time series analysis and when and how to apply it

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.

Page 9: Lecture 7 Dr. Haider Shah.  Continue understanding the primary tools for forecasting  Understand time series analysis and when and how to apply it

Records a series of figures or values over time.

Time

Values e.g. sales (£)

Page 10: Lecture 7 Dr. Haider Shah.  Continue understanding the primary tools for forecasting  Understand time series analysis and when and how to apply it

A graph version is called a histogram

Page 11: Lecture 7 Dr. Haider Shah.  Continue understanding the primary tools for forecasting  Understand time series analysis and when and how to apply it

neabs t /)(

net /)( 2

nyeabs tt /%100*)/(

Mean Absolute Deviation (MAD)

Mean Square Error (MSE)

Mean Absolute Percentage Error (MAPE)

Page 12: Lecture 7 Dr. Haider Shah.  Continue understanding the primary tools for forecasting  Understand time series analysis and when and how to apply it
Page 13: Lecture 7 Dr. Haider Shah.  Continue understanding the primary tools for forecasting  Understand time series analysis and when and how to apply it

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

Page 14: Lecture 7 Dr. Haider Shah.  Continue understanding the primary tools for forecasting  Understand time series analysis and when and how to apply it

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

Page 15: Lecture 7 Dr. Haider Shah.  Continue understanding the primary tools for forecasting  Understand time series analysis and when and how to apply it

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

Page 16: Lecture 7 Dr. Haider Shah.  Continue understanding the primary tools for forecasting  Understand time series analysis and when and how to apply it

Short-term fluctuations in recorded values, due to different circumstances which affect results at different times of a period.

Page 17: Lecture 7 Dr. Haider Shah.  Continue understanding the primary tools for forecasting  Understand time series analysis and when and how to apply it

10

5

1 2 3 4 1 2 3 4 1 2 3 4Year 1 Year 2 Year 3

Customers (‘000s)

TREND

Page 18: Lecture 7 Dr. Haider Shah.  Continue understanding the primary tools for forecasting  Understand time series analysis and when and how to apply it

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

Page 19: Lecture 7 Dr. Haider Shah.  Continue understanding the primary tools for forecasting  Understand time series analysis and when and how to apply it

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

Page 20: Lecture 7 Dr. Haider Shah.  Continue understanding the primary tools for forecasting  Understand time series analysis and when and how to apply it

Expresses a time series as

Y = T + S + R

Y = T x S x R

Page 21: Lecture 7 Dr. Haider Shah.  Continue understanding the primary tools for forecasting  Understand time series analysis and when and how to apply it

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?

Page 22: Lecture 7 Dr. Haider Shah.  Continue understanding the primary tools for forecasting  Understand time series analysis and when and how to apply it

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

Page 23: Lecture 7 Dr. Haider Shah.  Continue understanding the primary tools for forecasting  Understand time series analysis and when and how to apply it

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

Page 24: Lecture 7 Dr. Haider Shah.  Continue understanding the primary tools for forecasting  Understand time series analysis and when and how to apply it

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

Page 25: Lecture 7 Dr. Haider Shah.  Continue understanding the primary tools for forecasting  Understand time series analysis and when and how to apply it

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

Page 26: Lecture 7 Dr. Haider Shah.  Continue understanding the primary tools for forecasting  Understand time series analysis and when and how to apply it

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

Page 27: Lecture 7 Dr. Haider Shah.  Continue understanding the primary tools for forecasting  Understand time series analysis and when and how to apply it

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

Page 28: Lecture 7 Dr. Haider Shah.  Continue understanding the primary tools for forecasting  Understand time series analysis and when and how to apply it

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

Page 29: Lecture 7 Dr. Haider Shah.  Continue understanding the primary tools for forecasting  Understand time series analysis and when and how to apply it

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

Page 30: Lecture 7 Dr. Haider Shah.  Continue understanding the primary tools for forecasting  Understand time series analysis and when and how to apply it

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

Page 31: Lecture 7 Dr. Haider Shah.  Continue understanding the primary tools for forecasting  Understand time series analysis and when and how to apply it

How decomposition of Time Series can be used for

forecasting future estimates