Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
100% found this document useful (1 vote)
94 views69 pages

Introduction To Vars and Structural Vars:: Estimation & Tests Using Stata

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 69

Introduction to VARs

and Structural VARs:

Estimation & Tests Using Stata

Bar-Ilan University 26/5/2009


Avichai Snir
Background: VAR
• Background:
• Structural simultaneous equations
– Lack of Fit with the data
– Lucas Critique (1976)

• VAR: Vector Auto Regressions


– Simple
– Non Structural
– All Variables are treated identically
– Better Fit with the Data
Simple VAR: Sims (1980)
• Symmetric
– Lags of the dependent variables
– Same Number of Lags
y1,t = α0 + α1y1,t −1 + α2 y2,t + α3 y3,t −1 + α4 y1,t −2 + α2 y2,t + α3 y3,t −2 + ... + ε1,t
−1 −2
y2,t = β0 + β1y1,t −1 + β2 y2,t + β3 y3,t −1 + β4 y1,t −2 + β2 y2,t + β3 y3,t −2 + ... + ε 2,t
−1 −2
y31,t = γ 0 + γ1y1,t −1 + γ 2 y2,t + γ 3 y3,t −1 + γ 4 y1,t −2 + γ 2 y2,t + γ 3 y3,t −2 + ... + ε3,t
−1 −2

σ i, j if t = τ
E (ε i ,t , ε j ,τ ) = 
0 if t ≠ τ
i, j ∈ (1,2,3)
Simple VAR: Matrix Form
• In Matrix Form:
y t = α + Γt −1y t −1 + Γt − 2 y t − 2 + ... + ε t
or Simply :
[I − Γ(L )]y t = Α + ε t
• y t is a vector of the Dependent Variables
• Γt − i is a Matrix of Coefficients
• Γ(L ) is a Matrix in Lagged Variables
• ε t is a Vector of White Noise Errors
• Α is a Matrix of exogenous variables (constant,…)
 ε 1 ,1 
 
 ε 1,2 
 ε
 1,3
 :



Covariance Matrix
 ε 
 2 ,1 
 ε 2 ,2 
ε t × ε t ' =  (
 × ε 1 ,1 ε 1 , 2 ε 1 , 3 ... ε 2 , 1 ε 2 , 2 ε 2 , 3 ... ε 3 , 1 ε 3 , 2 ε 3 , 3 ... )=
 ε 2 ,1 
 : 
 
 ε 3 ,1 
 ε 3,2 
 
 ε 1 ,1 
 
: 
 σ 1 ,1 0 0 ... σ 1,2 0 ... σ 1,3 0 ... 
 
 0 σ 1 ,1 0 ... 0 σ 1,2 ... 0 σ 1,3 ... 
 0 0 σ ... 0 0 ... 0 0 ... 
 1 ,1 
 : : : : 
σ 0 0 ... σ 
 2 ,1 2 ,2 
 0 σ 2 ,1 0 ... σ 2 ,2 ... σ 2 ,3 0 ... 
 
 0 σ 2 ,1 ... 0 0 ... 0 σ 2 ,3 0 
 : : : : 
 
 σ 3 ,1 0 0 ... σ 3,2 0 ... σ 3 ,3 0 ... 
 0 σ 0 ... 0 σ ... 0 σ 0 
 3 ,1 3,2 3 ,3 
: 
 
Contemporary Variance Matrix

 σ 1,1 σ 1,2 σ 1,3 


 
Ω =  σ 2,1 σ 2,2 σ 2,3 
σ σ σ 
 3,1 3, 2 3,3 
Issues Before Estimation
• Stationarity:
– Constant expected value
– Constant Variance
– Constant Covariances
• Granger Exogeneity:
– Order of variables
• Lag Length
– Optimal lag length
Testing Stationarity
• We have data on Canada 1966Q1-2002Q1
– GDP
– Consumer Price Index (CPI)
– Household Consumption (consumption)

