18
Applied Econometrics Seminar 3 Time Series (ARIMA Modeling) Please note that for interactive manipulation you need Mathematica 6 version of this .pdf. Mathematica 6 will be available soon at all Lab's Computers at IES http://staff.utia.cas.cz/barunik Jozef Barunik ( barunik @ utia. cas . cz ) |

Seminar 3 - CASstaff.utia.cas.cz/barunik/files/appliedecono/Seminar3.pdf · 4 Seminar2.nb. AR(p) processes cont. Let us simulate AR processes up to p = 5, and see how does their ACFs

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Seminar 3 - CASstaff.utia.cas.cz/barunik/files/appliedecono/Seminar3.pdf · 4 Seminar2.nb. AR(p) processes cont. Let us simulate AR processes up to p = 5, and see how does their ACFs

Applied Econometrics

Seminar 3Time Series

(ARIMA Modeling)

Please note that for interactive manipulation you need Mathematica 6 version of this .pdf. Mathematica 6 will be available soon at all Lab's Computers at IES

http://staff.utia.cas.cz/barunikJozef Barunik ( barunik @ utia. cas . cz )

|

Page 2: Seminar 3 - CASstaff.utia.cas.cz/barunik/files/appliedecono/Seminar3.pdf · 4 Seminar2.nb. AR(p) processes cont. Let us simulate AR processes up to p = 5, and see how does their ACFs

A brief revision of last seminar

What is stationarity?

What is ACF?

How do we recognize if series are stationary? (visually, and formally)

What is the first step to find if there are any dependencies in the data?

|

2 Seminar2.nb

Page 3: Seminar 3 - CASstaff.utia.cas.cz/barunik/files/appliedecono/Seminar3.pdf · 4 Seminar2.nb. AR(p) processes cont. Let us simulate AR processes up to p = 5, and see how does their ACFs

Toady's seminar

We will briefly summarize AR processes, MA processes,

We will see how does the ACF and PACF of simulated series look like

We will try to fit ARIMA(p,d,q) on simulated series to get practice in modeling

We will fit ARIMA(p,d,q) on real-world series

We will forecast the series using our model, and discuss possible problems |

Seminar2.nb 3

Page 4: Seminar 3 - CASstaff.utia.cas.cz/barunik/files/appliedecono/Seminar3.pdf · 4 Seminar2.nb. AR(p) processes cont. Let us simulate AR processes up to p = 5, and see how does their ACFs

AR(p) processes

Simple autoregressive model of order p, or simply AR( ) model is represented by:

rt = f0 + ⁄i=1p fi rt-i + et

Note that § f1 + f2 + ... f p• must be less than 1, otherwise AR( ) would not be stationary (seeexample below)

ACF decayingsecond lag of PACF shows added contribution of rt-2 to rt over the AR(1) modelrt = f1 rt-1 + et , lag-3 PACF shows the added contribution of rt-3 to AR(2), and so on.

Thus we can identify AR( ) process with PACF function,

4 Seminar2.nb

Page 5: Seminar 3 - CASstaff.utia.cas.cz/barunik/files/appliedecono/Seminar3.pdf · 4 Seminar2.nb. AR(p) processes cont. Let us simulate AR processes up to p = 5, and see how does their ACFs

AR(p) processes cont.

Let us simulate AR processes up to p = 5, and see how does their ACFs and PACF look like

Out[27]=

Sample ARHpL ACF function PACF function

f0 0

f1 0.3

f2 0.5

f3 0

f4 0

f5 0

lag of ACF 30

New Random Case

5 10 15 20 25 30

-1.0

-0.5

0.5

1.0

|

Seminar2.nb 5

Page 6: Seminar 3 - CASstaff.utia.cas.cz/barunik/files/appliedecono/Seminar3.pdf · 4 Seminar2.nb. AR(p) processes cont. Let us simulate AR processes up to p = 5, and see how does their ACFs

Ma(q) processes

Simple Moving average model of order q, or MA( ) model is represented by:

rt = q0 + et + ⁄i=1q qi et-i,

process is always stationary !, ACF is helpful here, PACF decays

Examples of MA( ) artificial processes up to q = 5

Out[28]=

Sample MAH5L ACF function PACF function

q0 0

q1 0.61

q2 -0.73

q3 -0.205

q4 0.455

q5 0.44

lag of ACF 36

New Random Case

100 200 300 400 500

-4

-2

2

4

|

6 Seminar2.nb

Page 7: Seminar 3 - CASstaff.utia.cas.cz/barunik/files/appliedecono/Seminar3.pdf · 4 Seminar2.nb. AR(p) processes cont. Let us simulate AR processes up to p = 5, and see how does their ACFs

ARIMA(p,I,q) processes

A general ARMA( , ) model is in the form:

rt = f0 + ⁄i=1p fi rt-i + et - ⁄l =1

q qi et-l ,

ACFs and PACFs are only informative here, if the series are unit-root nonstationary, we have to difference them

if the D rt is described by stationary ARMA(p,q), we say rt is described by ARIMA(p,I,q) -Autoregressive Integrated moving Average

|

Seminar2.nb 7

Page 8: Seminar 3 - CASstaff.utia.cas.cz/barunik/files/appliedecono/Seminar3.pdf · 4 Seminar2.nb. AR(p) processes cont. Let us simulate AR processes up to p = 5, and see how does their ACFs

Examples of ARIMA( ,I, ) artificial processes

with this interactive form you can simulate any ARIMA(p,I,q) process, explore its ACF andPACF, and finally export the series

