1 ka-fu wong university of hong kong modeling and forecasting seasonality

Post on 17-Jan-2016

218 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

1

Ka-fu WongUniversity of Hong Kong

Modeling and Forecasting Seasonality

2

Unobserved components model of time series

According to the unobserved components model of a time series, the series yt has three components

yt = Tt + St + Ct

Time trend

Seasonal component

Cyclical component

3

Seaonality

Seasonality refers to the annual cyclical variation in a time series, which may due to weather patterns, holiday patterns, school calendar patterns, etc. Cyclical peaks in U.S. retail sales and

employment during the last quarter of each calendar year due to the holiday shopping season

Cyclical troughs in U.S. housing starts during the winter months of each calendar year due to weather patterns.

4

Gasoline sales in the United States

People tend to travel more in the summer.Sales = quantity x price.

5

Liquor Sales in the United States

People tend to drink more liquor during holiday seasons, e.g., Christmas.

6

Durable goods sales in the United States

People tend to spend on non-durables and less on durables during holiday seasons.

7

Electricity consumption (Terajoule)

0

4000

8000

12000

16000

20000

1970 1975 1980 1985 1990 1995 2000 2005

8

Electricity consumption (Terajoule)

8000

10000

12000

14000

16000

18000

20000

2000 2001 2002 2003 2004 2005 2006

9

Local Consumption of Gas

0

400

800

1200

1600

2000

2400

2800

1975 1980 1985 1990 1995 2000 2005

10

Total Restaurant receipts (millions HK$)

2000

4000

6000

8000

10000

12000

14000

16000

18000

84 86 88 90 92 94 96 98 00 02 04 06

11

Hong Kong interbank rate (Overnight and Six Month)

0

1

2

3

4

5

6

7

8

2000 2001 2002 2003 2004 2005 2006

OVERNIGHT SIXMTH

12

(Overnight – 6 month)

-1.5

-1.0

-0.5

0.0

0.5

1.0

1.5

2000 2001 2002 2003 2004 2005 2006

13

-8

-6

-4

-2

0

2

4

6

82 84 86 88 90 92 94 96 98 00 02 04 06

(Overnight – 6 month)

14

Trade weighted effective exchange rate (January 2000 = 100)

92

94

96

98

100

102

104

106

108

2001 2002 2003 2004 2005 2006

TRADEW IMPORTW EXPORTW

15

Hong Kong’s unadjusted Composite CPI

96

98

100

102

104

106

108

2000 2001 2002 2003 2004 2005 2006

16

Hong Kong’s unadjusted Composite CPI

50

60

70

80

90

100

110

120

1990 1992 1994 1996 1998 2000 2002 2004 2006

17

Hong Kong’s unadjusted Composite CPI

0

20

40

60

80

100

120

1975 1980 1985 1990 1995 2000 2005

18

Seasonal Adjustment

Most of the time series that you have selected for your study have been seasonally adjusted. That is,

tttSA Syy ˆ,

an estimate of the seasonal component of yt.

19

Why use seasonally adjusted data

Typically, our interest in a macroeconomic time series is in the information it provides about the overall state of the economy and the direction the economy is heading.

Suppose we did not seasonally adjust our data we observe a huge increase in retail sales during the

fourth quarter of 2005. Should we interpret this as a sign that the economy is suddenly booming? No, unless retail sales are growing by more than

normal for that part of the year. we observe a huge increase in the unemployment rate

during May/June of 2006 (after schools let out and there is a large temporary increase in the economy’s labor force). Should I interpret this as a sign that the economy and its labor market are suddenly deteriorating?No, unless the unemployment rate is increasing by

more than normal for that part of the year.

20

Why use seasonally adjusted data

Seasonally adjusted data are meant to smooth out the data, i.e., to remove the regular ups and downs that are associated with the seasonal cycle.

So, if seasonally adjusted retail sales increase during the fourth quarter or if the seasonally adjusted unemployment rate increases during May/June we can interpret these as movements beyond the movements that are part of the normal seasonal cycle.

21

Should use seasonally un-adjusted data?

There are many business forecasting settings where the seasonal component of the series is fundamentally important and seasonally adjusted data would be inadequate and inappropriate.

