Sunteți pe pagina 1din 62

CHAPTER 7

TIME SERIES
ANALYSIS

1
Time series data
 Numerical data obtained at regular time
intervals
 The time intervals can be annually,
quarterly, daily, hourly, etc.

2
Example
Annual sales of a firm for 5 successive years

Year 2000 2001 2002 2003 2004

Sales 75.3 74.2 78.5 79.7 80.2

3
Example
 Number of registered journeys for a Home
Removals firm:
Qtr 1 Qtr 2 Qtr 3 Qtr 4
Year 1 73 90 121 98
Year 2 69 92 145 107
Year 3 86 111 157 122
Year 4 88 109 159 131
4
Time series components

Time-Series

Trend Seasonal Cyclical Random


Component Component Component Component

5
Standard time series models
 There are various types of model that can
be used to describe time series data.
 Two main models:

Additive model: Multiplicative model


y=t+s+r y=txSxR
y: is a given time series value
t: is the trend component
where
s: is the seasonal component
r: is the residual component
6
Trend component
 The underlying, long-term tendency of the
data series (overall upward or downward
movement)

 Some techniques are used for extracting a


trend from a given time series: semi-
average, regression (least square
method), moving average…

7
Trend Component
 Example

Sales

Time

8
Trend Component

 Trend can be upward or downward


 Trend can be linear or non-linear

Sales Sales

Time Time
Downward linear trend Upward nonlinear trend
9
Seasonal Component
 Short-term cyclic fluctuation
 Observed within 1 year (Often monthly or quarterly)
 Sometimes observed within 1 week (daily)

Sales

Summer
Winter

Spring Fall

Time (Quarterly) 10
Examples
 Daily ‘seasons’ over a weekly cycle for
sales in a supermarket
 Monthly ‘season’ over a yearly cycle for
the number of registered guests of a
resort.
 Quarterly ‘season’ over a yearly cycle for
sales of confectionary.

11
Example
 Number of registered journeys for a Home
Removals firm:
Qtr 1 Qtr 2 Qtr 3 Qtr 4
Year 1 73 90 121 98
Year 2 69 92 145 107
Year 3 86 111 157 122
Year 4 88 109 159 131

12
Number of registered journeys

200
Number of journeys

150

100 Series1

50

0
1 3 1 3 1 3 1 3
Q Q Q Q Q Q Q Q
Time

Year 1 Year 2 Year 3 Year 4

13
Cyclical Component
 Long-term wave-like patterns
 Regularly occur but may vary in length
 Often measured peak to peak or trough
to trough
1 Cycle
Sales

Year
Residual component
 Unpredictable, random, “residual”
fluctuations
 Due to random factors such as nature,
accidents or unusual events...

15
Time series trend
 The underlying, long-term tendency of the
data series (overall upward or downward
movement)
 The object of finding time series trend: to
enable the underlying tendency of the
data to be highlighted.
 Techniques for extracting the trend:
- least square regression
- moving average

16
The method of least squares
regression
 Consider the time series data as bivariate
 The procedure for conducting the method
- Step 1: Take the physical time points as
values of the independent variable x
(coded as 1, 2, 3, etc).
- Step 2: Take the data values themselves
as values of the dependent variable y

17
The method of least squares
regression
- Step 3: Calculate the regression line of y
on x, y= a+bx
- Step 4: Translate the regression line as
t=a+bx, where any given value of time
point x will yield a corresponding value of
the trend, t.

18
 Estimate a trend line using regression analysis
Year Time
Period Sales
(y)
(x)
1999 1 20
2000 2 40
2001 3 30
2002 4 50
2003 5 70
2004 6 65
Example
19
Time
Year Period Sales
(t) (y)
 The linear trend model is:
1999 1 20
2000 2 40 ŷ  12.333  9.5714 t
2001 3 30 Sales trend
2002 4 50 80
2003 5 70 70
60
2004 6 65 50
sales

40
30
20
10
0
0 1 2 3 4 5 6 7
Year

Trend-Based Forecasting
Example
UK outward passenger movements by sea
(millions). Estimate a trend line using regression
analysis.
Qtr 1 Qtr 2 Qtr 3 Qtr 4
Year 1 2.2 5.0 7.9 3.2
Year 2 2.9 5.2 8.2 3.8
Year 3 3.2 5.8 9.1 4.1

21
The method of moving average
 The method of obtaining a time series trend
