introduction to vars and structural vars · introduction to vars and structural vars: estimation...
TRANSCRIPT
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
tttttttt
tttttttt
tttttttt
yyyyyyy
yyyyyyy
yyyyyyy
,32,332,222,141,331,221,110,31
,22,332,222,141,331,221,110,2
,12,332,222,141,331,221,110,1
...
...
...
εγγγγγγγεβββββββεααααααα
++++++++=
++++++++=
++++++++=
−−−−−−
−−−−−−
−−−−−−
( )3,2,1,
0),(
,,,
∈
≠
==
ji
tif
tifE
jijti
τ
τσεε τ
Simple VAR: Matrix Form• In Matrix Form:
• is a vector of the Dependent Variables
• is a Matrix of Coefficients
• is a Matrix in Lagged Variables
• is a Vector of White Noise Errors
• is a Matrix of exogenous variables (constant,…)
( )[ ] tt
tttt
yI
yyy
ε
εα
+Α=Γ−
++Γ+Γ+= −−−−
L
Simplyor
tt
:
...2211
ty
i−Γt( )LΓ
tε
Α
( )
=×
=×
:
00...0...00
...0...0...00
::::
00...00...0
...0......00
...00
::::
...00...00...00
...0...0...00
...0...0...00
.........
:
:
:
3,32,31,3
3,32,31,3
3,21,2
3,22,21,2
2,21,2
1,1
3,12,11,1
3,12,11,1
3,32,31,33,22,21,23,12,11,1
1,1
2,3
1,3
1,2
2,2
1,2
3,1
2,1
1,1
σσσσσσ
σσσσσ
σσ
σσσσ
σσσ
εεεεεεεεε
ε
εε
εεε
εεε
'εε tt
Covariance Matrix
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)
1966Q365.4718.4138.46
1966Q264.5818.2437.47
1966Q162.5318.0436.91
DescriptorGDPCPIConsumption
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
Transformations
• Convenience
– taking logs: gen var_name=log(var_name)
• Differences are in percentage
34
56
7log of household consumption
01jan1960 09sep1973 19may1987 25jan2001date
Log of household consumption
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: StatisticsTime SeriesTests
• Choose a test and follow the menu
– Augmented Dickey Fuller
– DF-GLS for a Unit root
– Phillips-Peron unit root
Create First Differences
• Cannot Reject Unit root: Data is I(1)
• Create First Differences of the data:
Check the new graphs-.02
0.02
.04
.06
log of differenced GDP
01jan196 0 09sep1973 19may1987 25jan2001date
Log o f d if fe renced GDP
0.01
.02
.03
.04
.05
difference household consumption
01jan1960 09sep1973 19may1987 25jan2001date
differenced household consumptionLog
Granger Causality
• X Does not Granger Cause Y if:
• 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
...),|(...),,...,,|( 212121 −−−−−− = tttttttt yyyExxyyyE
Granger Test• Run simple VAR between the variables of
interest
• Menu: Statisticsmultivariate time
seriesBasic Vector Autoregression Model
• Choose
– Variables
– Lag Length
Testing in Stata
• Statisticsmultivariate time series
var diagnostics and tests
Granger causality test
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…
( )
equationsofNumberM
matrixarianceedunrestrictW
matrixariancerestrictedW
MWWT
unres
res
unresres
−
−
−
→−=
cov
cov
lnln22
χλ
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)(
,
,,cov
)()(|)ln(|
2
BICforTAICforTIC
equationsofnumberMnsobservatioofnumberT
lagsofnumberpMatrixarianceTheW
T
TICMpMW
−
−−
−−
++=λ
Tests in Stata• Menu: Statisticsmultivariate time series
var diagnostics and tests
Lag-Order Selection statistics
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: Statisticsmultivariate time
seriesBasic 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)
Impulse Response Function
- .005
0
.005
.01
-.005
0
.005
.01
-.005
0
.005
.01
0 5 10 15 0 5 10 15 0 5 10 15
v arbas ic , dcons , dcons v arbas ic , dcons , inf lat ion v arbas ic , dcons , y
v arbas ic , inf lat ion, dcons v arbas ic , inf lat ion, inf lat ion v arbas ic , inf lat ion, y
v arbas ic , y , dcons v arbas ic , y , inf lat ion v arbas ic , y , y
95% CI orthogonali zed irf
s tep
Graphs by irf name, impulse variable, and response variable
Generating After Estimation
• generate after estimation:
– Choose:
• Menu: StatisticsMultivariate 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
More than simple VAR• More than a simple VAR:
– Adding Exogenous Variables
– Constraining blocks of variables to equal zero
• Use Menu: Statisticsmultivariate
time series Vector Autoregression
Model
• Generating Impulse Responses:
• Menu: StatisticsMultivariate 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: Statisticsmultivariate time seriesStructural 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
- .005
0
.005
.01
-.005
0
.005
.01
-.005
0
.005
.01
0 5 10 15 0 5 10 15 0 5 10 15
v arbas ic , dcons , dcons v arbas ic , dcons , inf lat ion v arbas ic , dcons , y
v arbas ic , inf lat ion, dcons v arbas ic , inf lat ion, inf lat ion v arbas ic , inf lat ion, y
v arbas ic , y , dcons v arbas ic , y , inf lat ion v arbas ic , y , y
95% CI orthogonali zed irf
s tep
Graphs by irf name, impulse variable, and response variable
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:
iablesrandomtindependennoiseWhite
lation
GDPy
yy
yy
tt
t
t
ttttt
tttt
var,,
inf
13210
12110
−
−
−
++++=
+++=
−
−−
ευπ
υπββββπεπααα
In Matrix Form:
+
+
=
− −
−
t
t
t
tt
t
t yy
υ
ε
πβ
α
πβ 1
1
0
0
1 1
01
OR:
−+
−+
−=
−
−
−−−
t
t
t
tt
t
t yy
υ
ε
βπββ
α
βπ
1
11
11
10
01
1 1
01
1
01
1
01
We find:
( ) ( ) ( ) ( )ttttt
tttt
y
yy
υεβπβαββαββαβπεπααα
+++++++=
+++=
−−
−−
113211211001
12110
So we can write in VAR form:
tttt
tttt
y
yy
ηπθθθπεπααα
+++=
+++=
−−
−−
12110
12110
Almost there
• After estimating the VAR we can find:
( )( )( ) 2321
1211
0001
θβαβ
θβαβ
θβαβ
=+
=+
=+
So we have three equations and four
unknowns…
Hakuna Matata
• We also have the covariance matrix:
• So we have a fourth equation:
( )
+=
2
,1,1
,1,
,,
,,
tυσβσβ
σβσ
σσσσ
εεεε
εεεε
ηηηε
ηεεε
ηεεε σσβ ,,1 =
Run the VAR• Note that because we assume that the “real”
covariance matrix has the triangular form:
• We can use the OIRF that Stata gives us (Cholesky
factorization) to watch the Structural impulse
functions.
εεεε
εεσσβ
σ
,,1
, 0
Study the Impulse Responses
0
.00 5
.01
0
.00 5
.01
0 2 4 6 8 0 2 4 6 8
v arbas ic , inf lat ion, inf lat ion v arbas ic , inf lat ion, y
v arbas ic , y , inf lat ion v arbas ic , y , y
95% CI orthogonali zed irf
s tep
Graphs by ir f name, impulse var iable, and response variable
We find:
614.0142.0086.0625.0
142.0622.0086.0195.0
0043.00574.0086.00005972.0
086.000008145.0
000007018.0),cov(
2123
1112
0100
,1
=×−=−=
=×−=−=
−=×−=−=
===
αβθβ
αβθβ
αβθβ
σηε
βεε
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
( ) ( )
nsrestrictioofNumberM
matrixarianceedunrestrictW
matrixariancerestrictedW
MWWT
unres
res
unresres
−
−
−
→−=
cov
cov
lnln2
χλ