Some forecasters will be interested in predicting housing starts including the seasonal component. A bank may be interested in forecasting housing starts in

its area (or, if the bank is large enough, at a national level) in order to anticipate the demand for mortgage loans.

A business that provides building supplies to homebuilders may need to forecast housing starts to anticipate the demand for its products and make current inventory decisions.

In these cases, you would want to use seasonally unadjusted data, model the seasonality and forecast it, along with forecasts of the trend and cyclical components.

22

Should use seasonally un-adjusted data?

Would anyone be interested in predicting the number of birth by Hong Kong residents? Immigration Department Hospital Authority Private hospitals Restaurant owners

23

Modeling seasonal components as deterministic

Two approaches to modeling seasonality – deterministic seasonality and stochastic seasonality

The two approaches differ according to whether St is perfectly predictable or is subject to random disturbances.

We will assume that the seasonal component is deterministic.

24

Modeling seasonality with dummies

A straightforward and commonly used approach to modeling seasonality (which is, however, not the method government agencies typically use to seasonally adjust data) is to specify a seasonal dummy model.

25

Modeling quarterly seasonality with dummies

Suppose you are working with quarterly data and want to allow each quarter to have a distinct seasonal effect on the series.

ConsiderSt = 1D1t + 2D2t + 3D3t + 4D4t

where D1t = 1 if t = quarter 1, and 0 otherwise

D2t = 1 if t = quarter 2, and 0 otherwise

D3t = 1 if t = quarter 3, and 0 otherwise

D4t = 1 if t = quarter 4, and 0 otherwise

So, St = 1 if t = quarter 1,…, St = 4 if t = quarter 4.

26

Modeling quarterly seasonality with dummies

An equivalent model – St = 1 + 2D2t + 3D3t + 4D4t

where D2t = 1 if t = quarter 2, and 0 otherwise

D3t = 1 if t = quarter 3, and 0 otherwise

D4t = 1 if t = quarter 4, and 0 otherwise

So, St = 1 if t = quarter 1,…, St = 1 + 4 if t = quarter 4.

27

Modeling seasonality with dummies

Suppose you are working with monthly data and want to allow each month to have a distinct seasonal effect on the series.

Consider

St = 1D1t + 2D2t + … + 12D12t

where

Dit = 1 if t = month i, and 0 otherwise

{Or St = 1+ 2D2t + … + 12D12t}

For example, St = 1 if t = January (month 1),…, St = 12 if t = December (month 12).

28

Modeling seasonality with dummies

Suppose you are working with monthly data and want to allow each quarter to have a distinct seasonal effect on the series.

ConsiderSt = 1D1t + 2D2t + 3D3t + 4D4t

where Dit = 1 if month t is in i, and 0 otherwise

{Or St = 1 + 2D2t + 3D3t + 4D4t}

29

Modeling seasonality with dummies

Suppose you are working with data, say monthly data, and you think that there is only one month that is different from the other months. Say, for example, that the seasonality is the same for months 1-11 but is different from the seasonality for month 12-

St = 1D1t + 2D2t (or, St = 1 + 2D2t)where D1t = 1 if t is in month 1,2,…,11, and 0 if t is in month 12andD2t = 1 if t is in month 12 and 0 if t is in month 1,2,…,11

30

Modeling seasonality with dummies

Many monetary and financial time series are weekly or even daily (or hourly or…). if we are working with weekly or daily data we normally would not specify a separate seasonal for each week or day. We could, however, still allow for monthly or quarter seasonal variation in our weekly data. For example to allow for a monthly seasonal pattern in our weekly series:

St = 1D1t + 2D2t + … + 12D12t

Dit = 1 if week t falls in the month i, and 0 otherwise

31

Modeling seasonality with dummies

More generally, regardless of the frequency of the data (quarterly, monthly, weekly, …) we can divide the year up into s seasons and define the seasonal component according to

St = γ1D1t + γ2D2t + … + γsDst

Dit = 1 if observation t falls in annual period i, and 0 otherwise

32

Extensions

Suppose we are working with monthly data and we are allowing for quarterly seasonal variation but also want allow for a December effect – St = 1D1t + 2D2t + … + 4D4t + sDDECt

where DDECt =1 if t is a December, 0 otherwise.