involves calculating a set of average (known
as moving average)
 Each average is calculated by moving from
one overlapping set of values to the next
 Used for smoothing seasonal variation
(length of period for computing means (L)
should be equal to the number of seasons)
- For quarterly data, L = 4
- For monthly data, L = 12

22
Moving Averages
(continued)
 Example: Four-quarter moving average
◦ First average:
Q1  Q2  Q3  Q4
Moving average 1 
4

◦ Second average:

Q2  Q3  Q4  Q5
Moving average 2 
4
◦ etc…
Notes
 Each moving average value calculated must
correspond with an appropriate time point
(median of the time point)
- for moving average with an odd-numbered
period (3, 5, 7, etc), the relevant time point
is that corresponding to the 2nd, 3rd, 4th, etc
- for moving average with an even-numbered
period, there is no obvious corresponding
time point. The technique “centering” will be
used

24
Moving average (odd-numbered
period)
Time Original Moving Moving
point data totals average
1 12
2 10
3 11
4 11
5 9
6 11
7 10
8 10
9 11
10 10
25
Calculating Moving Averages
4-Quarter
Average Moving
Quarter Sales Period Average
1 2  3  4
1 23 2.5 28.75 2.5 
4
2 40 3.5 31.00
3 25 23  40  25  27
4.5 33.00 28.75 
4 27 4
5.5 35.00
5 32 6.5 37.50
6 48 7.5 38.75
7 33 etc…
8.5 39.25
8 37 9.5 41.00
9 37
 Each moving average is for a
10 50 consecutive block of 4 quarters
11 40
Centered Moving Averages
 Average periods of 2.5 or 3.5 don’t match the
original quarters, so we average two consecutive
moving averages to get centered moving
averages

4-Quarter Centered
Average Moving Centered Moving
Period Average Period Average
2.5 28.75 3 29.88
3.5 31.00 4 32.00
4.5 33.00 5 34.00
5.5 35.00 6 36.25
6.5 37.50 etc… 7 38.13
7.5 38.75 8 39.00
8.5 39.25 9 40.13
9.5 41.00
Example
UK outward passenger movements by sea
(millions). Calculate trend value using moving
average centering.

Qtr 1 Qtr 2 Qtr 3 Qtr 4


Year 1 2.2 5.0 7.9 3.2
Year 2 2.9 5.2 8.2 3.8
Year 3 3.2 5.8 9.1 4.1

28
Comparison of techniques for
trend
UK outward passenger movements by sea

7
Number of passengers

6
5
4 Least square
3 Moving average

2
1
0
1 2 3 4 5 6 7 8 9 10 11 12
Time

29
Comparison of techniques for
trend
 Least square regression:
- assume that a linear trend is appropriate
- not suitable for highly ‘seasonal data’
 Moving average:
- Show the nature of the trend whether
linear or non-linear
- The most widely used technique for
obtaining a trend
- Disadvantage: no trend values obtained
for the beginning and end time points of a
series.

30
Seasonal component
 Seasonal components give an average
effect on the trend which is solely
attributable to the season itself.
 Can be expressed in terms of deviations
from (additive model) or percentages
from (multiplicative model) of the trend

31
Technique for calculating seasonal
variation
 Additive model
- Step 1: For each time point calculate the
difference between the original value and the
trend value (y - t).
- Step 2: Find the average of the difference
values (y – t) for each season in turn.
- Step 3: If the total average differs from
zero, adjust one or more of them so that their
total is zero

32
Example
 The sales of a company (y, in £000) are given
STEP 1
below
Year Qtr y t y-t
Year 1 1 20 23
2 15 29
3 60 34
4 30 39
Year 2 1 35 45
2 25 50
3 100 55
4 50 61
33
Example
STEP 2
Deviations (y – t)

34
Example
STEP 3

35
Technique for calculating seasonal
variation
 Multiplicative model
- Step 1: For each time point calculate the
proportion between the original value and the
trend value (y/t).
- Step 2: Find the geometric mean of the
proportion values (y/t) for each season in
turn.
- Step 3: If the total average differs from 4,
adjust one or more of them so that their total
is 4

36
Example
 The sales of a company (y, in £000) are given
below STEP 1
Year Qtr y t y/t
Year 1 1 20 23
2 15 29
3 60 34
4 30 39
Year 2 1 35 45
2 25 50
3 100 55
4 50 61
37
Example
STEP 2
(y/t)

38
Example
STEP 3

39
Seasonally adjusted time
series
 For additive model:
