Statistics lecture 13 (chapter 13)

Post on 05-Dec-2014

1.483 views 3 download

description

Time Series Analysis

Transcript of Statistics lecture 13 (chapter 13)

1

2

• Sequence of observations of the same variable

taken at equally spaced points in time.

• Each observation records both the value of the

variable and the time it was made.

• Tell us where we are and suggest where we are

going.

• Time series data are used to predict future values

for forecasting.

3

• Can reveal the main features of a time series.

• Look for the overall pattern and for deviations from the

pattern.

• Time on x-axis, measured variable on y-axis.

• Plot the points and connect them with straight lines.

Time plots

4

Time plots – Example

SA Fuel Price

0

100

200

300

400

500

600

700

800

J F M A M J J A S O N D J F M A M J J A S

Months 2008 - 2009

Ra

nd

5

• Trend – (T)

• Seasonal variations – (S)

• Cyclical Variations – (C)

• Irregular (random) variations – (I)

Components of a time series

6

• Trend – (T)

– Overall smooth pattern and show long-term upward or

downward movement.

– Trend analysis isolate the long-term movement and is

used to make long-term forecasting.

Components of a time series

7

• Seasonal variation – (S)

– Rises and falls occurring in particular times of the year

and repeated every year.

• Period of times may be years, months, days, hours or

quarters.

– Seasonal effect can be taken into account to evaluate

activity and can be incorporated into forecasts of future

activity.

Components of a time series

8

• Cyclical variation – (C)

– Patterns that repeat over time periods that exceed one

year.

– Time period for the cycle usually differ form each other.

• Business cycles – recession, depression, recovery or boom.

• Changes in governmental monetary and fiscal policy, etc.

Components of a time series

9

• Irregular variation – (I)

– Variation left after the trend, seasonal and cyclical

variations have been removed.

– Have an irregular, saw-tooth pattern.

– Cannot be predicted.

– Unusual events.

• Political events, war, riots, strikes, etc.

– Cannot be analysed statistically or forecasted.

Components of a time series

CONCEPT QUESTIONS

• Questions 1-5 ,p462, textbook

10

11

• Multiplicative time series model:

– Original observed value Yt

– Yt = TSCI

• Decomposing a time series into four components.

• Isolate the influence of each of the four components.

• Statistical methods can isolate trend and seasonal

variations.

• To isolate cyclical and irregular variation is of less value.

Decomposition of a time series

12

• Shows the general direction in which the series is

moving.

– Regression analysis – linear trend line

– Moving average method – smooth curve

Decomposition – Trend analysis

13

• ŷt = a + bx

– ŷt = estimated time series values

– x = time

• List the values of x and yt

– Code x

• 1st time period – x =1

• 2nd time period – x =2 ……….

• nth time period – x = n

– yt = original time series values

Decomposition – Trend analysis – Linear trend

14

• Determine the values of a and b:

Decomposition – Trend analysis – Linear trend

1 12

2 6

1 1

21 12

( 1) ( 1)(2 1)

t tn n

XX XY t tn n

XY

XX

t

x n n x n n n

y y x x

S x x S xy x y

Sb

S

a y bx

15

• ŷt = a + bx

• Substitute each value of xi into the trend equation to

find the trend component.

• Draw the trend line on the same graph as the

original time series.

• The trend line can now be used to estimate future

values of the dependent variable (ŷt).

Decomposition – Trend analysis – Linear trend

16

• The table below lists the quarterly number of foreign visitors at a game ranch in Limpopo for the past 3 years.

Decomposition – Linear trend – Example

I II III IV I II III IV I II III IV

23 59 64 32 26 45 69 29 15 36 47 38

2006 2007 2008

17

Decomposition – Linear trend – Example

Visitors at a game ranch

0

10

20

30

40

50

60

70

80

I II III IV I II III IV I II III IV

Quarters 2006 - 2008

Nu

mb

er

of

vis

ito

rs

18

• Determine the values of a and b

Decomposition – Linear trend – Example

1 1

2 2

1 12

6 6

1