Consumption CPI GDP Descriptor


36.91 18.04 62.53 1966Q1
37.47 18.24 64.58 1966Q2
38.46 18.41 65.47 1966Q3
Declare: Time Series
• Define and format: time variable
– date(var_name,”dmy”) or
– Quarterly(var_name, “yq”)
– format: format var_name %d
• Declare database as time series
– Menu: statistics  time series  setup & utilities 
declare dataset to be time series data
Declaring Time series
Declare Time Series
Transformations
• Convenience
– taking logs: gen var_name=log(var_name)

• Differences are in percentage


Plots
• Menu: Graphics  easy graphs  line graph
• Follow the wizard…
log of gdp
log of gdp
7
6
5
4 GDP

01jan1960 09sep1973 19may1987 25jan2001


date
Log of household consumption
7
log of household consumption
4 5 3 6

01jan1960 09sep1973 19may1987 25jan2001


date
log of CPI
5
4.5
log of cpi
4
3.5
3

01jan1960 09sep1973 19may1987 25jan2001


date
Stationarity
• Data don’t look stationary
• Formal test required

• Common tests (Greene, 636-646):


– Dickey Fuller:
• H0: Variable has a unit root
– Philips Peron
• H0: Variable has a unit root
– Dickey Fuller – GLS
• H0: Variable has a unit root
Testing:
• Menu: Statistics
Time Series
Tests

• Choose a test and follow the menu


– Augmented Dickey Fuller
– DF-GLS for a Unit root
– Phillips-Peron unit root
Choosing a test
Running a Test
• Augmented Dickey-Fuller Test
– 6 lags
– Including Trend
Result
• Cannot reject the null at 5%

Result Critical Values


Create First Differences
• Cannot Reject Unit root: Data is I(1)
• Create First Differences of the data:
Check the new graphs
L o g o f d iffe re nc e d G D P
.06 .04
log of differenced GDP
0 .02-.02

01jan196 0 09s ep1973 19m ay 1987 25jan2001


date
Inflation
.03
.02
inf lat ion
.01 0
-.01

01jan1960 09sep1973 19may1987 25jan2001


date
Log differenced household consumption

.05
d if fer ence household consumption
0 .01 .02 .03 .04

01jan1960 09sep1973 19may1987 25jan2001


date
Is it stationary now? (PP test)

The differenced data seems to be stationary


Granger Causality
• X Does not Granger Cause Y if:
E ( yt | yt −1, yt − 2 ,..., xt −1, xt − 2 ...) = E ( yt | yt −1, yt − 2 ...)

• Test (Greene, p.592):


– Regress Y on lags of X and Y
– Regress Y on lags of Y
– Test if the restricted model is significantly
outperformed by the non restricted model
– Either χ2 or F test
Granger Test
• Run simple VAR between the variables of
interest
• Menu: Statistics
multivariate time
series
Basic Vector Autoregression Model
• Choose
– Variables
– Lag Length
Granger Test: Running VAR
Testing in Stata
• Statistics
multivariate time series

var diagnostics and tests
Granger causality test
Granger Test
• Choose variables
Granger Test: Results
• We can reject that Inflation Granger Cause
Household Consumption
• We cannot reject that Household Consumption
Granger Cause Inflation
Optimal Lag Length
• Sometimes, we have theory to guide us
• Often, we do not
• Three common tests (Greene, 589):
– Likelihood Ratio Test (LR)
– Akaike Information Criterion
– Bayesian (Schwartz) Information Criterion

Likelihood Ratio (LR) test
General to simple approach: Run VAR
with p lags. Use the LR test. If the test
rejects the null, then stop. Otherwise
run p-1 lags and compare with p-2…
2 2
λ = T (ln Wres − ln Wunres ) → χ  M 
 
