0% found this document useful (0 votes)
6 views59 pages

VAR Exercise Class

The document outlines exercises related to Vector Autoregression (VAR) models, including topics like stationarity testing, lag length selection, and Granger causality. It provides theoretical questions, practical implementations in R, and solutions for each exercise. The exercises aim to enhance understanding and application of VAR models in econometric analysis.

Uploaded by

JACampina
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views59 pages

VAR Exercise Class

The document outlines exercises related to Vector Autoregression (VAR) models, including topics like stationarity testing, lag length selection, and Granger causality. It provides theoretical questions, practical implementations in R, and solutions for each exercise. The exercises aim to enhance understanding and application of VAR models in econometric analysis.

Uploaded by

JACampina
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Vector Autoregression (VAR) Models

February 19, 2026

1 / 59
VAR Exercises

1 Stationarity Testing

2 Lag Length Selection

3 Granger Causality

4 OLS Estimation and Interpretation

5 From VAR to VMA Representation

6 Impulse Response Functions

7 Bonus: Structural VAR

8 Wrap-Up and Next Steps

2 / 59
Exercise 1: Stationarity Testing - Question

Exercise 1.1: Theoretical Understanding


      
y1t 0.6 0.2 y1,t−1 u
Consider a bivariate VAR(1) model: = + 1t
y2t 0.1 0.5 y2,t−1 u2t
1 Is this VAR(1) stationary? Verify using the stationarity condition.

2 Compute the eigenvalues of the coefficient matrix.


3 What is the companion form of this system?

3 / 59
Exercise 1.1: Hint

Hint
Key concepts to remember:
A VAR(1) is stationary if all eigenvalues of A1 lie inside the unit circle
Equivalently: |λi | < 1 for all i
For VAR(1): companion form is the same as the coefficient matrix
To find eigenvalues, solve: det(A1 − λI) = 0
 
a b
Calculation tip: For a 2 × 2 matrix :
c d

(a+d)± (a+d)2 −4(ad−bc)
λ1,2 = 2

4 / 59
Exercise 1.1: Solution (Part 1)

Solution
Step 1: Stationarity condition
For a VAR(1), stationarity requires all eigenvalues of A1 to satisfy |λi | < 1.

Step 2: Compute
 eigenvalues
0.6 0.2
Let A1 =
0.1 0.5
Characteristic
  det(A1 − λI) = 0
equation:
0.6 − λ 0.2
det =0
0.1 0.5 − λ
(0.6 − λ)(0.5 − λ) − (0.2)(0.1) = 0 λ2 − 1.1λ + 0.28 = 0

5 / 59
Exercise 1.1: Solution (Part 2)

Solution
√ √
Using the quadratic formula: λ1,2 = 1.1± 1.21−1.12
2 = 1.1± 0.09
2 = 1.1±0.3
2
λ1 = 1.1+0.3
2 = 0.7, λ2 = 1.1−0.3
2 = 0.4

Step 3: Check stationarity


|λ1 | = 0.7 < 1 X
|λ2 | = 0.4 < 1 X
Conclusion: The VAR(1) is stationary since both eigenvalues lie inside
the unit circle.
Step 4: Companion form
For VAR(1), the companion form is identical to the original system
(already in VAR(1) form).

6 / 59
Exercise 1.2: Stationarity in R - Question

Exercise 1.2: Practical Implementation

You have estimated a VAR(2) model on three variables (GDP growth,


inflation, interest rate) using R:
1 library ( vars )
2 data <- read . csv ( " macro _ data . csv " )
3 var _ model <- VAR ( data , p =2 , type = " const " )

Tasks:
1 Write R code to check the stationarity of this VAR(2) model
2 Interpret the output: what do you look for?
3 What should you do if the model is non-stationary?

7 / 59
Exercise 1.2: Solution
R code for stationarity testing:
1 # Method 1: Using roots () function
2 stability _ roots <- roots ( var _ model )
3 print ( stability _ roots )
4 # Check condition : all roots should be < 1
5 all ( stability _ roots < 1) # Should return TRUE
6 # Method 2: Compute eigenvalues of companion matrix
7 companion _ matrix <- companionMatrix ( var _ model )
8 eigenvalues <- eigen ( companion _ matrix ) $ values
9 modulus <- Mod ( eigenvalues )
0 print ( modulus )
1 # Check : all moduli should be < 1
2 all ( modulus < 1) # Should return TRUE
3 # Visual check
4 plot ( stability _ roots ,
5 main = " Inverse Roots of AR Characteristic Polynomial "
,
6 xlab = " Real Part " , ylab = " Imaginary Part " )
7 symbols (0 , 0 , circles =1 , add = TRUE , inches = FALSE ) 8 / 59
Exercise 1.2: Interpretation
Solution
What to look for:
1 Roots ¡ 1: If roots(var model) returns values all < 1, the system
is stationary
2 Eigenvalues modulus ¡ 1: Equivalently, check |λi | < 1
3 Visual check: In the plot, all points should lie inside the unit circle

