Lecture 7a: Vector Autoregression (VAR)

Similar documents
Lecture 7a: Vector Autoregression (VAR)

Time Series Analysis. James D. Hamilton PRINCETON UNIVERSITY PRESS PRINCETON, NEW JERSEY

Lecture 8a: Spurious Regression

Time Series Analysis for Macroeconomics and Finance

Autoregressive distributed lag models

Simultaneous Equation Models Learning Objectives Introduction Introduction (2) Introduction (3) Solving the Model structural equations

Structural VAR Models and Applications

A primer on Structural VARs

Econometría 2: Análisis de series de Tiempo

Lecture 4a: ARMA Model

Title. Description. var intro Introduction to vector autoregressive models

Lecture 8a: Spurious Regression

Time Series Analysis. James D. Hamilton PRINCETON UNIVERSITY PRESS PRINCETON, NEW JERSEY

Structural VARs II. February 17, 2016

Vector autoregressions, VAR

Multivariate Time Series Analysis and Its Applications [Tsay (2005), chapter 8]

ECON 4160, Spring term Lecture 12

Class 4: VAR. Macroeconometrics - Fall October 11, Jacek Suda, Banque de France

Notes on Time Series Modeling

Multivariate Time Series: VAR(p) Processes and Models

Econ 423 Lecture Notes: Additional Topics in Time Series 1

Cointegrated VAR s. Eduardo Rossi University of Pavia. November Rossi Cointegrated VAR s Financial Econometrics / 56

New Introduction to Multiple Time Series Analysis

1 Teaching notes on structural VARs.

ECON 4160, Lecture 11 and 12

A Primer on Vector Autoregressions

ECON 4160, Autumn term 2017 Lecture 9

B y t = γ 0 + Γ 1 y t + ε t B(L) y t = γ 0 + ε t ε t iid (0, D) D is diagonal

Lecture 6a: Unit Root and ARIMA Models

Vector Auto-Regressive Models

VAR Models and Applications

Block Bootstrap Prediction Intervals for Vector Autoregression

ECON 4160: Econometrics-Modelling and Systems Estimation Lecture 9: Multiple equation models II

When Do Wold Orderings and Long-Run Recursive Identifying Restrictions Yield Identical Results?

1 Teaching notes on structural VARs.

FINANCIAL ECONOMETRICS AND EMPIRICAL FINANCE -MODULE2 Midterm Exam Solutions - March 2015

Financial Econometrics

VAR Model. (k-variate) VAR(p) model (in the Reduced Form): Y t-2. Y t-1 = A + B 1. Y t + B 2. Y t-p. + ε t. + + B p. where:

Unit roots in vector time series. Scalar autoregression True model: y t 1 y t1 2 y t2 p y tp t Estimated model: y t c y t1 1 y t1 2 y t2

CHAPTER 21: TIME SERIES ECONOMETRICS: SOME BASIC CONCEPTS

Multivariate forecasting with VAR models

10. Time series regression and forecasting

Structural Vector Autoregressions with Markov Switching. Markku Lanne University of Helsinki. Helmut Lütkepohl European University Institute, Florence

Vector Autoregression

Advanced Econometrics

Stationarity and Cointegration analysis. Tinashe Bvirindi

1. Shocks. This version: February 15, Nr. 1

It is easily seen that in general a linear combination of y t and x t is I(1). However, in particular cases, it can be I(0), i.e. stationary.

Multivariate Time Series

Identifying the Monetary Policy Shock Christiano et al. (1999)

Empirical Market Microstructure Analysis (EMMA)

G. S. Maddala Kajal Lahiri. WILEY A John Wiley and Sons, Ltd., Publication

Vector Autogregression and Impulse Response Functions

9. Multivariate Linear Time Series (II). MA6622, Ernesto Mordecki, CityU, HK, 2006.

1 Regression with Time Series Variables

Inverse of a Square Matrix. For an N N square matrix A, the inverse of A, 1

1. Introduction. Hang Qian 1 Iowa State University

MA Advanced Macroeconomics: 4. VARs With Long-Run Restrictions

Vector error correction model, VECM Cointegrated VAR

TESTING FOR CO-INTEGRATION

Computational Macroeconomics. Prof. Dr. Maik Wolters Friedrich Schiller University Jena

Lecture#17. Time series III

Bootstrapping the Grainger Causality Test With Integrated Data

Multivariate Models. Christopher Ting. Christopher Ting. April 19,

Multivariate Time Series: Part 4

Motivation for multiple regression

2.5 Forecasting and Impulse Response Functions