The adjustment is performed by
subtracting the seasonal variation from
each original time series value
Seasonally adjusted time series value =
(y – s)

40
Example (seasonally adjusted
time series)
Year Qtr y s y-s
Year 1 1 20 6.5
2 15 -19.5
3 60 36.0
4 30 -10.0
Year 2 1 35 -6.5
2 25 -19.5
3 100 36.0
4 50 -10.0
41
Seasonally adjusted time
series
 For multiplicative model:
The adjustment is performed by dividing
each of the original time series values by
S
Seasonally adjusted time series value =
y/S

42
Example (seasonally adjusted
time series)
Year Qtr y S y/S
Year 1 1 20 0.82
2 15 0.51
3 60 1.88
4 30 0.79
Year 2 1 35 0.82
2 25 0.51
3 100 1.88
4 50 0.79
43
Technique for forecasting

 Step 1: Estimate a trend value for the


time point
 Step 2: Identify the seasonal variation
value appropriate to the time point
 Step 3: Add/multiply these two values
together giving the forecast values
Additive model Multiplicative model
yest = test + s yest = test x S
yest: estimated data value
where test: Projected trend value
s: appropriate seasonal variation value
44
Example
 The following data represents the number of
registered guests (in thousands) of a hotel in
Sapa.
Qtr 1 Qtr 2 Qtr 3 Qtr 4

2000 180 340 140 260

2001 200 350 160 275

2002 200 345 155 270

Forecast the number of guests for 4 quarters of 2003


using least square method to estimate the trend line?
45
Example
Year Qtr x y t
2000 1 1 180 230.06
 x  78
2 2 340 231.79
 y  2875
3 3 140 233.52
4 4 260 235.25  xy  18935
2001 1 5 200 236.98
2 6 350 238.71   650
x 2

3 7 160 240.44
4 8 275 The regression for the
242.17
trend is:
2002 1 9 200 243.90
2 10 345 245.63 t  228.33 1.73x
3 11 155 247.36
4 12 270 249.09 46
Year Qtr y t (y - t)
2000 1 180 230.06 -50.06
2 340 231.79 108.21
3 140 233.52 -93.52
4 260 235.25 24.75
2001 1 200 236.98 -36.98
2 350 111.29
238.71
3 160 -80.44
240.44
4 275 242.17 32.83
2002 1 200 243.90 -43.90
2 345 245.63 99.37
3 155 247.36 -92.36
4 270 249.09 20.91
47
Q1 Q2 Q3 Q4 Sum

Year 1 -50.06 108.21 -93.52 24.75

Year 2 -36.98 111.29 -80.44 32.83

Year 3 -43.90 99.37 -92.36 20.91

Totals -130.94 318.87 -266.32 78.49

Averages -43.65 106.29 -88.77 26.16 0.03

Adjustments 0 -0.03 0 0

Adjusted -43.65 106.26 -88.77 26.16 0.00


average
48
s1 s2 s3 s4
Year Qtr y t (y - t) s y-s
2000 1 180 230.06 -50.06 -43.65 223.65
2 340 231.79 108.21 106.26 233.74
3 140 233.52 -93.52 -88.77 228.77
4 260 235.25 24.75 26.16 233.84
2001 1 200 236.98 -36.98 -43.65 243.65
2 350 238.71 111.29 106.26 243.74
3 160 240.44 -80.44 -88.77 248.77
4 275 242.17 32.83 26.16 248.84
2002 1 200 243.90 -43.90 -43.65 243.90
2 345 245.63 99.37 106.26 238.74
3 155 247.36 -92.36 -88.77 243.77
4 270 249.09 20.91 26.16 243.84
49
Forecasting for 4 quarters of
2003
 Quarter 1, 2003: x = 13

test (Q1,2003)  228.33  1.73 13  250.82

yest (Q1,2003) test (Q1,2003)  s1  250.82  43.65  207.17

 Quarter 2, 2003:x = 14

test (Q 2,2003)  228.33  1.73 14  252.55

yest (Q 2,2003)  test (Q 2,2003)  s2  252.55  106.26  358.81


50
Forecasting for 4 quarters of
2003
 Quarter 3, 2003: x = 15

test (Q 3,2003)  228.33  1.73 15  254.28

yest (Q 3,2003)test (Q 3,2003)  s3  254.28  88.77  165.51

 Quarter 4, 2003: x = 16

