GRS Hasnain Econometrics

49
PRESENTATION FOR GRADUATE RESEARCH SEMINAR Vector Auto Regression and Vector Error Correction Models By Muhammad Hasnain Yousaf* *Student of MS Economics at IBA Karachi Can be reached at [email protected]

Transcript of GRS Hasnain Econometrics

Page 1: GRS Hasnain Econometrics

PRESENTATION FOR GRADUATE

RESEARCH SEMINAR

Vector Auto Regression and Vector Error

Correction Models

By Muhammad Hasnain Yousaf*

*Student of MS Economics at IBA Karachi Can be reached at [email protected]

Page 2: GRS Hasnain Econometrics

TYPE OF DATA

Cross Sectional Data (t=1, N>1)

GDP growth rates of all the countries for 2011

Inflation for 110 countries for 2009 etc

Panel Data (t>1, N>1)

A merger of Cross Sections over time

Mirco Panels, Macro Panels and Pooled Panels (Not

related to today’s presentation)

Time Series (t>30, N≥1)

GDP data for Pakistan from 1970-2011 etc

Page 3: GRS Hasnain Econometrics

TIME SERIES ECONOMETRICS-METHODOLOGIES

Univariate TS

ARMA

ARMIA

AR(MA)CH

GAR(MA)CH

Multivariate TS

OLS (or OLS with Dummies)

Error Correction Models

MV with AR

Vector Auto Regression

Structural Vector Auto Regression (SVAR)

Vector Error Correction Models

Page 4: GRS Hasnain Econometrics

VECTOR AR- ADVANTAGES

Performs both Multivariate as well as Univariate

Analysis at the same time.

Inspects the variables for both autoregressive as well

as multivariate relationship.

Checks for Direction of Causality

Helps in Forecasting

Helps in determining the impact of Shocks on a

variable

Page 5: GRS Hasnain Econometrics

VECTOR AUTO REGRESSION SYSTEM

For example we are given three variables

(suppose Gold Holdings, Reserve Money and

Broad Money), the proposed dVAR system would

be

Page 6: GRS Hasnain Econometrics

THINGS TO DO BEFORE PERFORMING VAR

ANALYSIS

Check for stationary

ADF Test

Phillip Perron Test

If the |Zc|>|Zt| or P(Zc)<0.05 in ADF or PP, the

variable is stationary

Unit-Root is the Null hypothesis whereas stationarity

is Alternative (Unit-Root philosophy is not today’s

discussion)

If the Variables are not stationary

Make them stationary either by

Differencing (Mean or w r t lag whichever suits the

purpose)

Applying a de-trending filter

Page 7: GRS Hasnain Econometrics

VECTOR ERROR CORRECTION MODEL

VEC is an alternative approach to VAR

Also helps in determining the relationship

between the variables

However with different pre-requisits

Page 8: GRS Hasnain Econometrics

VEC- PHILOSOPHY

What is Stationarity?

Three Moments

Mean

Variance

Covariance

If TS is not stationary then we have to calculate

N means

N variances

N-1 Covariance's

Comparative statistics and Regression results would not be

meaningful

Page 9: GRS Hasnain Econometrics

VEC- PHILOSOPHY VISUAL DETECTION

1980m

11985m

11990m

11995m

12000m

12005m

1

t

1980m1 1985m1 1990m1 1995m1 2000m1 2005m1t

-1-.

50

.51

1.5

Resid

uals

1980m1 1985m1 1990m1 1995m1 2000m1 2005m1t

Non Stationary Variable Stationary Variable

Page 10: GRS Hasnain Econometrics

VEC- PHILOSOPHY

So is stationarity is the necessary condition?

Answer is given in table below

Dependent Variable Independent Variable Suitability for Regression

Stationary Stationary Yes

Stationary Non Stationary No

Non Stationary Stationary No

Non Stationary Non Stationary Check for

Cointegration

Page 11: GRS Hasnain Econometrics

VEC- SYSTEM

Yt = α + βxt1 +φx2t+ηx3t +εˆ+μt where ε~I (0)

Here x1,x2 and x3 determine short term

relationships where as ε is the long term relationship

which is determined as

εˆ= Yt- α -βxt1 - φx2t - ηx3t

Furthermore, ε is a mean reverting process

X1,X2 and X3 are co-integrated by an order of

rank “r” (where r=1,2,3,….,n)

r=0 means no co integration.

Page 12: GRS Hasnain Econometrics

VAR AND VEC IN STATA

Comprehensive package available for both

methodologies

But for people who are not addicted to STATA

,EViews is more user friendly yet equally

comprehensive tool.

Page 13: GRS Hasnain Econometrics

AN EXAMPLE FOR APPLICATION

I will use the unemployment rate for 5 US states

from Jan 1978 to Dec 2003

Tennessee

Missouri

Illinois

Indiana

Arkansas

Page 14: GRS Hasnain Econometrics

