bf-07

26
Business Forecasting ECON2209 Slides 07 Lecturer: Minxian Yang BF-07 1 my, School of Economics, UNSW

Upload: jinglebelliez

Post on 16-Jan-2016

10 views

Category:

Documents


0 download

DESCRIPTION

slides

TRANSCRIPT

Page 1: BF-07

Business Forecasting ECON2209

Slides 07

Lecturer: Minxian Yang

BF-07 1 my, School of Economics, UNSW

Page 2: BF-07

Ch.8 Modelling Cycles

• Lecture Plan – Big picture:

– Estimation of ARMA models – Sampling distributions of estimators – Residual-based diagnostic checking – Model selection – Box-Jenkins methodology – I(1) and ARIMA model – Unit-root test

BF-07 my, School of Economics, UNSW 2

0)(E ,0 , ,1

===++= ∑=

++ t

p

kkttpttttt xsssxsmy

Page 3: BF-07

Ch.8 Modelling Cycles

Modelling Cycles (Ch.8 continued) • Estimation of ARMA models

– Given a sample {y1, y2,…, yT} and a model

task is to estimate (c, φ1,…, φp, θ1,…, θq, σ2). – Methods:

• Least Squares (LS), or • Maximum Likelihood (ML)

BF-07 my, School of Economics, UNSW 3

),,0(iidWN~

,2

1111

σε

εθεθεϕϕ

t

qtqttptptt yycy −−−− +++++++=

Page 4: BF-07

Ch.8 Modelling Cycles

• Estimation of ARMA models – OLS for pure AR modes

OLS of yt on {1, yt-1, yt-2,…, yt-p} produces the

estimators

eg. “ls y c y(-1) y(-2) y(-3) y(-4) y(-5) y(-6)”

BF-07 my, School of Economics, UNSW 4

tptptt yycy εϕϕ ++++= −− 11

},ˆ...,,ˆ,ˆ,ˆ{ 21 pc ϕϕϕ ).1/(SSRˆ 2 −−= pTσ

-0.8

-0.4

0.0

0.4

0.8

1.2

50 100 150 200 250 300 350 400 450 500

De-Trended log NYSE Volume: Y

Page 5: BF-07

Ch.8 Modelling Cycles

• Estimation of ARMA models – Nonlinear LS (for MA and ARMA models) Numerical minimisation (of SSR) is used to find

estimators. eg. ARMA(1,1):

• for given parameters values, we are able to compute

• numerical minimisation

BF-07 my, School of Economics, UNSW 5

1111 −− +++= tttt ycy εθεϕ

).3/(SSRˆ ),,,( minimises )ˆ,ˆ,ˆ( 21111 −= TcJc σθϕθϕ

.),,(

,,...,1for ,),1/( ,0

1

211

1111

100

∑=

−−

=−−−=−==

T

tt

tttt

cJ

Ttycycy

εθϕ

εθϕεϕε

Page 6: BF-07

Ch.8 Modelling Cycles

• Estimation of ARMA models eg. y = de-trended log NYSE volume AR(6): “ls y c ar(1) ar(2) ar(3) ar(4) ar(5) ar(6)” ARMA(3,1): “ls y c ar(1) ar(2) ar(3) ma(1)”

AR(6) ARMA(3,1)

BF-07 my, School of Economics, UNSW 6

-.8

-.4

.0

.4

.8

-0.8

-0.4

0.0

0.4

0.8

1.2

50 100 150 200 250 300 350 400 450 500

Residual Actual Fitted

Page 7: BF-07

Ch.8 Modelling Cycles

• Estimation of ARMA models – Maximum likelihood (ML) If the distribution of εt is know, then the joint

probability density (pdf) of Y ={y1, y2,…, yT} depends on parameters:

pdf (Y|parameters) = L(c,φ1,…,φp, θ1,…,θq, σ2), known as likelihood function. ML estimators maximise the likelihood of observing the sample:

BF-07 my, School of Economics, UNSW 7

)ˆ,ˆ,...,ˆ,ˆ,...,ˆ,ˆ( 211 σθθϕϕ qpc

),,...,,,...,,( maximise )ˆ,ˆ,...,ˆ,ˆ,...,ˆ,ˆ( 211

211 σθθφφσθθφφ qpqp cLc

Page 8: BF-07

Ch.8 Modelling Cycles

• Sampling distribution of estimators – When the ARMA model is the “data generating

process” and “well-defined”, ie, stationary, invertible, without common roots, the distribution of a LS (or ML) estimator is

approximately normal with the mean being the true parameter.

– The standard deviations of the sampling distributions are routinely estimated and reported by software, useful for inference. These are known as standard errors.

BF-07 my, School of Economics, UNSW 8

Page 9: BF-07

Ch.8 Modelling Cycles

• Diagnostic checking – The disturbance term of an ARMA model is a WN. – The residual series should resemble a WN process

when the model is correct. – We may check the model by looking into the

properties of the residual series. • Estimate the model and save the residuals; • Check if the residual series is autocorrelated, using

ACF/PACF/Q-statistic; (most important!) • Check if the residual series follow a normal distribution; • Check if the residual series is homoskedastic.

BF-07 my, School of Economics, UNSW 9

Page 10: BF-07

Ch.8 Modelling Cycles

• Diagnostic checking eg. y = de-trended log NYSE volume, ARMA(3,1)

BF-07 my, School of Economics, UNSW 10

-.8

-.4

.0

.4

.8

-0.8

-0.4

0.0

0.4

0.8

1.2

50 100 150 200 250 300 350 400 450 500

Residual Actual Fitted

ls y c ar(1) ar(2) ar(3) ma(1)

genr r=resid

r.correl(16)

r.hist 0

10

20

30

40

50

60

70

80

-0.6 -0.4 -0.2 -0.0 0.2 0.4 0.6

Series: RSample 1 542Observations 542

Mean 0.002639Median -0.006398Maximum 0.612514Minimum -0.559038Std. Dev. 0.173672Skewness 0.188544Kurtosis 3.428545

Jarque-Bera 7.358715Probability 0.025239

Page 11: BF-07

Ch.8 Modelling Cycles

• Model selection: determining (p, q) – Specify upper limits for (p, q): – Estimate all models within the limits. – Choose the model with smallest AIC (or SIC).

e.g. y = de-trended log NYSE volume AR(6): AIC = -0.681, SIC = -0.625. ARMA(3,1): AIC = -0.669, SIC = -0.629.

BF-07 my, School of Economics, UNSW 11

).,( qp

Page 12: BF-07

Ch.8 Modelling Cycles

• Box-Jenkins methodology – Transform data (log, de-trend, difference) to

achieve stationarity. – Analyse sample ACF and PACF to determine the

range of possible values for (p, q): – Select (by AIC/SIC) and estimate the preferred

model. – Perform diagnostic checks for model mis-

specifications. (check residual autocorrelation)

BF-07 my, School of Economics, UNSW 12

).,(~)0,0( qp

Page 13: BF-07

Ch.8 Modelling Cycles

• Box-Jenkins methodology eg. Monthly trade volume on NYSE (542 obs)

BF-07 my, School of Economics, UNSW 13

-0.8

-0.4

0.0

0.4

0.8

1.2

2

4

6

8

10

100 200 300 400 500

Residual Actual Fitted

2

3

4

5

6

7

8

9

100 200 300 400 500

log Volume of Traded Shares

0

1000

2000

3000

4000

5000

6000

7000

100 200 300 400 500

Monthly Volume of Traded Shares

Page 14: BF-07

Ch.8 Modelling Cycles

• Box-Jenkins methodology eg. Monthly trade volume on NYSE (continued)

BF-07 my, School of Economics, UNSW 14

)2,6(),( :limitsUpper =qp

AIC AR(0) – AR(6) MA(0) 0.358362 -0.565285 -0.627646 -0.651777 -0.647759 -0.684042 -0.680790 MA(1) -0.168189 -0.655354 -0.659467 -0.673476 -0.669982 -0.680432 -0.683356 MA(2) -0.290038 -0.658328 -0.676644 -0.672377 -0.652947 -0.688101 -0.684540

SIC AR(0) – AR(6) MA(0) 0.366287 -0.549413 -0.603804 -0.619942 -0.607909 -0.636153 -0.624841 MA(1) -0.152339 -0.631545 -0.627677 -0.633683 -0.622162 -0.624562 -0.619414 MA(2) -0.266264 -0.626584 -0.636907 -0.624625 -0.597157 -0.624250 -0.612605

AIC selects ARMA(5,2). SIC selects ARMA(2,2).

Page 15: BF-07

Ch.8 Modelling Cycles

• Box-Jenkins methodology eg. Monthly trade volume on NYSE (continued)

ARMA(5,2)

BF-07 my, School of Economics, UNSW 15

Page 16: BF-07

Ch.8 Modelling Cycles

• Box-Jenkins methodology eg. Monthly trade volume on NYSE (continued)

ARMA(2,2)

BF-07 my, School of Economics, UNSW 16

See page 25 for adjustment for the df of residual Q-stat.

Page 17: BF-07

Ch.8 Modelling Cycles

• Box-Jenkins methodology eg. Monthly trade volume on NYSE (continued)

BF-07 my, School of Economics, UNSW 17

0

10

20

30

40

50

60

70

80

-0.4 -0.2 -0.0 0.2 0.4 0.6

Series: R2Sample 1 542Observations 537

Mean -0.000163Median -0.001764Maximum 0.609180Minimum -0.518390Std. Dev. 0.169152Skewness 0.202234Kurtosis 3.399331

Jarque-Bera 7.228466Probability 0.026938

0

10

20

30

40

50

60

70

80

-0.6 -0.4 -0.2 -0.0 0.2 0.4

Series: R3Sample 1 542Observations 540

Mean -0.000131Median -0.001734Maximum 0.546640Minimum -0.572969Std. Dev. 0.171085Skewness 0.112998Kurtosis 3.387056

Jarque-Bera 4.519945Probability 0.104353

ARMA(5,2) residuals

ARMA(2,2) residuals

But two models use different sample

sizes?

Page 18: BF-07

Ch.8 Modelling Cycles

BF-07 my, School of Economics, UNSW 18

'Could be saved in “nyse_vol2.prg” 'File/Open/Program…/Open 'Run wfcreate(wf=nyse_vol) u 542 read nyse_vol.dat fsvol genr y=log(fsvol) plot fsvol plot y 'Detrend genr time=@trend(1) equation eq1.ls y c time genr x=resid plot x x.correl(18) 'Find AIC and SIC matrix(3,7) aic matrix(3,7) sic 'Record AIC/SIC for 'RARMA(0,0) to ARMA(6,2) 'Here is only one example for ARMA(2,1) ls x c ar(1) ar(2) ma(1) aic(2,3)=@aic sic(2,3)=@schwarz 'Estimate preferred and check AC in residuals equation eq2.ls x c ar(1) ar(2) ar(3) ar(4) ar(5) _ ma(1) ma(2) eq2.makeresids r2 r2.correl(18) equation eq3.ls x c ar(1) ar(2) ma(1) ma(2) eq3.makeresids r3 r3.correl(18) stop

Insert smpl 7 542 to make comparison “fair”.

Page 19: BF-07

Ch.8 Modelling Cycles

• ARIMA models – Many economic time series are I(1), “integrated of order 1”:

• the series itself, yt, is non-stationary, but • its difference, Δyt = yt – yt-1, is stationary.

eg. log of GDP, log exchange rates, log share prices

– When Δyt is a stationary invertible ARMA(p, q) process, we say that yt is an ARIMA(p, 1, q) process.

– Note the difference operator: Δ = 1 – L BF-07 my, School of Economics, UNSW 19

Page 20: BF-07

Ch.8 Modelling Cycles

• ARIMA models – If yt is ARIMA, there is a unit-root in its AR

polynomial.

– Important to check whether or not a time series is I(1) or has a unit-root.

BF-07 my, School of Economics, UNSW 20

circle.unit theoutside are )( and )( of roots The

)()( :),ARMA( is

LL

LyLqpy ttt

ΘΦ

Θ=∆Φ∆ ε

root. a is 1, unit, theand )1)(( is polynomial AR Its

)()1)(( :satisfies

LL

LyLLy ttt

−Φ

Θ=−Φ ε

Page 21: BF-07

Ch.8 Modelling Cycles

• Augmented Dickey-Fuller test – Unit-root test: Is yt I(1)?

• H0: yt is I(1) (there is a unit-root) vs H1: yt is stationary. • Test statistic: ADF = t-statistic on yt-1, in the OLS regression of Δyt on [yt-1, Δyt-1, …, Δyt-K, 1, t]. • Decision rule: reject H0 if ADF < Dickey-Fuller critical

value. eg. y = de-trended log NYSE volume

BF-07 my, School of Economics, UNSW 21

y.uroot(trend)

selected by SIC

Page 22: BF-07

Ch.8 Modelling Cycles

• Augmented Dickey-Fuller test – If yt is I(1), an ARMA model is built for the

difference Δyt .

– Other wise, an ARMA model is built for level yt.

BF-07 my, School of Economics, UNSW 22

Page 23: BF-07

Ch.8 Modelling Cycles

• Augmented Dickey-Fuller test eg. y = log(Yen/$US), monthly 1973:01- 1996:07

BF-07 my, School of Economics, UNSW 23

-.10

-.05

.00

.05

.10

74 76 78 80 82 84 86 88 90 92 94 96

DLYEN

4.4

4.6

4.8

5.0

5.2

5.4

5.6

5.8

74 76 78 80 82 84 86 88 90 92 94 96

LYEN

Page 24: BF-07

Ch.8 Modelling Cycles

• Augmented Dickey-Fuller test eg. y = log(Yen/$US), monthly 1973:01- 1996:07 (continued)

BF-07 my, School of Economics, UNSW 24

A unit-root cannot be rejected for yt. A stationary AR may be build for Δyt.

Page 25: BF-07

Ch.8 Modelling Cycles

• EViews – Adjustment for the df of Q-stat: adjusted df = original df – p – q

BF-07 my, School of Economics, UNSW 25

'exch1.prg wfcreate(wf=null) m 1973.01 1996.07 smpl 1973.01 1996.07 genr time=@trend(1973.01) read exch.dat date yen dm genr lyen=log(yen) genr dlyen=dlog(yen) freeze lyen.line lyen.correl(12) freeze dlyen.line dlyen.correl(12) 'Unit root test lyen.uroot(trend) 'AR(1) model equation eqn1.ls d(lyen) c ar(1) eqn1.makeresid r1 eqn1.correl(12) 'MA(1) model equation eqn2.ls d(lyen) c MA(1) eqn2.makeresid r2 eqn2.correl(12) stop

These commands take care of the adjustment for the df of residual Q-stat.

Week 9 Test covers topics up to this page, emphasising Topics 7 and 8 (ie, Chapters 7-8).

• Concepts/principles • Simple stat algebra (mean, var, etc)

Page 26: BF-07

Ch.8 Modelling Cycles

• Summary – How are ARMA models estimated? Can OLS be

used to estimated MA models? – What are the sampling distributions of LS

estimators? – Why do we check models by looking into residual

series? – How do we select (p, q)? – What is Box-Jenkins methodology? – What is the purpose of augmented DF test?

BF-07 my, School of Economics, UNSW 26