12

1

12

( 1) 12(12 1) 78

( 1)(2 1) 12(12 1)(2(12) 1) 650

483

3044

(483) 40,25

(78) 6,5

t

t

t

x n n

x n n n

y

xy

y

x

I II III IV I II III IV I II III IV

yt 23 59 64 32 26 45 69 29 15 36 47 38

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

2006 2007 2008

19

21 12 2

12

1 1

12

650 (78) 143

650 (78)(483) 95,5

95,50,668

143

40.25 ( 0,668)(6,5) 44,592

ˆ 44,592 0,668

XX n

XY t tn

XY

XX

t

t

S x x

S xy x y

Sb

S

a y bx

y x

• Determine the values of a and b:

Decomposition – Linear trend – Example

20

• Determine the values of the isolated trend component

Decomposition – Linear trend – Example

ˆIf x = 1 then 44,592 0,668(1) 43,924ty

ˆIf x = 2 then 44,592 0,668(2) 43,256ty

21

• Plot the trend line on the graph

Decomposition – Linear trend – Example

Visitors at a game ranch

0

10

20

30

40

50

60

70

80

I II III IV I II III IV I II III IV

Quarters 2006 - 2008

Nu

mb

er

of

vis

ito

rs

ˆ 44,592 0,668ty x

• Determine the estimated number of visitors for the next

four quarters.

• Determine the x-values for the next four quarters.

22

• Forecast the values for the next four quarters

Decomposition – Linear trend – Example

ˆIf x = 13 then 44,592 0,668(13) 35,908ty

ˆIf x = 14 then 44,592 0,668(14) 35,24ty

IMPORTANT

• Forecasting in this way assumes the same

linear trend holds true for future time

periods

• Remember:-

23

ALSO IMPORTANT

• Without seeing the trend line graphically it is still possible

to determine whether the trend is increasing or

decreasing over time

• Slope of line is given by b. If b is +ve the slope is +ve

and the trend is increasing over time. If b is –ve the

slope is –ve and the trend is decreasing over time

• The strength of the trend influence can be assessed by

looking at b. A string upward/downward trend is shown

by large +ve/-ve values of b. Values of b close to 0

indicate a wek trend

24

EXAMPLE The table below shows the annual expenditure of Exel Ltd

on salaries (in R100,000), for each semester for a 4 year

period.

A. What is the value of the slope of the linear trend line for

this time series?

B. What is the value of the intercept (line crosses Y axis)

of the linear trend line for this time series?

C. Forecast the expenditure on salaries (in rands) for the

second semester in 2006

25

Year Semester1 Semester 2

2002 140.3 160.6

2003 139.6 158.2

2004 141.4 163.8

2005 143.5 167.3

EXAMPLE ANSWER

26

A.

x = 36

x2 = 204

x = 4,5

y = 1 214,7

y = 151,8375

xy = 5 545,8

SXX = 42 SXY = 79,65

b =

SXY

SXX

=

79,65

42

= 1,8964 B.

a =

y – b

x

= 151,8375 – 1,8964(4,5) = 143,3037

C.

ˆ y = 143,3037 + 1,8964(10) = 162,2677

27

• Removes the short term fluctuations in a time series.

– Smoothing a time series

• Remove the effect of seasonal and irregular

variations.

• Reflect the trend and cyclical movements.

– TC

Decomposition – Trend analysis – Moving average

28

• How to calculate a k-point moving average if k is odd

Decomposition – Trend analysis – Moving average

Time (X) Price (yt)3-point moving

average

5-point moving

average

2008 - O 564.03

N 519.03 480.37

D 358.03 381.02 406.81

2009 - J 265.98 317.00 368.40

F 326.98 321.65 338.09

M 371.98 355.48 339.38

A 367.48 367.98 362.06

M 364.48 370.45 379.94

J 379.38 386.75 383.54

J 416.38 395.25 395.23

A 389.98 410.76

S 425.93

564.03 519.03 358.03

3

480.37

519.03 358.03 265.98

3

381.02

29