VECTOR AUTO REGRESSION ANALYSIS

Firstly declare the time variable using tsset

command (the following result will appear)

The visually check for stationary using tsline

command and a nice graph will appear

24

68

10

12

1980m1 1985m1 1990m1 1995m1 2000m1 2005m1t

arkansas illinois

indiana kentucky

missouri tenn

Page 15: GRS Hasnain Econometrics

VECTOR AUTO REGRESSION ANALYSIS

Apparently unemployment rates appear to follow

a mean reverting path which is obvious since it is

a cyclical variable than a stock one (discussion on

cyclical and stock variables is also not today’s

agenda). However, we will use tests for

stationarity before making any decision.

Page 16: GRS Hasnain Econometrics

VECTOR AUTO REGRESSION ANALYSIS

Stationarity can be checked by using dfuller

(ADF) or pperron (PP) command in stata (I will

use the loop to perform the tests on all variables

at once)

Surprise, Surprise!

None of the variables turned out to be stationary

Next Slides contain results of ADF as well as PP test

Page 17: GRS Hasnain Econometrics
Page 18: GRS Hasnain Econometrics
Page 19: GRS Hasnain Econometrics

VECTOR AUTO REGRESSION ANALYSIS

Now I will difference the variables (again using a

loop)

And again plotting them, another nice looking

graph appears

-2-1

01

2

1980m1 1985m1 1990m1 1995m1 2000m1 2005m1t

darkansas dillinois

dindiana dkentucky

dmissouri dtenn

Page 20: GRS Hasnain Econometrics

VECTOR AUTO REGRESSION ANALYSIS

Now running ADF and PP are yielding results favoring stationary

I am excluding the results since they will consume two more slides (which I don’t wana do!)

So since we have made the variable stationary, It’s time to apply the VAR

I will run trivariate VAR on Illinois, Indiana and Missouri

The STATA uses var command to apply VAR methodology to selected variables

var (variable1) (variable2) (variable3), lags(1/n) There is no dependent variable since var usese each one of

these as both dependent and independent variable

n means how much maximum lags do you want (I use 5 for quarterly, 12 for monthly and 2 for annual)

Page 21: GRS Hasnain Econometrics

VECTOR AUTO REGRESSION ANALYSIS

var dmissouri dindiana dillinois, lags(1/10) and a

long result will appear

Page 22: GRS Hasnain Econometrics

THINGS TO CHECK

The sign and significance of relationships

Page 23: GRS Hasnain Econometrics

SELECTION ORDER CRITERION

I ran 10 lags in VAR

But do they yeild better model?

Will use Selection Order Criteria for that

STATA uses varsoc command for that. Running

varsoc command will bring this table up

Page 24: GRS Hasnain Econometrics

SELECTION ORDER CRITERION

To select the appropriate lag see where the most

stars are

2 criteria are minimized at 1st lag

2 criteria are minimized at 4th lag

1 criterion is minimized at 9th lag

I will use a conservative approach and use 4 lags in

my VAR structure since uptil 4 lags 4 criteria have

been minimized.

Page 25: GRS Hasnain Econometrics

CHECKING STABILITY AND CAUSALITY

Now I will run the VAR till 4th lag and test for

both stability and Causality

STATA uses varstable and vargranger commands

for checking stability and causality respectively.

Page 26: GRS Hasnain Econometrics

STABILITY

Since all the roots are contained within the circle,

VAR is stable (use varstable,graph command to

get this sweet li’l graph)-1

-.5

0.5

1

Imagin

ary

-1 -.5 0 .5 1Real

Roots of the companion matrix

Page 27: GRS Hasnain Econometrics

AN IMPORTANT PICTURE BEFORE RUNNING

GRANGER CAUSALITY

Page 28: GRS Hasnain Econometrics

NOW CHECKING CAUSALITY

Use vargranger command to check granger

causality

Granger causality Wald tests

Equation Excluded chi2 df Prob>chi2

--------------------------------------+---------------------------

Changes in Umeployment in Missouri Changes in Umeployment in Indiana 9.3279 4 0.053

do Changes in Umeployment in Illinois 3.6623 4 0.454

do ALL 16.551 8 0.035

--------------------------------------+---------------------------

Changes in Umeployment in Indiana Changes in Umeployment in Missouri 6.7434 4 0.15

do Changes in Umeployment in Illinois 12.975 4 0.011

do ALL 19.425 8 0.013

--------------------------------------+---------------------------

Changes in Umeployment in Illinois Changes in Umeployment in Missouri 19.416 4 0.001

do Changes in Umeployment in Indiana 18.276 4 0.001

do ALL 42.729 8 0

Page 29: GRS Hasnain Econometrics

RESULTS

Changes in unemployment in Indiana are

affected by Changes in unemployment in

Missouri

Changes in unemployment in Illinois are affected

by both changes in unemployment in Indiana and

Changes in unemployment in Missouri