If non-stationary:
Check for unit roots in individual series (ADF test)
Consider differencing the data
Test for cointegration (if variables share common trends)
Estimate a Vector Error Correction Model (VECM)

Warning: Standard VAR asymptotics require stationarity. Non-stationary


VARs can lead to spurious results!
9 / 59
Exercise 2: Lag Length Selection - Question
Exercise 2.1: Information Criteria

You estimated VAR models with different lag lengths on a dataset with
K = 3 variables and T = 200 observations. The results are:

Lag (p) AIC BIC HQ FPE


0 -5.234 -5.180 -5.212 0.0054
1 -6.782 -6.674 -6.738 0.0011
2 -7.125 -6.963 -7.059 0.0008
3 -7.089 -6.873 -7.001 0.0008
4 -7.012 -6.742 -6.902 0.0009

Questions:
1 Which lag length does each criterion select?

2 Why do AIC and BIC sometimes disagree?

3 Which criterion would you recommend and why?

10 / 59
Exercise 2.1: Hint

Hint
Key principles:
Selection rule: Choose p that minimizes the criterion (most
negative for log-likelihood based criteria)
2K 2 p
AIC: Akaike Information Criterion AIC(p) = ln |Σ̃u (p)| + T
BIC: Bayesian/Schwarz Information Criterion
2
BIC(p) = ln |Σ̃u (p)| + K pTln T
Key difference: BIC penalizes additional parameters more heavily
(especially for large T )

Practical advice:
BIC tends to select more parsimonious models (fewer lags)
AIC can be liberal (may overfit)

11 / 59
Exercise 2.1: Solution
Solution
Step 1: Identify optimal lags for each criterion
Looking at the table (bold values indicate minimum):
AIC: Selects p = 2 (most negative: -7.125)
BIC: Selects p = 3 (-6.873)
HQ: Selects p = 2 (-7.059)
FPE: Selects p = 2 (0.0008)

Step 2: Why do they disagree?


BIC has a stronger penalty for additional parameters
K 2 p ln 200
With T = 200: BIC penalty = 200 ≈ 0.0265 × K 2 p
2K 2 p 2
AIC penalty = 200 = 0.01 × K p
BIC penalty is approximately 2.65 times larger
BIC favors more parsimonious models
12 / 59
Exercise 2.1: Recommendation

Solution
Step 3: Which criterion to use?

Recommendation: Use p = 2 (majority vote: AIC, HQ, FPE)

Reasoning:
1 Three out of four criteria agree on p = 2
2 BIC’s selection of p = 3 is marginal (only 0.016 difference from p = 2)
3 Parsimony principle: prefer simpler model when performance is similar
4 p = 2 is more interpretable (quarterly data → half-year dynamics)

Additional checks:
Perform residual diagnostics (serial correlation test)
If p = 2 residuals show autocorrelation → consider p = 3
Check if results are robust across lag specifications
13 / 59
Exercise 2.2: Lag Selection in R - Question

Exercise 2.2: Practical Implementation

Write R code to:


1 Load the sample dataset Canada from the vars package
2 Select optimal lag length using multiple criteria
3 Estimate the VAR with the selected lag
4 Verify that residuals are not serially correlated

14 / 59
Exercise 2.2: Solution

1 library ( vars )
2 # Load data
3 data ( Canada )
4 # Step 1: Lag selection ( test p = 1 to 10)
5 lag _ select <- VARselect ( Canada , lag . max =10 ,
6 type = " const " )
7 print ( lag _ select $ selection )
8 # AIC ( n ) HQ ( n ) SC ( n ) FPE ( n )
9 # 3 2 1 3
0 # Step 2: Estimate VAR with BIC - selected lag ( p =1)
1 var _ bic <- VAR ( Canada , p =1 , type = " const " )
2 # Step 3: Serial correlation test
3 serial _ test <- serial . test ( var _ bic , lags . pt =10 ,
4 type = " PT . asymptotic " )
5 print ( serial _ test )
6 # Null : No serial correlation up to lag 10

15 / 59
Exercise 2.2: Interpretation