1.2. Structural VARs

Oil price and macroeconomy in Russia. Abstract

MAT3379 (Winter 2016)

A Non-Parametric Approach of Heteroskedasticity Robust Estimation of Vector-Autoregressive (VAR) Models

07 Multivariate models: Granger causality, VAR and VECM models. Andrius Buteikis,

Factor models. May 11, 2012

Økonomisk Kandidateksamen 2004 (I) Econometrics 2. Rettevejledning

A. Recursively orthogonalized. VARs

EC408 Topics in Applied Econometrics. B Fingleton, Dept of Economics, Strathclyde University

Bayesian Graphical Models for Structural Vector AutoregressiveMarch Processes 21, / 1

Vector Autoregression

The Linear Regression Model

Cointegrated VAR s. Eduardo Rossi University of Pavia. November Rossi Cointegrated VAR s Fin. Econometrics / 31

Factor models. March 13, 2017

Lecture: Simultaneous Equation Model (Wooldridge s Book Chapter 16)

(I AL BL 2 )z t = (I CL)ζ t, where

Econometrics II. Seppo Pynnönen. Spring Department of Mathematics and Statistics, University of Vaasa, Finland

Moreover, the second term is derived from: 1 T ) 2 1

11. Further Issues in Using OLS with TS Data

Predicting bond returns using the output gap in expansions and recessions

Visualizing VAR s: Regularization and Network Tools for High-Dimensional Financial Econometrics

Variance Decomposition

Econometrics Honor s Exam Review Session. Spring 2012 Eunice Han

Cointegration, Stationarity and Error Correction Models.

Econometrics I KS. Module 2: Multivariate Linear Regression. Alexander Ahammer. This version: April 16, 2018

Introductory Workshop on Time Series Analysis. Sara McLaughlin Mitchell Department of Political Science University of Iowa

Handout 12. Endogeneity & Simultaneous Equation Models

Econometric Methods for Panel Data

Circle the single best answer for each multiple choice question. Your choice should be made clearly.

Variable Targeting and Reduction in High-Dimensional Vector Autoregressions

End-Semester Examination MA 373 : Statistical Analysis on Financial Data

VAR Models and Cointegration 1

2. Multivariate ARMA

Transcription:

Lecture 7a: Vector Autoregression (VAR) 1

Big Picture We are done with univariate time series analysis Now we switch to multivariate analysis, that is, studying several time series simultaneously. VAR is one of the most popular multivariate models 2

VAR(1) Consider a bivariate system (y t, x t ). For example, y t is the inflation rate, and x t is the unemployment rate. The relationship between them is Phillips Curve. The first order VAR for this bivariate system is y t = ϕ 11 y t 1 + ϕ 12 x t 1 + u t (1) x t = ϕ 21 y t 1 + ϕ 22 x t 1 + v t (2) So each variable depends on the first lag of itself and the other variable. 3

Matrix Form The matrix form for VAR(1) is y t x t = ϕ 11 ϕ 12 ϕ 21 ϕ 22 y t 1 x t 1 + u t v t (3) or where z t = y t x t z t = ϕz t 1 + w t (Reduced Form) (4), ϕ = ϕ 11 ϕ 12 ϕ 21 ϕ 22, and w t = u t v t 4

Stationarity Condition 1. (y t, x t ) are both stationary when the eigenvalues of ϕ are less than one in absolute value. 2. (y t, x t ) are both integrated of order one, and y t and x t are cointegrated when one eigenvalue is unity, and the other eigenvalue is less than one in absolute value. 3. (y t, x t ) are both integrated of order two if both eigenvalues of ϕ are unity. 5

OLS Estimation 1. Each equation in the VAR can be estimated by OLS. 2. Then the variance covariance matrix for the error vector Ω = Ew t w t = σ2 u σ u,v σ u,v σv 2 can be estimated by Ω = T 1 û2 t ûtˆv t ûtˆv t ˆv 2 t where û t and ˆv t are residuals. 6

Granger Causality The Granger Causality (GC) test is concerned with whether lagged x t helps explain y t, and vice versa. The null hypotheses are H 0 : ϕ 12 = 0 (x does not Granger cause y) (5) H 0 : ϕ 21 = 0 (y does not Granger cause x) (6) We can test each null hypothesis using the F test. The null hypothesis is rejected when the p-value is less than 0.05. 7

Warning Granger Causality Causality. Granger causality is about in-sample fitting. It tells nothing about out-of-sample forecasting. 8