Then, St = 1 for t = January, February, March

St = 2 for t = April, May, June

St = 3 for t = July, August, September

St = 4 for t = October and November

St = 4+ 5 for December.

33

Extensions

Dummies can be use to capture other seasonal variations holiday variation

Tourist/hotel occupancies trading-day variation

opening hours of the trading day closing hour of the trading dayJapanese lunch time in modeling forex movements

34

Trend and Seasonal components together

To estimate the seasonal model and the seasonal component of yt it is most straightforward if we detrend and deseasonalize simultaneously –

Let Tt = β0 + β1t + … + βptp

and St = 1 + 2D2t … + sDs,t

so that

yt = β0 + β1t + … + βptp + 1 + 2D2t … + sDs,t + εt

where εt is the cyclical component of yt.

35

Trend and Seasonal components together

Note that the model yt = β0 + β1t + … + βptp + 1 + 2D2t … + sDs,t + εt

has a redundant parameter, since it has two constants, β0

and γ1.

According to this model of trend and seasonality, the nature of the seasonality is that the intercept of the trend line differs for each season.

Eliminating 1 from the model has no consequence since the intercept for season 1 is accounted for by β0. So the model can be written

yt = β0 + β1t + … + βptp + 2D2t … + sDs,t + εt

36

Trend and Seasonal components together

Consider three models with trend and seasonal dummies:(1) yt = β0 + β1t + 1D1t+ 2D2t + εt

(2) yt = β0 + β1t + 2D2t + εt

(3) yt = β1t + 1D1t+ 2D2t + εt

Where D1t =1 when t falls in the first half of the year and 0 otherwise. D2t =1 when t falls in the second half of the year and 0 otherwise.

The expected seasonal effects from the three models are(1) (2) (3)

First half of the year β0 +1 β0 1

Second half of the year

β0 +2 β0 +2 2

Model (1) needs three parameters to obtain the seasonal effects of the two seasons.

37

Trend and Seasonal components together

Consider three models with trend and seasonal dummies:(1) yt = β0 + β1t + 1D1t+ 2D2t + εt

(2) yt = β0 + β1t + 2D2t + εt

(3) yt = β1t + 1D1t+ 2D2t + εt

Where D1t =1 when t falls in the first half of the year and 0 otherwise. D2t =1 when t falls in the second half of the year and 0 otherwise.

In estimation of (1), all statistical programs will return error (say, singular matrix encountered) because the variables included are perfectly colinear, or, some set of variables are linearly dependent.

Rewrite(1) yt = β0*1 + β1t + 1D1t+ 2D2t + εt

One can easily show that 1 = D1t + D2t, showing that the three numbers (1,D1t,D2t) really contain two pieces of independent information. Similar to “using two equations to solve three variables is impossible,” we cannot identify all the parameters in (1).

So, one of them has to be dropped – i.e., (2) or (3).

38

Trend and Seasonal components together

We can estimate the parameters of this model by OLS, regressing y on a constant, t,…,tp, D2t,…,Dst, for t = 1,…,T yielding:

tststp

pt DDtty ˆˆ...ˆˆ...ˆˆ2210