Lets revisit the slide 27 again and see if these

results make sense

Page 30: GRS Hasnain Econometrics

IMPULSE RESPONSE FUNCTION

IRF determines the impact of a shock in one

variable on other

Use irf command in STATA (my office STATA does

not store irf files so I cant display the output on given

problem)

Use “irf set result” (result is the file name) to create

an IRF file

Can create both tables and graphs by using

irf table irf, noci

irf graph irf, noci (for graph)

Page 31: GRS Hasnain Econometrics

IMPULSE RESPONSE FUNCTION

A demo output in table form would be

Page 32: GRS Hasnain Econometrics

FORECASTING

Suppose I want to predict the changes in

umeployment for next two years (24 Months).

STATA uses “fcast” command

fcast compute m1_, step(24)

And then use fcast graph m1_dmissouri

m1_dindiana m1_dillinois to graph the forecasts

Page 33: GRS Hasnain Econometrics

FORECASTING

-.4

-.2

0.2

.4

-.5

0.5

-.5

0.5

2004m1 2004m7 2005m1 2005m7 2006m1

2004m1 2004m7 2005m1 2005m7 2006m1

Forecast for dmissouri Forecast for dindiana

Forecast for dillinois

95% CI forecast

Page 34: GRS Hasnain Econometrics

VEC MODELS

Lets See if VEC Model give us any different

results.

Stationarity is not necessary in VEC

But Cointegration IS!

Page 35: GRS Hasnain Econometrics

A VEC SYSTEM OF THREE VARIABLES

Page 36: GRS Hasnain Econometrics

CHECKING FOR COINTEGRATION

Regress the variables (dependent-independent

choice doesn’t make much difference)

Simple Mathod

Use simple “regress” or “reg” command in stata

Predict the residuals

Check for stationarity

Check for autocorrelation

If 1st one is present and second one is absent, the

variables are cointegrated, if not, then they are not

Johansen’s cointegration test

Page 37: GRS Hasnain Econometrics

RESIDUAL TESTING

-1-.

50

.51

1.5

Resid

uals

1980m1 1985m1 1990m1 1995m1 2000m1 2005m1t

-1-.

50

.51

1.5

Resid

uals

-1 -.5 0 .5 1 1.5Residuals, L

Residuals Graph Auto-Correlation Graph

Page 38: GRS Hasnain Econometrics

RESIDUAL TESTING

Page 39: GRS Hasnain Econometrics

RESIDUAL TESTING- RESULTS

Residuals are stationary

Residuals are Autocorrelative

No co-integration

Step to Seeking Confirmation by Johansen’s

cointegration test

Page 40: GRS Hasnain Econometrics

JOHANSEN’S COINTEGRATION TEST

STATA uses “vecrank” command

We cannot reject the Null Hypothesis that

Variables are co-integrated by the rank of 2

So a cointegration relationship of rank 2 exists

between the variables

Page 41: GRS Hasnain Econometrics

RUNNING VEC IN STATA

Use command « vec missouri indiana illinois,

rank(2) lags(4) »

Page 42: GRS Hasnain Econometrics

RUNNING VEC IN STATA

Further taking a restricted view out of output

produced by STATA

Page 43: GRS Hasnain Econometrics

INFERENCES

The two speeds of adjustment Messouri are:

α11= -0.079 and 0.041

The first equilbrium relationship is Missouri -

078 Illinois -0.43.

The second is Indiana -1.32 Illinois +2.98

Illinois is affected by both Missouri and Indiana.

But Missouri is not affected by Indiana

Page 44: GRS Hasnain Econometrics

RUNNING VEC IN STATA

To check which market is more affected by long

term changes i.e. ce-1and ce-2 add an option of

“alpha” to vec command

Page 45: GRS Hasnain Econometrics

ADDITIONAL INFORMATION

We can see that Missouri gets more affected by

long terms changes in umeployment.

Illinois has positive shock from both long-term

adjustment terms.

Page 46: GRS Hasnain Econometrics

STABILITY

STATA uses “vecstable” command

VEC imposes a condition of 1 to avoid unstability

You can add “graph” option to command to get this

graph-1

-.5

0.5

1

Imagin

ary

-1 -.5 0 .5 1Real

The VECM specification imposes 1 unit modulus

Roots of the companion matrix

Page 47: GRS Hasnain Econometrics

FORECASTING

Again I will use a forecast of 24 months

Commands are the same

34

56

7

24

68

46

81

0

2004m1 2004m7 2005m1 2005m7 2006m1

2004m1 2004m7 2005m1 2005m7 2006m1

Forecast for missouri Forecast for indiana

Forecast for illinois

95% CI forecast

Page 48: GRS Hasnain Econometrics

QUESTIONS, COMMENTS, SUGGESTIONS OR

FEEDBACK???

Page 49: GRS Hasnain Econometrics

THANK YOU VERY MUCH!