Impulse Response Using the lag operator we can show the MA( ) representation for the VAR(1) is z t = w t + ϕw t 1 + ϕ 2 w t 2 +... + ϕ j w t j +... (7) The coefficient in the MA representation measures the impulse response: ϕ j = dz t dw t j (8) Note ϕ j is a 2 2 matrix for a bivariate system. 9

Impulse Response II More generally, denote the (m, n)-th component of ϕ j by ϕ j (m, n) Then ϕ j (m, n) measures the response of m-th variable to the n-th error after j periods. For example, ϕ 3 (1, 2) measures the response of first variable to the error of the second variable after 3 periods. 10

Impulse Response III We can plot the impulse response against j. That is, for a given impulse response plot, we let j varies while holding m and n constant. For a bivariate system, there are four impulse responses plots. 11

Impulse Response IV In general u t and v t are contemporaneously correlated (not-orthogonal), i.e., σ u,v 0 Therefore we can not, say, hold v constant and let only u vary. However, we can always find a lower triangular matrix A so that Ω = AA (Cholesky Decomposition) (9) Then define a new error vector w t as (linear transformation of old error vector w t ) w t = A 1 w t (10) By construction the new error is orthogonal because its variance-covariance matrix is diagonal: var( w t ) = A 1 var(w t )A 1 = A 1 ΩA 1 = A 1 AA A 1 = I 12

Cholesky Decomposition Let A = a 0 b c. The Cholesky Decomposition tries to solve a 0 b c a b 0 c = σ2 u σ u,v σ u,v σv 2 The solutions for a, b, c always exist and they are a = σ 2 u (11) b = σ u,v σ 2 u (12) c = σ 2 v σ2 u,v σ 2 u (13) 13

Positive Definite Matrix Note c is always a real number since Ω is a variance-covariance matrix, and so is positive definite (i.e., σv 2 σ2 u,v σ is always positive u 2 because the determinant of Ω, or the second leading principal minor, is positive). 14

Impulse Response to Orthogonal Errors Rewrite the MA( ) representation as z t = w t + ϕw t 1 +... + ϕ j w t j +... (14) = AA 1 w t + ϕaa 1 w t 1 +... + ϕ j AA 1 w t j +... (15) = A w t + ϕa w t 1 +... + ϕ j A w t j +... (16) This implies that the impulse response to the orthogonal error w t after j periods is where A satisfies (9). j-th orthogonal impulse response = ϕ j A (17) 15

Reduced Form and Structural Form 1. (4) is called reduced form and the reduced form error w t is not orthogonal. 2. The so called structural form is a linear transformation of the reduced form: z t = ϕz t 1 + w t (18) A 1 z t = A 1 ϕz t 1 + A 1 w t (19) A 1 z t = A 1 ϕz t 1 + w t (20) where the structural form error w t is orthogonal. 16

Inverse of Matrix Let M = M 1, is a c b d be a 2 2 matrix. The inverse of M, denoted by M 1 = ( ) 1 d b ad bc c a where ad bc is the determinant of M : M = ad bc. You can check that MM 1 = M 1 M = I 17

Structural Form 1. The Structural Form VAR is A 1 z t = A 1 ϕz t 1 + w t (Structural Form) (21) 2. Note A 1 is lower triangular. So A 1 z t = 1/a 0 y t b/(ac) 1/c x t = (1/a)y t ( b/(ac))y t + (1/c)x t 3. That means x t will not appear in the regression for y t, whereas y t will appear in the regression for x t. 4. This may not hold in practice. 18

Structural Form VAR I In general, the structural form VAR(1) is z t = ϕz t 1 + B w t (22) or equivalently B 1 z t = B 1 ϕz t 1 + w t (23) Because B 1 is generally not diagonal, y t and x t are related contemporaneously in the structural form. 19

Why is it called structural form? 1. Because in the structural VAR there is instantaneous interaction between y t and x t. 2. Both y t and x t are endogenous, and the regressors include the current value of endogenous variables in the structural form. 3. The structural VAR is one example of the simultaneous equation model (SEM) 4. We cannot estimate the structural VAR using per-equation OLS, due to the bias of simultaneity. 5. We can estimate the reduced form using per-equation OLS. Then we recover the structural form from the reduced form, with (identification) restriction imposed. 20

Structural Form VAR II 1. Because we use B 1 to account for the contemporaneous correlation, we can always (safely) assume the structural error is orthogonal, i.e., var( w t ) = I. 2. The structural form error vector and reduced form error vector are related since B w t = w t 21