• How to calculate a k-point moving average if k is odd

Decomposition – Trend analysis – Moving average

Time (X) Price (yt)3-point moving

average

5-point moving

average

2008 - O 564.03

N 519.03 480.37

D 358.03 381.02 406.81

2009 - J 265.98 317.00 368.40

F 326.98 321.65 338.09

M 371.98 355.48 339.38

A 367.48 367.98 362.06

M 364.48 370.45 379.94

J 379.38 386.75 383.54

J 416.38 395.25 395.23

A 389.98 410.76

S 425.93

EXAMPLE Calculate a 3 point moving average and a 5 point moving

average for the 2011 salaries of Rinto Ltd. The monthly

salary data (in R10,000’s) is as follows:-

30

Month Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec

Sal (y) 8 4 6 10 8 10 13 5 11 14 10 11

Example answer

• Example 13.3, p470, textbook

31

32

• How to calculate a k-point

moving average if k is

even.

Decomposition

– Trend analysis

– Moving average

33

• Plot the original time series data and moving average.

Decomposition – Trend analysis – Moving average

Visitors at a game ranch

0

10

20

30

40

50

60

70

80

I II III IV I II III IV I II III IV

Quarters 2006 - 2008

Nu

mb

er

of

vis

ito

rs

yt

centred

moving

average

EXAMPLE Calculate a 4 point moving average average for the 2011

salaries of Rinto Ltd. The monthly salary data (in R10,000’s)

is as follows:-

34

Month Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec

Sal (y) 8 4 6 10 8 10 13 5 11 14 10 11

Example answer

• Example 13.4, p471, textbook

35

TERM OF MOVING AVERAGE

Given a set of time series data how do we

chose an appropriate moving average

term (k) for the series?

Months 12

Quarters 4

Workdays 5

36

37

• Isolates the seasonal components in a time series.

• Dominates short-term movement.

• Find seasonal index for each period.

– Specific seasonal index

• specific year

• short term

– Typical seasonal index

• number of years

• long term

Decomposition – Seasonal analysis

MOVING AVERAGES

• Dampens short term fluctuations

• Shorter terms still show some variations; longer

terms produce a much smoother curve

• Disadvantages of moving averages:-

• Loss of information on both sides of the series

• Not a specific mathematical equation therefore

cannot be used in isolation to make objective

forecasts

38

SEASONAL ANALYSIS

• Isolates the seasonal component in a time

series

• Most business and economic time series

contain seasonal variations

• To isolate the seasonal component we

must find a seasonal index for each time

period

• Seasonal indices important because they

are used to forecast future values 39

SEASONAL INDICES

• Two types:-

– Specific seasonal index – measures

seasonal change during a specific year

– Typical seasonal index – measures

seasonal changes over a number of years

40

41

• Use moving average to smooth time series:

– Isolates trend and cyclical variations – Yt = TC

• Find a typical seasonal index for each period.

• Remember that sum of k mean seasonal indices must = k x 100.Calculate a series of seasonally adjusted values: –

• Construct a trend line for the seasonally adjusted data.

• Construct forecasts of the time series values.

Decomposition – Seasonal analysis

– Ratio-to-moving-average method

100 100 - seasonal and irregulart

TSCIY SI

TC

100 100t

TSCIY TCI

S

42

Decomposition

– Seasonal analysis

– Ratio-to-moving-average

method

43

64100 142.62

44.88

36100 109.51

32.88

TSCISI

TC

TSCISI

TC

44

Yt =

TCSI/TC=SIYt = TCI

42.81

53.52

142.62 40.10

73.56 20.05 I II III IV

61.36 48.39 2006 142.62 73.56

105.57 40.82 2007 61.36 105.57 168.81 75.57

168.81 43.23 2008 43.48 109.51 Total

75.57 37.94 Mean 52.42 107.54 155.715 74.565 390.24

43.48 27.92 Typical SI 53.73 110.23 159.61 76.43 400

109.51 32.66

29.45

49.72

Calculate the mean

index for each quarter:

45

Yt =