Interpreting VARselect output:


1 # AIC ( n ) HQ ( n ) SC ( n ) FPE ( n )
2 # 3 2 1 3

AIC and FPE select p = 3 (more flexible)


HQ selects p = 2 (middle ground)
SC (= BIC) selects p = 1 (most parsimonious)
Serial correlation test interpretation:
If p-value > 0.05: No evidence of serial correlation X
If p-value < 0.05: Residuals are serially correlated → increase lag
length
Decision: Start with BIC (p = 1), check diagnostics. If serial correlation
detected, move to p = 2 or p = 3.

16 / 59
Exercise 3: Granger Causality - Question

Exercise 3.1: Theoretical Understanding

Consider a bivariate VAR(2) with GDP growth (gt ) and interest rate (rt ):
gt = 0.3 + 0.5gt−1 + 0.2gt−2 − 0.1rt−1 − 0.05rt−2 + u1t
rt = 1.2 + 0.1gt−1 + 0.05gt−2 + 0.7rt−1 + 0.15rt−2 + u2t
Questions:
1 Does the interest rate Granger-cause GDP growth?
2 Does GDP growth Granger-cause the interest rate?
3 What are the null hypotheses for each test?
4 How would you test these hypotheses?

17 / 59
Exercise 3.1: Hint

Hint
Granger causality definition:
X Granger-causes Y if past values of X help predict Y beyond what past
values of Y alone can predict.

Testing procedure:
1 Write the equation for the “caused” variable
2 Identify coefficients on lags of the “causing” variable
3 Set up null hypothesis: H0 : all those coefficients = 0
4 Use F-test or Wald test

For our example:


“Does r GC g ?”: Look at rt−1 , rt−2 coefficients in gt equation
“Does g GC r ?”: Look at gt−1 , gt−2 coefficients in rt equation

18 / 59
Exercise 3.1: Solution (Part 1)