Structural Form VAR III 1. Let Ω = E(w t w t) be the observed variance covariance matrix. It follows that BB = Ω 2. The goal of structural VAR analysis is to obtain B, which is not unique (for a bivariate system Ω has 3 unique elements, while B has 4 elements to be determined). 3. The Sims (1980) structural VAR imposes the restriction that B is lower triangular. 4. The Blanchard Quah structural VAR obtains B by looking at the long run effect of the w t. 22

MA Representation Consider a univariate AR(p) y t = ϕ 1 y t 1 +... + ϕ p y t p + e t Using the lag operator we can write (1 ϕ 1 L... + ϕ p L p )y t = e t We can obtain the MA representation by inverting the lag polynomial (1 ϕ 1 L... + ϕ p L p ) : y t = (1 ϕ 1 L... + ϕ p L p ) 1 e t = e t + θ 1 e t 1 + θ 2 e t 2 +... 23

Long Run Effect The long run effect (LRE) of e t is LRE dy t de t + dy t+1 de t + dy t+2 de t +... (24) = 1 + θ 1 + θ 2 +... (25) = (1 ϕ 1... + ϕ p ) 1 (26) In words, we need to invert the lag polynomial (1 ϕ 1 L... + ϕ p L p ) after replacing L with number 1. 24

Blanchard Quah (BQ) Decomposition I 1. The long run effect of B w t in the structural VAR(1) is (I ϕ) 1 B Q 2. BQ assumes the long run effect is a lower triangular matrix. That is, Q is the Cholesky decomposition of 3. Then B matrix can be solved as QQ = (I ϕ) 1 Ω(I ϕ) 1 B = (I ϕ)q. 25

Blanchard Quah (BQ) Decomposition II In Blanchard and Quah (1989, AER) paper, the authors assume that the demand shock (the first structural error ũ t ) have zero long run effect on GDP, while the supply shock (the second structural error ṽ t ) has nonzero long run effect on GDP. 26

VAR(p) 1. More generally, a p-th order reduced-form VAR is z t = ϕ 1 z t 1 + ϕ 2 z t 2 +... + ϕ p z t p + w t (27) 2. For a bivariate system, z t is a 2 1 vector, and ϕ i, (i = 1,..., p), is 2 2 matrix 3. Rigorously speaking we need to choose a big enough p so that w t is serially uncorrelated (and the resulting model is dynamically adequate). 4. But in practice, many people choose p by minimizing AIC. 27

MA( ) Representation 1. For VAR(1) we can obtain the impulse response by looking at its MA( ) representation. 2. But for VAR(p) it is difficult to derive the MA( ) representation. 3. Instead, we simulate the impulse response for VAR(p) 28

Simulate Impulse Response I 1. Consider a VAR(2) for a bivariate system z t = ϕ 1 z t 1 + ϕ 2 z t 2 + w t (28) 2. Suppose we want to obtain the impulse response to the first structural error. That is, we let w t = 1 0, w t+i = 0, (i = 1, 2,...) 3. From (10) we can compute the corresponding reduced-form error as w t = A w t, which picks the first column of A. Denoted it by A(1c). 29

Simulate Impulse Response II Denote the impulse response after j periods by IR(j), which is a 2 1 vector. It can be computed recursively as IR(1) = A(1c) (29) IR(2) = ϕ 1 IR(1) (30) IR(3) = ϕ 1 IR(2) + ϕ 2 IR(1) (31)... =... (32) IR(j) = ϕ 1 IR(j 1) + ϕ 2 IR(j 2) (33) To get the impulse response to the second structural form error, just let w t = 0 1 and A(1c) should change to A(2c). Everything else remains unchanged. 30

Interpret Impulse Response For VAR, it is more useful to report the impulse response than the autoregressive coefficient Impulse response is useful for policy analysis. It can answer question like what will happen to GDP after j periods if a demand shock happens now? 31

Exercise How to obtain the orthogonal impulse response using the Blanchard Quah decomposition? 32

Lecture 7b: VAR Application 33

Big Picture We will run VAR(1) using simulated data We know the true data generating process, and we can evaluate the preciseness of the estimate. Running VAR using real data will be left as exercise 34

Package vars First we need to download and install the package vars The PDF file of the manual for this package can be found at cran.r-project.org/web/packages/vars/vars.pdf Then we can load the package using library(vars) 35

Data Generating Process (DGP) The DGP is a bivariate VAR(1) with the coefficient matrix ϕ = 0.3 0 0.5 0.6 and z t = y t x t, w t = u t v t 1. The eigenvalues of ϕ are 0.3 and 0.6. Both are less than unity. So both series in this system are stationary. 2. By construction, x does not Granger cause y, but y Granger causes x. Here u and v are uncorrelated, but are usually correlated in reality. 36