where the β-hats are the OLS estimates of the β’s and the ε-hats are the OLS residuals.

)ˆ...ˆˆ...ˆˆ(ˆ 2210 ststp

ptt DDtty and form the estimated cyclical component of the yt’s .

Question – After we have estimated this model, how would we test whether there is any seasonality in the original y series?

39

Forecasting yT+h

According to our model,yT+h = β0 + β1(T+h) + … + βp(T+h)p + 1 + 2D2,T+h +… + sDs,T+h + εT+h

and so our forecast of yT+h formed at time T will be:

ThThTsshTp

pThT DDhThTy ,,,2210, ˆˆ...ˆ)(ˆ...)(ˆˆˆ

where is our forecast of εT+h formed at time T.ThT ,ˆ

If the ε’s are i.i.d. with mean zero, then = 0 andThT ,ˆ

hTsshTp

pThT DDhThTy ,,2210, ˆ...ˆ)(ˆ...)(ˆˆˆ

40

Forecasting yT+h

If the ε’s are i.i.d. N(0,σ2) then, ignoring parameter uncertainty,

)1,0(ˆ

ˆ , Nyy ThThT

T

ttspT 1

22 ˆ)(

96.1ˆ , ThTy is a 95% forecast interval for yT+h

Hence:

41

Example: Forecasting Housing Starts

Housing Starts of the United States, 1946:01 – 1994:11

42

Example: Forecasting Housing Starts

Housing Starts of the United States, 1990:01 – 1994:11

43

Model monthly seasonality

44

Check the residuals

45

Estimated seasonal factors

46

Comparison of forecast and realization 1994:01 to 1994:11

47

Example: Forecasting Hong Kong’s port cargo throughput (thousand tonnes)

10000

20000

30000

40000

50000

60000

70000

97 98 99 00 01 02 03 04 05 06

LOADED DISCHARGED TOTAL

Data: http://www.censtatd.gov.hk/hong_kong_statistics/statistics_by_subject/index.jsp

48

Linear Trend only

Variable Coefficient Std. Error t-Statistic Prob.

C 38344.37 928.837 41.28213 0

TIME 517.6807 46.9733 11.02074 0

R-squared 0.786348 Mean dependent var 47144.94

Adjusted R-squared 0.779874 S.D. dependent var 5982.039

S.E. of regression 2806.63 Akaike info criteri 18.7728

Sum squared resid 2.60E+08 Schwarz criterion 18.86168

Log likelihood -326.524 F-statistic 121.4568

Durbin-Watson stat 1.027401 Prob(F-statistic) 0

49

Forecast based on a linear trend

35000

40000

45000

50000

55000

60000

65000

97 98 99 00 01 02 03 04 05 06

TOTALYHAT1

UPPER1LOWER1

50

Residual plot

-8000

-4000

0

4000

8000

35000

40000

45000

50000

55000

60000

1997 1998 1999 2000 2001 2002 2003 2004 2005

Residual Actual Fitted

51

Seasonal variation only

Variable Coefficient Std. Error t-Statistic Prob.

C 44395.89 2003.134 22.16322 0

D2 4081.333 2832.859 1.440712 0.1597

D3 3934.667 2832.859 1.388938 0.1747

D4 3009.111 2920.044 1.030502 0.3107

R-squared 0.079875 Mean dependent var 47144.94

Adjusted R-squared -0.00917 S.D. dependent var 5982.039

S.E. of regression 6009.402 Akaike info criteri 20.34725

Sum squared resid 1.12E+09 Schwarz criterion 20.525

Log likelihood -352.077 F-statistic 0.897025

Durbin-Watson stat 0.103033 Prob(F-statistic) 0.45375

52

Residual plot

-8000

-4000

0

4000

8000

12000

35000

40000

45000

50000

55000

60000

97 98 99 00 01 02 03 04 05

Residual Actual Fitted

53

Forecast based on seasonal variations

30000

35000

40000

45000

50000

55000

60000

65000

97 98 99 00 01 02 03 04 05 06

TOTALYHAT3

UPPER3LOWER3

54

Linear time trend and seasonal variations

Variable Coefficient Std. Error t-Statistic Prob.

C 36230.54 1089.544 33.25294 0

TIME 510.3345 42.71352 11.94784 0

D2 3570.999 1200.8 2.973851 0.0058

D3 2913.998 1203.076 2.422122 0.0217

D4 2498.777 1237.71 2.018871 0.0525

R-squared 0.840211 Mean dependent var 47144.94

Adjusted R-squared 0.818905 S.D. dependent var 5982.039

S.E. of regression 2545.669 Akaike info criteri 18.65374

Sum squared resid 1.94E+08 Schwarz criterion 18.87593

Log likelihood -321.44 F-statistic 39.43682

Durbin-Watson stat 0.48952 Prob(F-statistic) 0

55

Residual plots

-6000

-4000

-2000

0

2000

4000

6000

36000

40000

44000

48000

52000

56000

60000

1997 1998 1999 2000 2001 2002 2003 2004 2005

Residual Actual Fitted

56

Forecast based on linear time trend and seasonal variations

35000

40000

45000

50000

55000

60000

65000

97 98 99 00 01 02 03 04 05 06

TOTALYHAT2

UPPER2LOWER2

57

End

top related