1 Decomposition Method. 2 Types of Data Time series data: a sequence of observations measured over...

Post on 14-Dec-2015

220 views 0 download

Transcript of 1 Decomposition Method. 2 Types of Data Time series data: a sequence of observations measured over...

1

Decomposition Method

2

Types of Data

Time series data: a sequence of observations measured over time (usually at equally spaced intervals, e.g., weekly, monthly and annually). Examples of time series data include:Gross Domestic Product each quarter;annual rainfall;daily stock market index

Cross sectional data: data on one or more variables collected at the same point in time

3

Time Series vs Causal Modeling

Causal (regression) models: the investigator specifies some behavioural relationship and estimates the parameters using regression techniques;

Time series models: the investigator uses the past data of the target variable to forecast the present and future values of the variable

4

Time Series vs Causal Modeling

On the other hand, there are many cases when one cannot, or one prefers not to, build causal models:

1. insufficient information is known about the behavioural relationship;

2. lack of, or conflicting, theories;3. insufficient data on explanatory variables;4. expertise may be unavailable;5. time series models may be more accurate

5

Time Series vs Causal Modeling

Direct benefits of using time series models:1. Little storage capacity is needed;

2. some time series models are automatic in that user intervention is not required to update the forecasts each period;

3. some time series models are evolutionary in that the models adapt as new information is received;

6

Classical Decomposition of Time Series

Trend – does not necessarily imply a monotonically increasing or decreasing series but simply a lack of constant mean, though in practice, we often use a linear or quadratic function to predict the trend;

Cycle – refers to patterns or waves in the data that are repeated after approximately equal intervals with approximately equal intensity. For example, some economists believe that “business cycles” repeat themselves every 4 or 5 years;

7

Classical Decomposition of Time Series

Seasonal – refers to a cycle of one year duration;

Random (irregular) – refers to the (unpredictable) variation not covered by the above

8

Decomposition Method

Multiplicative Models

ttttt IRCLSNTRY

ttttt IRCLSNTRY

Additive Models

Find the estimates of these four components.

9

Examples:

(1) US Retail and Food Services Sales from 1996 Q1 to 2008 Q1

Multiplicative Decomposition

(2) Quarterly Number of Visitor Arrivals in Hong Kong from 2002 Q1 to 2008 Q1

Figure 2.1

Figure 2.2

10

Figure 2.1 US Retail Sales

Back

US Retail & Food Services Sales

0

50,000

100,000

150,000

200,000

250,000

300,000

350,000

400,000

450,000

500,000

Q1-

96

Q3-

96

Q1-

97

Q3-

97

Q1-

98

Q3-

98

Q1-

99

Q3-

99

Q1-

00

Q3-

00

Q1-

01

Q3-

01

Q1-

02

Q3-

02

Q1-

03

Q3-

03

Q1-

04

Q3-

04

Q1-

05

Q3-

05

Q1-

06

Q3-

06

Q1-

07

Q3-

07

Q1-

08

Time

Sal

es Y

(t)

(in

MN

US

$)

11

Figure 2.2 Visitor Arrivals

Number of Visitor Arrivals in Hong Kong

0

500000

1000000

1500000

2000000

2500000

3000000

Q1-

02

Q3-

02

Q1-

03

Q3-

03

Q1-

04

Q3-

04

Q1-

05

Q3-

05

Q1-

06

Q3-

06

Q1-

07

Q3-

07

Q1-

08

Time

Nu

mb

er o

f V

isit

ors

Y(t

)

12

Cycles are often difficult to identify with a short time series.

Classical decomposition typically combines cycles and trend as one entity:

tttt IRSNTCY

13

Illustration : Consider the following 4-year quarterly time series on sales volume:

Period (t) Year Quarter Sales

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

1

2

3

4

1

2

3

4

1

2

3

4

1

2

3

4

1

2

3

4

72

110

117

172

76

112

130

194

78

119

128

201

81

134

141

216

14

Figure 2.3

15

Step 1 : Estimation of seasonal component (SNt)

Yt = TCt SNt IRt

Moving Average

for periods 1 – 4

Moving Average

for periods 2 – 5

tt

tt IRTC

YNS

ˆ

75.1174

17211711072

75.1184

76172117110

16

Period (t) Year Quarter Sales MA (t)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

1

2

3

4

1

2

3

4

1

2

3

4

1

2

3

4

1

2

3

4

72

110

117

172

76

112

130

194

78

119

128

201

81

134

141

216

117.75

118.75

119.25

122.5

128

128.5

130.25

129.75

131.5

132.25

136

139.25

143

17

Assuming the average of the observations is also the median of the observations, the MA for periods 1 – 4, 2 – 5, 3 – 6 are centered at positions 2.5, 3.5 and 4.5 respectively.

18

To get an average centered at periods 3, 4, 5 etc. the means of two consecutive moving averages are calculated:

Centered Moving

Average for period 3

Centered Moving

Average for period 4

25.1182

75.11875.117

1192

25.11975.118

19

Period (t) Year Quarter Sales MA (t) CMA(t)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

1

2

3

4

1

2

3

4

1

2

3

4

1

2

3

4

1

2

3

4

72

110

117

172

76

112

130

194

78

119

128

201

81

134

141

216

117.75

118.75

119.25

122.5

128

128.5

130.25

129.75

131.5

132.25

136

139.25

143

118.25

119

120.875

125.25

128.25

129.375

130

130.625

131.875

134.125

137.625

141.125

20

Because the CMAt contains no seasonality and irregularity, the seasonal component may be estimated by

t

tt CMA

YNS ~

445.1119

172~

989.025.118

117~ example,For

4

3

NS

NS

21

Period (t)

Year

Quarter