R set.seed(1000) # so the simulation result can be duplicated n = 200 # sample size = 200 z = as.matrix(cbind(rep(0, n),rep(0, n))) w = as.matrix(cbind(rnorm(n), rnorm(n))) phi = as.matrix(cbind(c(0.3, 0.5), c(0, 0.6))) for (i in 2:n) { z[i,] = phi %*% z[i-1,] + w[i,] } 37

Unit Root Test In practice we always test unit roots for each series before running VAR. The commands are adf.test(z[,1], k = 1) adf.test(z[,1], k = 4) adf.test(z[,2], k = 1) adf.test(z[,2], k = 4) In this case, unit root is rejected (with p-value less than 0.05), so VAR can be applied. If unit roots cannot be rejected then 1. Running VAR using differenced data if series are not cointegrated 2. Running Error Correction Model is series are cointegrated 38

Selecting the Lag Number p In theory we should include sufficient lagged values so that the error term is serially uncorrelated. In practice, we can choose p by minimizing AIC VARselect(z) In this case, the VAR(1) has the smallest AIC -0.06176601, and so is chosen. 39

Estimate VAR var.1c = VAR(z, p=1, type = "both") summary(var.1c) var.1c = VAR(z, p=1, type = "none") summary(var.1c) 1. We start with a VAR(1) with both intercept term and trend term. Then we both terms are insignificant. 2. Next we run VAR(1) without intercept term or trend. 40

Result The estimation result for y (the first series) is Estimate Std.Error t value Pr(> t ) y1.l1 0.25493 0.06887 3.702 0.000278 *** y2.l1-0.05589 0.04771-1.171 0.242875 1. ˆϕ11 = 0.25493, close to the true value 0.3 2. ˆϕ12 = 0.05589, and is insignificant So the estimated regression for y t is y t = 0.25493y t 1 0.05589x t 1 Exercise: find the estimated regression for x t 41

Equation-by-Equation OLS Estimation We can get the same result by using these commands y = z[,1] ylag1 = c(na, y[1:n-1]) x = z[,2] xlag1 = c(na, x[1:n-1]) eqy = lm(y~ylag1+xlag1-1) summary(eqy) # without intercept Exercise: What are the R commands that estimate the regression for x (the second series)? 42

Variance-Covariance Matrix I The true variance-covariance matrix (VCM) for the vector of error terms are identity matrix Ω = E(w t w t) = E u t ( ) u t v t = 1 0 0 1 v t The estimated VCM is Ω = 0.9104 0.0391 0.0391 0.9578 which is close to the true VCM. 43

Variance-Covariance Matrix II To get Ω we need to keep the residuals and then compute two variances and one covariance (with adjustment of degree of freedom) sigmau2 = var(resy)*(n-1)/(n-2) sigmav2 = var(resx)*(n-1)/(n-2) sigmauv = cov(resy,resx)*(n-1)/(n-2) omegahat = as.matrix(cbind(c(sigmau2, sigmauv), c(sigmauv, sigmav2) 44

Cholesky Decomposition of Ω The Cholesky Decomposition is Ω = AA where A is lower triangular matrix. But the R function chol returns A so we need to transpose it in order to get A : The R commands are Aprime = chol(omegahat) A = t(aprime) A = (A ) The matrix A will be used to construct impulse response to orthogonal (or structural form) errors 45

Impulse Response to Orthogonal Errors The responses of y and x to the one-unit impulse of the orthogonal (structural-form) the error for y can be obtained as wtilde = as.matrix(c(1,0)) A1c = A%*%wtilde # or A1c = A[,1] if1 = A1c if2 = phihat%*%if1 if3 = phihat%*%if2 if4 = phihat%*%if3 46

Impulse Response to Orthogonal Errors II You can get the same result using the R command var1c.11 = irf(var.1c, impulse = "y1", response="y1", boot=true) var1c.11 plot(var1c.11) var1c.21 = irf(var.1c, impulse = "y1", response="y2", boot=true) var1c.21 plot(var1c.21) 47

Granger Causality Test The R command is causality(var.1c, cause = c("y2")) causality(var.1c, cause = c("y1")) The results are consistent with the DGP Granger causality H0: y2 do not Granger-cause y1 F-Test = 1.372, df1 = 1, df2 = 394, p-value = 0.2422 Granger causality H0: y1 do not Granger-cause y2 F-Test = 69.3042, df1 = 1, df2 = 394, p-value = 1.443e-15 48