Wres − restricted cov ariance matrix
Wunres − unrestricted cov ariance matrix
M − Number of equations
Information Criteria
• Two information Criteria: Akaike (AIC) and
Bayesian (BIC). Find the information criteria
for lag length 1 to p. Choose the lag length
that minimizes the information criteria that
you chose.
2
( pM + M ) IC (T )
λ = ln(| W |) +
T
W − The cov ariance Matrix, p −number of lags,
T − number of observations M − number of equations,
IC(T ) − 2 for AIC, T for BIC,
Tests in Stata
• Menu: Statistics
multivariate time series

var diagnostics and tests

Lag-Order Selection statistics
Running test
• Choose Variables
• Choose maximum lags
Lag Length: Results

LR AIC BIC

We go with the LR and AIC and say 6


(why not?)
Run Simple VAR
• We run a simple VAR (not structural, no
assumptions on order of variables)
between Household Consumption,
Inflation and GDP
• To do so:
• Menu: Statistics
multivariate time
series
Basic Vector
Autoregression Model
Simple VAR
• Choose
– Variables
– Lag Length
• Choose how to plot the response functions:
– Irf (simply uses the covariance matrix, minimum
order)
– Orf (orthogonalized the Covariance matrix to set
order)
– FEVD: Variance Decomposition Tables (In a
graph form)
Simple VAR
Results: Table of Coefficients
Impulse Response Function
v arbas ic , dc ons , dc ons v arbas ic , dc ons , inf lat ion v arbas ic , dc ons , y
.01

.005

-.005

v arbas ic , inf lat ion, dc ons v arbas ic , inf lat ion, inf lat ion v arbas ic , inf lat ion, y
.01

.005

-.005

v arbas ic , y , dc ons v arbas ic , y , inf lat ion v arbas ic , y , y


.01

.005

-.005
0 5 10 15 0 5 10 15 0 5 10 15

s tep
95% CI orthogonali zed irf
Graphs by irf name, impuls e v ariable, and res pons e v ariable
Simple VAR: Variance
Decomposition Table
Generating After Estimation
• generate after estimation:
– Choose:
• Menu: Statistics
Multivariate time series  IRF &
Variance Decomposition Analysis
• Choose the table or impulse response function that
you need
To get the results
• If you want to use some of the results:
• Coefficients
• Number of observations
• Etc…
– Stata keeps them under the ereturn command

– To get them type e(variable_name)


– To see all the variables that you can choose
from:
• ereturn list
Examples
More than simple VAR
• More than a simple VAR:
– Adding Exogenous Variables
– Constraining blocks of variables to equal zero
• Use Menu: Statistics
multivariate
time series
 Vector Autoregression
Model

• Generating Impulse Responses:


• Menu: Statistics
Multivariate time series 
IRF & Variance Decomposition Analysis
More than simple VAR
• Adding constraints on the A or B matrix
– A: y Matrix, B: errors matrix
– Short and long run constraints
• skip lags
• Menu: Statistics multivariate time series

Structural Autoregression Model
• Stata runs the VAR with the restrictions
• Caveat 1: Too many constraints can lead to
failures in the convergence process
• Caveat 2: You need enough constraints to
allow identification.
Structural VAR
Defining a matrix
of constraints:
the ‘.’ imply a free
parameter

Using the
constraints:
Forcing the
values in the
constrained
matrix
Structural VAR: Results
Structural VAR: Results
v arbas ic , dc ons , dc ons v arbas ic , dc ons , inf lat ion v arbas ic , dc ons , y
.01

.005

-.005

v arbas ic , inf lat ion, dc ons v arbas ic , inf lat ion, inf lat ion v arbas ic , inf lat ion, y
.01

.005

-.005

v arbas ic , y , dc ons v arbas ic , y , inf lat ion v arbas ic , y , y


.01

.005

-.005
0 5 10 15 0 5 10 15 0 5 10 15

s tep
95% CI orthogonali zed irf
Graphs by irf name, impuls e v ariable, and res pons e v ariable
Structural VARs
• Structural VAR: VAR that is the result
of a structural model

• Goal: Obtaining the Structural