Sales MA (t) CMA(t)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

1

2

3

4

1

2

3

4

1

2

3

4

1

2

3

4

1

2

3

4

72

110

117

172

76

112

130

194

78

119

128

201

81

134

141

216

117.75

118.75

119.25

122.5

128

128.5

130.25

129.75

131.5

132.25

136

139.25

143

118.25

119

120.875

125.25

128.25

129.375

130

130.625

131.875

134.125

137.625

141.125

0.989429175

1.445378151

0.628748707

0.894211577

1.013645224

1.499516908

0.6

0.911004785

0.970616114

1.49860205

0.588555858

0.949512843

)(~

tSN

22

After all have been computed, they are further averaged to eliminate irregularities in the series. We also adjust the seasonal indices so that they sum to the number of seasons in a year (i.e., 4 for quarterly data, 12 for monthly data). Why?)

stNS ~

23

Quarter Average

1 (0.628748707 + 0.6 + 0.588555858)/3=2 (0.894211577 + 0.911004785 + 0.949512843)/3=3 (0.989429175 + 1.013645224 + 0.970616114)/3=4 (1.445378151 + 1.499516908 + 1.49860205)/3=

Sum =

24

Step 2 : Estimation of Trend/Cycle

Define deseasonalized (or seasonally adjusted) series as

for example, D1 = 72/0.6063 = 118.7506

ttt NSYD ˆ

25

26

TCt may be estimated by regression using a linear trend:

where b0 and b1 are least squares estimates of

0 and 1 respectively.

,ˆˆ

3,2,1

10

10

tbbDCT

t

tD

tt

tt

27

EXCEL regression output :

tCT t 854638009.16997914.113ˆ

So,

28

For example,

4090674.117

2854638009.16997914.113ˆ

5544294.115

1854638009.16997914.113ˆ

2

1

CT

CT

29

30

Step 3 : Computation of fitted values and out-of-sample forecasts

5516.2124825.13740.143ˆ

0621.706063.05544.115ˆ

:fit sample-In

ˆˆˆ

16

1

Y

Y

NSCTY ttt

31

054.88

6063.02286.145

6063.017855.1670.113

ˆˆˆ171717

NSCTY

Out of sample forecast :

1796.135

9191.00833.147

9191.018855.1670.113

ˆˆˆ181818

NSCTY

32

33

Figure 2.4

34

Measuring Forecast Accuracy :

1) Mean Squared Error

forecast. of errors thebe ˆLet ttt YYe

MSERMSE

neMSEn

tt

1

2

MADRMAD

neMADn

tt

1

2) Mean Absolute Deviation

35

Method A Method B

et = – 2 – 4

1.5 0.7

–1 0.5

2.1 1.4

0.7 0.1

Method A : MSE = 2.43

MAD = 1.46

Method B : MSE = 3.742

MAD = 1.34

36

Naive Prediction

if U = 1 Forecasts produced are no better than naive forecast

U = 0 Forecasts produced perfect fit

The smaller the value of U, the better the forecasts.

nYY

nYYU

YY

tt

tt

tt

21

2

1

ˆ

ˆ

Theil’s u Statistics

37

MSE = 11.932 MAD = 2.892 Theil’s U = 0.0546

38

Out-of-Sample Forecasts

1) Expost forecast Prediction for the period in which actual

observations are available

2) Exante forecast Prediction for the period in which actual

observations are not available.

39

T1 T2 T3

estimation period (today)Time

“back” casting in-sample simulation

Ex-post forecast

Ex-ante forecast

40

Additive Decomposition

tttt IRSNTCY

Time Time

Trend Trend

YtYt

(Multiplicative Seasonality) (Additive Seasonality)

41

Multiplicative decomposition is used when the time series exhibits increasing or decreasing seasonal variation (Yt=TCt SNt IRt)

TCt SNt Yt Yt – Yt-1

Yr 1 Q1

Q2

Q3

Q4

11.5

13

14.5

16

1.5

0.5

0.8

1.2

17.25

6.5

11.6

19.2

–10.75

5.1

7.6

Yr 2 Q1

Q2

Q3

Q4

17.5

19

20.5

22

1.5

0.5

0.8

1.2

26.25

9.5

16.4

26.4

–16.75

6.9

10

42

Additive decomposition is used when the time series exhibits constant seasonal variation (Yt=TCt + SNt + IRt)

TCt SNt Yt Yt – Yt-1

Yr 1 Q1

Q2

Q3

Q4

11.5

13

14.5

16

1.8

–1

–1.5

0.7

13.3

12

13

16.7

–1.3

1

3.7

Yr 2 Q1

Q2

Q3

Q4

17.5

19

20.5

22

1.8

–1

–1.5

0.7

19.3

18

19

22.7

–1.3

1

3.7

43

Step 1 : Estimation of seasonal component (SNt)

Calculation of MAt and CMAt is the same as per multiplicative decomposition

Initial seasonal component may be estimated by

For example,

ttt CMAYNS ~

53119172~

25.125.118117~

4

3

NS

NS

44

Seasonal indices are averaged and adjusted so that they sum to zero (Why?)

45

46

Step 2 : Estimation of Trend/Cycle

Deseasonalized series is defined as

TCt may be estimated by regression as per multiplicative decomposition

ttt NSYD ˆ

47

i.e., Dt = o + 1t + t

and

Multiplicative decomposition

per asˆˆ10 tbbDCT tt

48

So,

and

For example,

and

tCT t 980637255.12270833.113ˆ

ttt NSCTY ˆˆˆ

2077206.115

1980637255.12270833.113ˆ1

CT

40563725.64

80208333.502077206.11151̂

Y

49

MSE = 27.911

MAD = 4.477