test (Q 4,2003)  228.33  1.73 16  256.01

yest (Q 4,2003)  test (Q 4,2003)  s4  256.01  26.16  282.17


51
Example
 The following data represents the number of
registered guests (in thousands) of a hotel in
Sapa.
Qtr 1 Qtr 2 Qtr 3 Qtr 4

2000 180 340 140 260

2001 200 350 160 275

2002 200 345 155 270

Forecast the number of guests for 4 quarters of 2003


using moving average method to extract the trend?
52
Year Qtr y Moving Moving Centered
totals average moving
average
2000 1 180
2 340
920 230
3 140 232.5
940 235
4 260 236.25
950 237.5
2001 1 200 240
970 242.5
2 350 244.375
985 246.25
3 160 246.25
985 246.25
4 275 245.625
980 245
2002 1 200 244.375
975 243.75
2 345 243.125
970 242.5
3 155 53

4 270
Year Qtr y t (y - t)
2000 1 180
2 340
3 140 232.5 -92.50
4 260 236.25 23.75
2001 1 200 240 -40
2 350 244.375 105.625
3 160 246.25 -86.25
4 275 245.625 29.375
2002 1 200 244.375 -44.375
2 345 243.125 101.875
3 155
4 270 54
Q1 Q2 Q3 Q4 Sum

Year 1 -92.50 23.75

Year 2 -40 105.625 -86.25 29.375

101.875
Year 3 -44.375

Totals -84.375 207.5 -178.75 53.125

Averages -42.1875 103.75 -89.375 26.5625 -1.25

Adjustments 0 1.25 0 0

Adjusted -42.1875 105.00 -89.375 26.5625 0.00


average
55
s1 s2 s3 s4
Year Qtr y t (y - t) s y-s
2000 1 180 -42.1875 222.1875
2 340 105.00 235
3 140 232.5 -92.50 -89.375 229.375
4 260 236.25 23.75 26.5625 233.4375
2001 1 200 240 -40 -42.1875 242.1875
2 350 244.375 105.625 105.00 245
3 160 246.25 -86.25 -89.375 249.375
4 275 245.625 29.375 - 26.5625 248.4375
2002 1 200 244.375 -44.375 -42.1875 242.1875
2 345 243.125 101.875 105.00 240
3 155 -89.375 244.375
4 270 26.5625 243.4375
56
Forecasting for 4 quarters of
2003
 Range of trend values:

R  243.125  232.5  10.625


 Average change per time period:

 10.625  7  1.518(approx)

57
Forecasting for 4 quarters of
2003
 Quarter 1, 2003:
test (Q1,2003)  243.125  1.518  3  247.679

yest (Q1,2003)test (Q1,2003)  s1  247.679  42.1875  205.4915


 Quarter 2, 2003:

test (Q 2,2003)  243.125  1.518  4  249.197

yest (Q 2,2003)  test (Q 2,2003)  s2  249.197  105  354.197


58
Forecasting for 4 quarters of
2003
 Quarter 3, 2003:

test (Q 3,2003)  243.125  1.518  5  250.715

yest (Q 3,2003) test (Q3,2003)  s3  250.715  89.375  161.34

 Quarter 4, 2003:

test (Q 4,2003)  243.125  1.518  6  252.233

yest (Q 4,2003)  test (Q 4,2003)  s4  252.233  26.5625  278.7955


59
Forecasting for 4 quarters of
2003
 Proportional multiplier of trend values:

pm  243.125 / 232.5  1.046

 Geometric mean multiplier of the period:

gmm  7 1.046  1.0064

60
Forecasting for 4 quarters of
2003
 Quarter 1, 2003:

test (Q1,2003)  243.125 1.0064  247.826


3

yest (Q1,2003)test (Q1,2003)  s1  247.826  42.1875  205.6384


 Quarter 2, 2003:

test (Q2,2003)  243.125 1.0064  249.413


4

yest (Q 2,2003)  test (Q 2,2003)  s2  249.413  105  354.413


61
Forecasting for 4 quarters of
2003
 Quarter 3, 2003:

test (Q3,2003)  243.125 1.0064  251.0103


5

yest (Q 3,2003) test (Q3,2003)  s3  251.0103  89.375  161.635

 Quarter 4, 2003:

test (Q4,2003)  243.125 1.0064  252.6178


6

yest (Q 4,2003)  test (Q 4,2003)  s4  252.6178  26.5625  279.1803


62

S-ar putea să vă placă și