parameters out of the Estimated
Reduced Form

• Required: Number of Constraints


Model: Inflation and GDP
• Assume we have a simple model of the
form:
yt = α 0 + α1 yt −1 + α 2π t −1 + ε t
π t = β 0 + β1 yt + β 2 yt + β3π t −1 + υt
yt − GDP
π t − inf lation
υt , ε t − White noise, independent random var iables
We can write it:

yt = α 0 + α1 yt −1 + α 2π t −1 + ε t
π t − β1 yt = β 0 + β 2 yt + β 3π t −1 + υt
In Matrix Form:

 1 0  yt   α 0t   yt −1   ε t 
   =  +
  
 + 
 


 1 β 1 π π
 t   β 0   t −1   t  υ
OR:

−1 −1 −1
 yt   1 0   α 0t   1 0   yt −1   1 0 εt 
  =     + 
    +    
 π t   − β1 1   β 0   − β1 1   π t −1   − β1 1  υt 
Inverting the Matrix gives

−1
 1 0  1 0
  =  
 − β1 1   β1 1 
So we can substitute this in the equations:
We find:
yt = α 0 + α1 yt −1 + α 2π t −1 + ε t
π t = (β1α 0 + β 0 ) + (β1α1 + β 2 ) yt −1 + (β1α 2 + β3 )π t −1 + (β1ε t + υt )

So we can write in VAR form:

yt = α 0 + α1 yt −1 + α 2π t −1 + ε t
π t = θ 0 + θ1 yt −1 + θ 2π t −1 + ηt
Almost there
• After estimating the VAR we can find:

(β1α 0 + β 0 ) = θ 0
(β1α1 + β 2 ) = θ1
(β1α 2 + β3 ) = θ 2
So we have three equations and four
unknowns…
Hakuna Matata
• We also have the covariance matrix:

 σ ε ,ε σ ε ,η   σ ε ,ε β1σ ε ,ε 
 = 
 σ ε ,η
 ση ,η   β1σ ε ,ε ( 2
β1σ ε ,ε + υt )
• So we have a fourth equation:

β1σ ε ,ε = σ ε ,η
Run the VAR
• Note that because we assume that the “real”
covariance matrix has the triangular form:

 σ ε ,ε 0 
 
 β1σ ε ,ε σ ε ,ε 

• We can use the OIRF that Stata gives us (Cholesky


factorization) to watch the Structural impulse
functions.
Run the VAR (1 lag)
Study the Impulse Responses
v arbas ic , inf lat ion, inf lat ion v arbas ic , inf lat ion, y
. 01

. 00 5

v arbas ic , y , inf lat ion v arbas ic , y , y


. 01

. 00 5

0
0 2 4 6 8 0 2 4 6 8
s tep
95% CI orthogonali zed irf
Graphs by irf name, impuls e v ariable, and res pons e v ariable
Get the coefficients

α1
α2
α0

θ1
θ2
θ0
Get the Errors matrix

σ ε ,ε

β1σ ε ,ε
We find:

cov(ε ,η) 0.000007018


β1 = = = 0.086
σε ,ε 0.00008145
β0 = θ0 − β1α0 = 0.0005972− 0.086× 0.0574 = −0.0043
β2 = θ1 − β1α1 = 0.195− 0.086× 0.622 = 0.142
β3 = θ2 − β1α2 = 0.625− 0.086× 0.142 = 0.614
Conclusion
• Enough restrictions
• Exact Identification
• Possible to deduce the Structural
Parameters
To test a restricted Model
• Run a non restricted model
• Test the null by using the LR test on the
difference between the restricted and
unrestricted model

λ = T (ln Wres − ln Wunres ) → χ (M )


2

Wres − restricted cov ariance matrix


Wunres − unrestricted cov ariance matrix
M − Number of restrictions
Caveat
• With the data we used, it is likely that
the variables are cointegrated
(consumption and GDP)
• One should (theoretically) check for
that option

You might also like