Sample ARIMAHp,d,qL ACF function PACF function

difference 0

p parameters 80.7, -0.5<

q parameters 80.6, 0.4<

New Random Case

Export Simulated Series

10 20 30 40

-1.0

-0.5

0.5

1.0process is unit-root stationary

|

8 Seminar2.nb

Page 9: Seminar 3 - CASstaff.utia.cas.cz/barunik/files/appliedecono/Seminar3.pdf · 4 Seminar2.nb. AR(p) processes cont. Let us simulate AR processes up to p = 5, and see how does their ACFs

Fitting ARIMA to data

Now we know enough about processes, so let's open JMulti, and fit the models to the data

load arima_simulated.txt

now we will try to find out the best model to describe the data.

FIRST STEP:

Is the process stationary? (visually,formal tests, do you remember which?? )if we first-difference, do we confirm stationarity ???

|

Seminar2.nb 9

Page 10: Seminar 3 - CASstaff.utia.cas.cz/barunik/files/appliedecono/Seminar3.pdf · 4 Seminar2.nb. AR(p) processes cont. Let us simulate AR processes up to p = 5, and see how does their ACFs

Fitting ARIMA to data - check ACF, PACF

So now we have intergated series, and we suppose it follows ARIMA(p,1,q), where 1 means -differenced once.Let's look at ACFs and PACFs. Do you already know what p and q we use ???

|

10 Seminar2.nb

Page 11: Seminar 3 - CASstaff.utia.cas.cz/barunik/files/appliedecono/Seminar3.pdf · 4 Seminar2.nb. AR(p) processes cont. Let us simulate AR processes up to p = 5, and see how does their ACFs

Fitting ARIMA to data - find best p,q

We suspect dependencies, maybe first 3 lags of AR and MA also (according to ACF, PACF)let's do the regression, and find out the best model according to:

- start with simple model (e.g. AR(1) )- according to lowest AIC, BIC information criteria, parsimony- according to ACF and PACF of residuals

for the best model, ACF and PACF of RESIDUALS should not reveal any dependencies in thedata

|

Seminar2.nb 11

Page 12: Seminar 3 - CASstaff.utia.cas.cz/barunik/files/appliedecono/Seminar3.pdf · 4 Seminar2.nb. AR(p) processes cont. Let us simulate AR processes up to p = 5, and see how does their ACFs

Fitting ARIMA to data - look at residuals

we can see that residuals of our fiited ARIMA(3,1,2) model does not contain any further depen-dencies, so we have right model, and we can use it to forecast the series

|

12 Seminar2.nb

Page 13: Seminar 3 - CASstaff.utia.cas.cz/barunik/files/appliedecono/Seminar3.pdf · 4 Seminar2.nb. AR(p) processes cont. Let us simulate AR processes up to p = 5, and see how does their ACFs

Fitting ARIMA to data - Forecasting

One of the main reasons why we model time series, is to forecast them, let's forecast our simu-lated series.Forecast is done iteratively (see lecture), JMulti has very intuitive forecasting, forecast of theseries with ARIMA(3,1,2) estimated model is:

|

Seminar2.nb 13

Page 14: Seminar 3 - CASstaff.utia.cas.cz/barunik/files/appliedecono/Seminar3.pdf · 4 Seminar2.nb. AR(p) processes cont. Let us simulate AR processes up to p = 5, and see how does their ACFs

Fitting ARIMA to data - Forecasting

Let's try what happens if we forecast long run (t+50)any ideas why is it?

well, look at the equations, and you find out, that forecasts converges to the mean|

14 Seminar2.nb

Page 15: Seminar 3 - CASstaff.utia.cas.cz/barunik/files/appliedecono/Seminar3.pdf · 4 Seminar2.nb. AR(p) processes cont. Let us simulate AR processes up to p = 5, and see how does their ACFs

Example on real-world series: PX-50 index 1998-2008

Let's load the dataset, and repeat whole procedure1) difference to gain stationarity, and look at ACFs and PACFs

|

Seminar2.nb 15

Page 16: Seminar 3 - CASstaff.utia.cas.cz/barunik/files/appliedecono/Seminar3.pdf · 4 Seminar2.nb. AR(p) processes cont. Let us simulate AR processes up to p = 5, and see how does their ACFs

Example on real-world series: PX-50 index 1998-2008

we suspect AR(1) process, so we confirm formally and look at the ACFs and PACFs whichdoes seem to have any other strong dependencies,

BUT let's look at residuals if we find something wrong

|

16 Seminar2.nb

Page 17: Seminar 3 - CASstaff.utia.cas.cz/barunik/files/appliedecono/Seminar3.pdf · 4 Seminar2.nb. AR(p) processes cont. Let us simulate AR processes up to p = 5, and see how does their ACFs

Example on real-world series: PX-50 index 1998-2008

Can anyone say, what is wrong whith residuals of fitted ARIMA(1,1,0) to the PX returns???Why We can not use them fo forecasting?

|

Seminar2.nb 17

Page 18: Seminar 3 - CASstaff.utia.cas.cz/barunik/files/appliedecono/Seminar3.pdf · 4 Seminar2.nb. AR(p) processes cont. Let us simulate AR processes up to p = 5, and see how does their ACFs

Example on real-world series: PX-50 index 1998-2008

Thus we can not really use the model to forecast the data as it contains visible heteroscedasticity

Wait until next lesson, where we will learn how to deal with this problem

Thank you very much for your attention !|

18 Seminar2.nb