Solution
Question 1: Does interest rate Granger-cause GDP growth?
Look at the gt equation:
gt = 0.3 + 0.5gt−1 + 0.2gt−2 − 0.1rt−1 − 0.05rt−2 + u1t
Coefficients on rt−1 and rt−2 : −0.1 and −0.05
These are non-zero
Null hypothesis: H0 : βr ,1 = βr ,2 = 0
R −RSSU )/q
Test statistic: F = (RSS
RSSU /(T −k) ∼ F (q, T − k) where q = 2
(number of restrictions), RSSR = restricted sum of squares, RSSU =
unrestricted sum of squares

Conclusion: If we reject H0 , then r Granger-causes g .


Based on the non-zero coefficients, we would expect to reject H0 →
interest rate does Granger-cause GDP growth.

19 / 59
Exercise 3.1: Solution (Part 2)
Solution
Question 2: Does GDP growth Granger-cause interest rate?
Look at the rt equation:
rt = 1.2 + 0.1gt−1 + 0.05gt−2 + 0.7rt−1 + 0.15rt−2 + u2t
Coefficients on gt−1 and gt−2 : 0.1 and 0.05
These are non-zero
Null hypothesis: H0 : γg ,1 = γg ,2 = 0
Use same F-test procedure

Conclusion: Based on non-zero coefficients, we would expect GDP


growth does Granger-cause interest rate.

Key insight: This VAR exhibits bidirectional Granger causality → GDP


and interest rate have feedback effects.
Economic interpretation: Monetary policy (interest rate) affects output,
and output conditions influence policy decisions.
20 / 59
Exercise 3.2: Granger Causality in R - Question

Exercise 3.2: Testing in Practice

Using the Canada dataset:


1 Test whether employment (e) Granger-causes productivity (prod)
2 Test the reverse: does prod Granger-cause e?
3 Interpret the results

21 / 59
Exercise 3.2: Solution

1 library ( vars )
2 data ( Canada )
3 # Estimate VAR (2)
4 var _ model <- VAR ( Canada , p =2 , type = " const " )
5 # Test : Does employment GC productivity ?
6 gc _ e _ to _ prod <- causality ( var _ model ,
7 cause = " e " )
8 print ( gc _ e _ to _ prod $ Granger )
9 # Test : Does productivity GC employment ?
0 gc _ prod _ to _ e <- causality ( var _ model ,
1 cause = " prod " )
2 print ( gc _ prod _ to _ e $ Granger )
3 # Interpret
4 # H0 : [ cause ] does NOT Granger - cause [ others ]
5 # If p - value < 0.05: Reject H0
6 # = > [ cause ] DOES Granger - cause [ others ]

22 / 59
Exercise 3.2: Interpretation Guide
How to interpret causality() output:
Example output:
Granger causality H0: e do not Granger-cause prod
F-Test:
statistic = 4.521, p-value = 0.012
Interpretation:
p-value = 0.012 < 0.05
Reject H0
Conclusion: Employment does Granger-cause productivity
Important caveats:
1 Granger causality 6= true causality (it’s predictive association)

2 Depends on lag length choice

3 Sensitive to omitted variables

4 Requires stationarity

23 / 59
Exercise 4: OLS Estimation - Question

Exercise 4.1: Understanding VAR Coefficients

You
 estimated
  a bivariate
 VAR(1)
  and obtained:
ŷ1t 0.5 0.7 −0.3 y1,t−1
= +
ŷ2t 1.2 0.2 0.6 y2,t−1
Standard errors: SE (â11 ) = 0.08, SE (â12 ) = 0.12, SE (â21 ) = 0.09,
SE (â22 ) = 0.07

Questions:
1 Test whether a11 is significantly different from zero (α = 0.05)
2 Test whether a12 is significantly different from zero
3 Interpret the coefficient a12 = −0.3
4 What does a21 = 0.2 tell you about the relationship?

24 / 59
Exercise 4.1: Hint

Hint
Hypothesis testing for coefficients:
H0 : aij = 0 (no effect)
H1 : aij 6= 0 (significant effect)
âij
Test statistic: t = SE (âij )
Critical value (5% level, two-tailed): |t| > 1.96 (for large T )
Alternatively: p-value < 0.05

Interpretation guide:
aij measures effect of yj,t−1 on yi,t
Positive coefficient: positive relationship
Negative coefficient: negative relationship
Magnitude indicates strength of effect

25 / 59
Exercise 4.1: Solution (Part 1)

Solution
Question 1: Test a11 = 0.7
t11 = SEâ(â1111 ) = 0.08
0.7
= 8.75
|t| = 8.75 > 1.96 (critical value at 5%)
Reject H0
a11 is highly significant
Interpretation: y1,t−1 has strong predictive power for y1t (strong
persistence)

Question 2: Test a12 = −0.3


t12 = SEâ(â1212 ) = −0.3
0.12 = −2.5
|t| = 2.5 > 1.96
Reject H0
a12 is significant at 5% level
26 / 59
Exercise 4.1: Solution (Part 2)
Solution
Question 3: Interpret a12 = −0.3
Coefficient a12 measures the effect of y2,t−1 on y1,t .
Sign: Negative → inverse relationship
Magnitude: A 1-unit increase in y2,t−1 leads to a 0.3-unit decrease
in y1,t (holding y1,t−1 constant)
Significance: t = −2.5 → statistically significant
Economic example: If y1 = GDP growth, y2 = interest rate:
Higher interest rate in previous period → lower GDP growth today
Consistent with monetary policy transmission mechanism
Question 4: Interpret a21 = 0.2
Measures effect of y1,t−1 on y2,t
Positive coefficient: y1 positively affects y2 with one-period lag
Test: t = 0.2/0.09 = 2.22 > 1.96 → significant
27 / 59
Exercise 4.2: VAR Estimation Output in R

Exercise 4.2: Reading R Output

1 summary ( var _ model )


2 # Output for equation 1: GDP growth
3 # Estimate Std . Error t value Pr ( >| t |)
4 # const 0.523 0.145 3.60 0.0004 ***
5 # gdp . l1 0.351 0.089 3.94 0.0001 ***
6 # inf . l1 -0.087 0.042 -2.07 0.0402 *
7 # rate . l1 -0.124 0.056 -2.21 0.0284 *

Questions:
1 Which coefficients are significant at 5%?
2 Interpret the coefficient on rate.l1
3 What is the R-squared interpretation in VAR?

28 / 59
Exercise 4.2: Solution
Solution
Question 1: Significant coefficients
const: p = 0.0004 < 0.05 → Significant ***
gdp.l1: p = 0.0001 < 0.05 → Significant ***
inf.l1: p = 0.0402 < 0.05 → Significant *
rate.l1: p = 0.0284 < 0.05 → Significant *
All coefficients are significant at 5% level! Question 2: Interpret
rate.l1 coefficient
Coefficient: −0.124
Interpretation: A 1 percentage point increase in the interest rate in
period t − 1 leads to a 0.124 percentage point decrease in GDP
growth in period t
Economic meaning: Contractionary monetary policy (higher rates)
→ lower economic growth
Statistical significance confirms this effect is not due to chance 29 / 59
Exercise 4.2: R-squared in VAR
Solution
Question 3: R-squared interpretation
In VAR models, each equation has its own R-squared:
R-squared for equation i: Proportion of variance in yit explained by
all lagged variables in the VAR
Range: 0 to 1
Higher R2 → better fit (but watch for overfitting!)
Typical values:
Growth rates, returns: R2 often 0.05–0.30 (low predictability)
Persistent series (e.g., levels): R2 often 0.80–0.99
High R2 doesn’t mean causality!
VAR-specific note:
Focus more on joint significance (F-tests) than individual R2
System-level diagnostics matter more than equation-level fit
30 / 59
Exercise 5: VMA Representation - Question

Exercise 5.1: Deriving VMA

Consider a simple
 VAR(1):
 yt = A1 yt−1 + ut
0.5 0
where A1 = (diagonal for simplicity)
0 0.3
Questions:
P∞
1 Write the VMA representation: yt = i=0 Φi ut−i
2 Compute the first three VMA coefficient matrices: Φ0 , Φ1 , Φ2
3 Show that Φi → 0 as i → ∞ (explain why)
What is the cumulative impulse response: ∞
P
i=0 Φi ?
4

31 / 59
Exercise 5.1: Hint

Hint
VAR to VMA transformation:
Starting from: yt = A1 yt−1 + ut
Recursive substitution:

yt = ut + A1 (A1 yt−2 + ut−1 )


= ut + A1 ut−1 + A21 yt−2
= ut + A1 ut−1 + A21 ut−2 + A31 yt−3
..
.

If stationary: yt = ∞ i
P
i=0 A1 ut−i

Thus: Φi = Ai1 (for VAR(1))

32 / 59
Exercise 5.1: Solution (Part 1)

Solution
Step 1: VMA representation P
From recursive substitution: yt = ∞
i=0 Φi ut−i
i
where Φi = A1 for VAR(1)

Step 2: Compute  VMA  matrices


1 0
Φ0 = A01 = I =
0 1
 
1 0.5 0
Φ1 = A1 =
0 0.3
 2  
0.5 0 0.25 0
Φ2 = A21 = =
0 0.3 0 0.09

33 / 59
Exercise 5.1: Solution (Part 2)

Solution
Step 3: Show Φi → 0
0.5i
 
0
For a diagonal matrix: Ai1 =
0 0.3i
As i → ∞: 0.5i → 0 and 0.3i → 0
Because both eigenvalues (0.5 and 0.3) are inside the unit circle
General result: If VAR is stationary (|λj | < 1), then Φi → 0
exponentially fast

Step
P∞ 4: Cumulative
P∞ i impulse response
−1
Φ
i=0 i = i=0 A1 = (I − A1 ) −1  
−1 1 − 0.5 0 2 0
For our example: (I − A1 ) = =
0 1 − 0.3 0 1.43
Interpretation: Long-run multiplier — cumulative effect of a shock on
the level of each variable.
34 / 59
Exercise 5.2: Computing VMA in R - Question

Exercise 5.2: Practical Implementation

Using the vars package:


1 Estimate a VAR(2) on the Canada dataset
2 Compute the VMA coefficient matrices Φi for i = 0, 1, . . . , 10
3 Plot how the coefficients decay over time
4 Interpret the results

35 / 59
Exercise 5.2: Solution
1 library ( vars )
2 data ( Canada )
3 # Estimate VAR (2)
4 var _ model <- VAR ( Canada , p =2 , type = " const " )
5 # Compute VMA matrices ( Phi coefficients )
6 # Phi ( i ) represents effect of shock at t - i on y at t
7 phi _ matrices <- Phi ( var _ model , nstep =10)
8 # phi _ matrices is a 3 D array :
9 # [ variable , shock , horizon ]
0 # Example : Effect of shock to ’e ’ on ’ prod ’ at horizon5
1 effect _ h5 <- phi _ matrices [ " prod " , " e " , 5]
2 print ( effect _ h5 )
3 # Visualize decay
4 horizons <- 0:10
5 effects <- phi _ matrices [ " e " , " e " , ]
6 plot ( horizons , effects , type = " b " ,
7 main = " VMA Coefficient Decay " ,
8 xlab = " Horizon " , ylab = " Phi _ i [1 ,1] " )
9 abline ( h =0 , lty =2 , col = " red " )
36 / 59
Exercise 5.2: Interpretation
Solution
Interpreting VMA coefficients:
The Φi matrices tell us:
[Φi ]jk : Effect of a 1-unit shock to variable k at time t on variable j at
time t + i
Φ0 = I: Contemporaneous impact (shock affects itself immediately)
Φ1 , Φ2 , . . .: Dynamic propagation of shocks over time
What to look for in the plot:
1 Initial response: Φ0 = 1 (by construction)
2 Persistence: How fast do coefficients decay?
Fast decay → shocks dissipate quickly
Slow decay → long-lasting effects
3 Sign patterns:
Always positive → no overshooting
Sign changes → oscillatory response
4 Convergence to zero: Confirms stationarity 37 / 59
Exercise 6: Impulse Response Functions - Question

Exercise 6.1: Understanding IRFs

Consider the following statements about Impulse Response Functions:


A. IRFs measure the effect of a one-time shock to one variable on all
variables in the system
B. Reduced-form IRFs are unique and do not depend on variable ordering
C. Cholesky decomposition assumes a recursive causal structure
D. The area under an IRF curve gives the cumulative effect of the shock
E. IRFs from a stationary VAR should eventually return to zero

Questions:
1 Which statements are TRUE? Which are FALSE?
2 For each false statement, explain why and correct it

38 / 59
Exercise 6.1: Solution
Solution
Evaluating each statement:

X A is TRUE: IRFs trace out dynamic response of all variables to a


shock in one variable over time
× B is FALSE:
Reduced-form shocks ut are correlated: E [ut u0t ] = Σu (non-diagonal)
Cannot isolate effect of “one shock” without identification
Cholesky IRFs do depend on variable ordering
Correction: “Structural IRFs require identification; Cholesky IRFs
depend on ordering”
X C is TRUE: Cholesky assumes variable 1 affects all others
contemporaneously, variable 2 affects 3,. . . ,K contemporaneously,
etc. (recursive/triangular structure)
X D is TRUE: ∞
P
h=0 IRFh = cumulative (long-run) effect
X E is TRUE: Stationarity → shocks dissipate over time → IRF → 0
39 / 59
Exercise 6.2: IRF Identification Problem

Exercise 6.2: Why Do We Need Structural Identification?


 
1.0 0.6
You estimated a bivariate VAR and obtained: Σu =
0.6 0.8
Questions:
1 What does the off-diagonal element (0.6) tell you?
2 Why can’t you directly interpret a 1-unit shock to u1t ?
3 How does Cholesky decomposition solve this?
4 Compute the Cholesky factor (lower triangular) P such that Σu = PP0

40 / 59
Exercise 6.2: Hint

Hint
Cholesky decomposition procedure:
σ12 σ12

For Σu =
σ σ22
 12 
p 0
Find P = 11 such that Σu = PP0
p21 p22
Steps:
q
1 p11 = σ12
σ12
2 p21 = p11
q
3 p22 = σ22 − p21
2

Structural shocks: ut = Pεt


where εt are orthogonal structural shocks with E [εt ε0t ] = I

41 / 59
Exercise 6.2: Solution (Part 1)

Solution
Question 1: Interpretation of σ12 = 0.6
Correlation: ρ = √ 0.6 = 0.6
= 0.671
1.0×0.8 0.894
High positive correlation between reduced-form shocks
Shocks tend to move together
Problem: Can’t isolate effect of “just u1 ” or “just u2 ”

Question 2: Why can’t we interpret u1t directly?


If u1t increases by 1, u2t typically also changes (due to correlation)
We don’t observe “pure” shocks
Need to orthogonalize: find uncorrelated structural shocks εt

42 / 59
Exercise 6.2: Solution (Part 2)
Solution
Question 3: How Cholesky helps
Cholesky decomposes Σu = PP0 with P lower triangular
Define structural shocks: ut = Pεt
By construction: E [εt ε0t ] = I (orthogonal!)
Now can interpret IRFs as responses to εjt (pure shocks)
 
1.0 0.6
Question 4: Compute Cholesky factor Given: Σu =
0.6 0.8

p11 = 1.0 = 1.0
0.6
p21 = = 0.6
1.0
p √ √
p22 = 0.8 − 0.62 = 0.8 − 0.36 = 0.44 = 0.663
 
1.0 0
P=
0.6 0.663
43 / 59
Exercise 6.2: Verification

Solution
Verify: PP0= Σu
 
1.0 0 1.0 0.6
0.6 0.663 0 0.663
 
1.0 × 1.0 + 0 × 0 1.0 × 0.6 + 0 × 0.663
=
0.6 × 1.0 + 0.663 × 0 0.6 × 0.6 + 0.663 × 0.663
   
1.0 0.6 1.0 0.6
= = X
0.6 0.36 + 0.44 0.6 0.8
Interpretation of P:
Row 1: u1t = 1.0 · ε1t → y1 responds only to first structural shock
Row 2: u2t = 0.6 · ε1t + 0.663 · ε2t → y2 responds to both shocks
Recursive structure: first variable causally prior

44 / 59
Exercise 6.3: Computing IRFs in R - Question

Exercise 6.3: Practical IRF Analysis

Tasks:
1 Estimate a VAR(2) on the Canada dataset
2 Compute orthogonalized IRFs (Cholesky)
3 Plot the response of prod (productivity) to a shock in e
(employment)
4 Plot IRFs for 20 periods ahead
5 Add confidence bands (bootstrap)
6 Interpret the results

45 / 59
Exercise 6.3: Solution (Part 1)
1 library ( vars )
2 data ( Canada )
3
4 # Step 1: Estimate VAR (2)
5 var _ model <- VAR ( Canada , p =2 , type = " const " )
6
7 # Step 2: Compute orthogonalized IRFs
8 # ortho = TRUE uses Cholesky decomposition
9 # n . ahead =20: 20 periods ahead
0 # boot = TRUE : bootstrap confidence intervals
1 # runs =500: number of bootstrap replications
2 irf _ results <- irf ( var _ model ,
3 impulse = " e " ,
4 response = " prod " ,
5 n . ahead =20 ,
6 ortho = TRUE ,
7 boot = TRUE ,
8 runs =500 ,
9 ci =0.95)
46 / 59
Exercise 6.3: Solution (Part 2)

1 # Step 3: Plot IRF


2 plot ( irf _ results ,
3 main = " Response of Productivity to Employment Shock " ,
4 ylab = " Response " ,
5 xlab = " Periods Ahead " )
6 # Access numerical values
7 print ( irf _ results $ irf $ e ) # Point estimates
8 print ( irf _ results $ Lower $ e ) # Lower CI
9 print ( irf _ results $ Upper $ e ) # Upper CI

47 / 59
Exercise 6.3: Solution (Part 3)

1 # Custom plot
2 horizons <- 0:20
3 point _ est <- irf _ results $ irf $ e
4 lower <- irf _ results $ Lower $ e
5 upper <- irf _ results $ Upper $ e
6 plot ( horizons , point _ est , type = " l " ,
lwd =2 ,
7 ylim = range ( c ( lower , upper ) ) ,
8 main = " IRF : Employment -> Productivity "
,
9 xlab = " Horizon " , ylab = " Response " )
0 polygon ( c ( horizons , rev ( horizons ) ) ,
1 c ( lower , rev ( upper ) ) ,
2 col = rgb (0 ,0 ,1 ,0.2) , border = NA )
3 abline ( h =0 , lty =2 , col = " red " )

48 / 59
Exercise 6.3: Interpretation Guide
Solution
How to interpret IRF plots: Key features to identify:
1 Impact effect (horizon 0):

Contemporaneous response
Cholesky: impact depends on ordering
2 Peak response:
When is the maximum effect?
How large is it?
3 Persistence:
How long until IRF returns to zero?
Half-life: horizon when response drops to 50% of peak
4 Shape:
Monotonic decay vs hump-shaped
Overshooting (goes negative after being positive)
5 Statistical significance:
Does confidence band include zero?
If yes at some horizon: effect not significant 49 / 59
Exercise 6.3: Economic Interpretation Example
Solution
Example interpretation: Suppose the IRF shows:
Impact: 0.02 (horizon 0)
Peak: 0.08 at horizon 3
Returns to zero: around horizon 12
Confidence bands: exclude zero for horizons 0–8
Economic story: “A positive 1-standard-deviation shock to employment
leads to:
An immediate increase in productivity of 0.02%
The peak effect of 0.08% occurs after 3 quarters
The effect gradually dissipates, becoming statistically insignificant
after 2 years
This pattern suggests that increased employment boosts productivity
through learning-by-doing and scale effects, but the effect is
temporary” 50 / 59
Bonus Exercise: SVAR Identification

Bonus Question: Alternative Identification Schemes

Consider a monetary policy VAR with three variables:


yt : Output gap
πt : Inflation
rt : Interest rate (policy instrument)

Questions:
1 Under Cholesky ordering (y , π, r ), what does the identification
assume about monetary policy?
2 Is this assumption realistic? Why or why not?
3 Propose an alternative identification strategy
4 What external instrument could you use for monetary policy shocks?

51 / 59
Bonus Exercise: Solution (Part 1)
Solution
Question 1: Cholesky (y , π, r ) assumption Recursive structure:

yt = f (yt−1 , πt−1 , rt−1 ) + εyt


πt = g (yt , πt−1 , rt−1 ) + επt
rt = h(yt , πt , rt−1 ) + εrt

Implications:
Output shocks affect inflation and interest rate contemporaneously
Inflation shocks affect interest rate contemporaneously (but not
output)
Interest rate shocks affect nothing contemporaneously
Economic interpretation:
Central bank observes yt and πt and sets rt accordingly (within
period)
Monetary policy has no contemporaneous effect on output/inflation
52 / 59
Bonus Exercise: Solution (Part 2)

Solution
Question 2: Is this realistic?
Potential problems:
Information lag: Central bank may not observe yt , πt in real time
(data released with delay)
Decision lag: Monetary policy committee meets periodically (not
continuously)
Financial markets: Interest rate changes affect asset prices,
exchange rates immediately
Expectations: Forward-looking agents react to policy announcements

53 / 59
Bonus Exercise: Solution (Part 3)

Solution
Question 3: Alternative identification
Option 1: Reverse ordering (r , π, y )
Assumes policy affects inflation and output contemporaneously
But then: output can’t affect policy within period (unrealistic!)
Option 2: Sign restrictions
Contractionary policy shock: r ↑, y ↓, π ↓ (at least for some horizons)
Doesn’t impose exact timing of effects

54 / 59
Bonus Exercise: Solution (Part 4)
Solution
Question 4: External instruments (Proxy SVAR)
Idea: Use an instrument Zt correlated with true monetary policy shock
but uncorrelated with other shocks
Candidate instruments:
1 High-frequency identification (Gertler & Karadi, 2015):

Interest rate futures change in narrow window around FOMC


announcement
Captures “surprise” component of policy
2 Narrative approach (Romer & Romer, 2004):
Read FOMC minutes, identify intentions
Code policy changes as expansionary/contractionary
3 Policy rule residuals:
Estimate Taylor rule, use residuals as shocks
Problem: relies on correct specification
Advantage: Identification doesn’t rely on timing assumptions!
55 / 59
Summary
:
1 Stationarity Testing
Eigenvalue computation
Practical testing in R
2 Lag Length Selection
Information criteria (AIC, BIC, HQ)
Reconciling conflicting recommendations
3 Granger Causality
Hypothesis testing
Interpretation vs true causality
4 OLS Estimation
Coefficient interpretation
Statistical significance
5 VMA Representation
Deriving VMA from VAR
Computing Φ matrices
6 Impulse Response Functions
Identification problem
Cholesky decomposition
IRF interpretation 56 / 59
Key Takeaways

1 Stationarity is crucial
Always check before proceeding
Non-stationary VARs can give spurious results
2 Model selection matters
Use multiple criteria
Check residual diagnostics
3 Granger causality 6= true causality
It’s about predictive power, not mechanisms
4 Identification is key for IRFs
Reduced-form shocks are correlated
Need structure to isolate effects
Choice of identification affects conclusions
5 Always provide economic interpretation
Statistical results must connect to economic theory
IRFs tell stories about dynamic adjustment

57 / 59
Practice Recommendations
To master VAR analysis:
1 Replicate classic papers:

Sims (1980): Macroeconomics and Reality


Christiano, Eichenbaum, Evans (1999): Monetary policy shocks
Blanchard & Perotti (2002): Fiscal policy
2 Work with real data:
FRED (Federal Reserve Economic Data)
ECB Statistical Data Warehouse
IMF International Financial Statistics
3 Compare identification schemes:
How do results change with different orderings?
Try sign restrictions, external instruments
4 Read the vars package documentation:
Vignette: comprehensive examples
Function help: technical details
5 Explore extensions:
Time-varying VAR (TVP-VAR)
Bayesian VAR (BVAR)
Factor-augmented VAR (FAVAR)
58 / 59
Additional Resources

Textbooks:
Lütkepohl (2005): New Introduction to Multiple Time Series Analysis
Hamilton (1994): Time Series Analysis
Kilian & Lütkepohl (2017): Structural Vector Autoregressive Analysis

Software:
R: vars, svars, BVAR
Python: [Link]
MATLAB: built-in VAR functions, Uhlig’s toolkit

Datasets:
vars::Canada (practice dataset)
FRED-QD (quarterly macroeconomic database)
Stock & Watson macroeconomic data
59 / 59

You might also like