TCSI/TC=SIYt = TCI

42.81

53.52

142.62 40.10

73.56 20.05 I II III IV

61.36 48.39 2006 142.62 73.56

105.57 40.82 2007 61.36 105.57 168.81 75.57

168.81 43.23 2008 43.48 109.51 Total

75.57 37.94 Mean 52.42 107.54 155.715 74.565 390.24

43.48 27.92 Typical SI 53.73 110.23 159.61 76.43 400

109.51 32.66

29.45

49.72

100 400adjustment factor = 1,025

mean SI 390,24

52,42 1,025 53,73

k

Sum of mean indices = 390,24

Must be adjusted to 400

46

Time

(x)

yt =

TCSI

Yt =

TCSI/TC=SIYt = TCI

2006 - I 1 23 42.81

II 2 59 53.52

III 3 64 142.62 40.10

IV 4 32 73.56 20.05

2007 - I 5 26 61.36 48.39

II 6 45 105.57 40.82

III 7 69 168.81 43.23

IV 8 29 75.57 37.94

2008 - I 9 15 43.48 27.92

II 10 36 109.51 32.66

III 11 47 29.45

IV 12 38 49.72

I II III IV

2006 142.62 73.56

2007 61.36 105.57 168.81 75.57

2008 43.48 109.51 Total

Mean 52.42 107.54 155.715 74.565 390.24

Typical SI 53.73 110.23 159.61 76.43 400

Seasonal adjusted value = TCI

23100 42,81

53,73

47

Time

(x)

yt =

TCSI

Yt =

TCSI/TC=SIYt = TCI

2006 - I 1 23 42.81

II 2 59 53.52

III 3 64 142.62 40.10

IV 4 32 73.56 20.05

2007 - I 5 26 61.36 48.39

II 6 45 105.57 40.82

III 7 69 168.81 43.23

IV 8 29 75.57 37.94

2008 - I 9 15 43.48 27.92

II 10 36 109.51 32.66

III 11 47 29.45

IV 12 38 49.72

I II III IV

2006 142.62 73.56

2007 61.36 105.57 168.81 75.57

2008 43.48 109.51 Total

Mean 52.42 107.54 155.715 74.565 390.24

Typical SI 53.73 110.23 159.61 76.43 400

Seasonal adjusted value = TCI

29100 37,94

76,43

48

• Determine the trend line:

Decomposition – Seasonal analysis

1 1

2 2

1 12

6 6

1 1

12 12

( 1) 12(12 1) 78

( 1)(2 1) 12(12 1)(2(12) 1) 650

466,61

2941,78

(466,61) 38,88 (78) 6,5

t

t

t

x n n

x n n n

y

xy

y x

49

21 12 2

12

1 1

12

650 (78) 143

2941,78 (78)(466,61) 91,185

91,1850,638

143

38,88 ( 0,638)(6,5) 43,027

ˆ 43,027 0,638

XX n

XY t tn

XY

XX

t

t

S x x

S xy x y

Sb

S

a y bx

y x

Decomposition – Seasonal analysis

• Determine the trend line:

Seasonally

adj data

50

• Determine the values of the isolated trend component:

Decomposition – Seasonal analysis

ˆIf x = 9 then 43,027 0,638(9) 37,29

ˆIf x = 14 then 43,027 0,638(14) 34,10

t

t

y

y

51

• Determine the real predicted values:

Decomposition – Seasonal analysis

34,73 53,73 33,46 159,6118,7 53,401

100 100

52

• Represent the real predicted values graphically:

Decomposition – Seasonal analysis

Visitors at a game ranch

0.00

10.00

20.00

30.00

40.00

50.00

60.00

I II III IV I II III IV I II III IV I II III IV

Quarters 2006 - 2009

Nu

mb

er

of

vis

ito

rs

EXAMPLE MONTH PRICE

Jan 355

Feb 326

Mar 371

Apr 375

May 389

Jun 365

Jul 362

Aug 351

Sep 346

Oct 364

Nov 399

Dec 338

53

Example Answer

See answer sheet

54