D:\687303163.doc EXERCISE ON ESTIMATING A STRUCTURAL VAR IN EVIEWS Introduction The aim of this exercise is to describe the basic steps to estimate a structural VAR and studying impulse response curves in EViews. We use Australian data for our examples in this exercise. The dataset is quarterly data spanning 21 years: 1980Q1 - 2001Q1 Preparations Enter EViews and choose: File Open dataset And select Svardata.wf1 and click OK 1 D:\687303163.doc 1 Defining the model We define a simple model of an economy (in this case Australia) for the estimate of the VAR, with four endogenous variables1: Inflation (INF), Real exchange rate (REER), Interest rate (INTEREST), and Output gap (GAP). Q1. Before we estimate our model, what should we do to ensure that our estimates are not biased? Answer: We use OLS to estimate the VARS so we need to ensure that all variables are stationary to avoid the spurious regression problem associated with unit roots. Check for stationarity or otherwise of the four variables (see Unit Root exercise). We assume that all four variables are stationary I(0) variables for simplicity. Q2. Estimate an unrestricted VAR with all four endogenous variables in their stationary form with a constant. Answer: Use Quick, Estimate VAR or type in the command window: var var01.ls 1 5 INTEREST GAP INF REER, this command specifies a VAR estimate with the name var01 of the four variables (interest in difference note) and a lag length of 5. Vector Autoregression Estimates Date: 11/19/02 Time: 12:45 Sample(adjusted): 1981:2 2001:4 Included observations: 83 after adjusting endpoints Standard errors in ( ) & t-statistics in [ ] INTEREST(-1) . . . C R-squared Adj. R-squared Sum sq. resids S.E. equation F-statistic Log likelihood Akaike AIC Schwarz SC Mean dependent S.D. dependent INTEREST GAP INF REER 0.983846 (0.12698) [ 7.74811] 0.001558 (0.00086) [ 1.81260] 0.209413 (0.09527) [ 2.19814] 0.622813 (0.40982) [ 1.51972] -0.325614 (1.57990) [-0.20610] 0.013497 (0.01069) [ 1.26221] 1.355519 (1.18535) [ 1.14356] 12.57886 (5.09909) [ 2.46688] 0.950040 0.933923 73.04422 1.085418 58.94917 -112.4692 3.216126 3.828121 9.580241 4.222534 0.809195 0.747645 0.003346 0.007346 13.14695 302.1585 -6.774905 -6.162909 -0.000263 0.014624 0.958091 0.944572 41.11679 0.814355 70.86924 -88.62130 2.641477 3.253473 5.088072 3.458975 0.959035 0.945821 760.8750 3.503167 72.57452 -209.7205 5.559530 6.171525 111.2133 15.05025 Determinant Residual Covariance Log Likelihood (d.f. adjusted) Akaike Information Criteria Schwarz Criteria 1 0.000461 -152.2836 5.693581 8.141564 Variable names in dataset in parenthesis. 2 D:\687303163.doc Q3. We've selected a lag length of 5 for this estimate but is that appropriate? Answer: Adding more lags always improves the fit but it reduces the degrees of freedom and increases the danger of overfitting. An objective and replicable way to decide between these competing objectives is to maximise some weighted measures of these two parameters. This is how the Akaike Information criterion (AIC) and the Schwarz-Bayesian criterion (SBC) work. These two statistics are measures of the trade-off fit against loss of degrees of freedom so that the best lag length should minimise2 both of them. An alternative to minimising a weighted measure of the lag length and best fit, as above, is to systematically test for the significance of each lag using a likelihood ratio test (discussed in Lutkepohl, 1991, section 4.3). Since a VAR of lag length n nests the same VAR of lag length (n-1), the log likelihood difference multiplied by the number of observations less the number of regressors in the VAR should be distributed as a Chi-sq distribution with 2k degree of freedom, 2(2k) i.e. LR = (T-m) {logn-1- logn} ~ 2(2k) Where T is the number of observations, m is the number of regressors , logn is the log likelihood of the VAR with n lags. The idea is that for each lag length, if there is no improvement in the fit from the inclusion of this last lag then the difference in errors should not be significantly different from white noise. For our example, we use a general-to-specific specification (although some authors might specify a specific-to-general instead). (i) We start with a large lag length (say 10). (ii) For each lag, say n, note its log likelihood then calculate the log likelihood for a VAR of lag (n-1) (iii) Take the difference of the log likelihoods (iv) This difference in (iii) should be distributed as a Chi-sq distribution with eight degrees of freedom 2(8) if it is superfluous. Q4. Test for the number of lags using the AIC, SC, and the likelihood ratio test for the appropriate lag length in the VAR Answer: with the VAR open select VIEW/ LAG STRUCTURE/ LAG LENGTH CRITERIA then enter 10 in the maximum lag specification. The readout should be: 2 Some programs maximise the negative of these measures. 3 D:\687303163.doc VAR Lag Order Selection Criteria Endogenous variables: INTEREST GAP INF REER Exogenous variables: C Date: 11/19/02 Time: 12:34 Sample: 1980:1 2001:4 Included observations: 78 Lag LogL LR FPE AIC SC HQ 0 1 2 3 4 5 6 7 8 9 10 -459.7154 -169.8935 -152.9814 -137.4222 -125.4949 -95.16905 -80.29215 -60.13943 -51.09151 -30.89014 -19.16174 NA 542.4870 29.92147 25.93198 18.65545 44.32243* 20.21733 25.32009 10.43991 21.23733 11.12694 1.713665 0.001531 0.001501 0.001531 0.001726 0.001227* 0.001314 0.001249 0.001612 0.001606 0.002055 11.89014 4.869064 4.845676 4.856979 4.961408 4.594078 4.622876 4.516396* 4.694654 4.586927 4.696455 12.01099 5.473349* 5.933388 6.428118 7.015975 7.132072 7.644297 8.021245 8.682931 9.058631 9.651586 11.93852 5.110970* 5.281107 5.485935 5.783889 5.610084 5.832406 5.919451 6.291234 6.377032 6.680085 * indicates lag order selected by the criterion LR: sequential modified LR test statistic (each test at 5% level) FPE: Final prediction error AIC: Akaike information criterion SC: Schwarz information criterion HQ: Hannan-Quinn information criterion The correct lag length will depend on the criteria or measure we use. This is typical of these tests and researchers often use the criterion most convenient for their needs. The SC criterion is generally more conservative in terms of lag length than the AIC criterion. Here we assume a lag length of 1 for convenience. 2 VAR identification We have an underlying structural equation of the form: Ayt C ( L) yt Bu t (1) where the stochastic error ut is normally distributed i.e. ut N(0,I). Unfortunately we cannot estimate this equation directly due to identification issues, but instead we have estimated an unrestricted VAR of the form: yt A1C ( L) yt A1 Bu t (2) Matrices A B and C are not separately observable. So how can we recover equation (1) from (2)? The solution is to impose restrictions on our VAR to identify an underlying structure but kind of restrictions are these? Economic theory can sometime tell us something about the structure of the system we wish to estimate. As economists, we must interpret these structure or assumption from theory into restrictions on the VAR. Such restrictions can include for example: 1. Causal ordering of shock propagation e.g. Cholesky decomposition 2. Nominal variables to have no long run effect on real variables 3. Long run behaviour of variables e.g. real exchange rate is constant in the long run 4 D:\687303163.doc There are two types of restrictions, one type imposes restrictions on the short-run behaviour of the system, and the other type imposes restrictions on the long run behaviour of the system. EViews allows either short run or long run identifying restrictions, but not both types in one VAR. Moreover, it also assumes that matrix B is an invertable square matrix i.e. there are no identities in the system. 3 Imposing Short Run Restrictions To impose short run restrictions in EViews we use equation (2): yt A1C ( L) yt A1 Bu t We can estimate the random stochastic residual A-1But from the residual et of the estimated unrestricted VAR: A 1 Bu t et (3) Reformulating equation (3) we have A 1 Bu t ut ' B' A' 1 et et ' , and since u t u t ' I , we have: A 1 BB ' A'1 et et ' (4) Equation (4) says that if there are k variables, the symmetry property above imposes k(k+1)/2 restrictions on the 2k2 unknown elements in A and B. Hence an additional k(3k-1)/2 restrictions must be imposed. EViews requires that such restriction schemes must be of the form: Aet Bu t (5) By imposing a structure on matrices A and B, we necessarily impose restrictions on the structural VAR in equation (1). An example of this specification using the Cholesky decomposition identification scheme is: 1 a A = 21 a 31 a 41 0 1 0 0 a32 a 42 1 a 43 0 0 ,B= 0 1 a11 0 0 0 0 0 a 22 0 0 0 a33 0 0 0 0 a 44 For our example, we have a VAR with four endogenous variables, therefore we require 22 = 4(3*4-1)/2 restrictions. We can impose this restriction in EViews in either matrix form or in text form. Imposing restrictions in matrix form is relatively straightforward, so we explain the text form instead.3 3 Restriction using text form is also more flexible, as we can restrict values to be equal. 5 D:\687303163.doc Q5. Impose the Cholesky decomposition. Assumes that shocks or innovations are propagated in the order of INTEREST, GAP, INF and then REER, Answer: To impose the restriction above in text format, we select Procs/Estimate Structural Factorization from the VAR window menu. In the SVAR Options dialog, select Text (or Matrix is appropriate). Each endogenous variable has an associated variable number, in our example this is: @e1 for INTEREST residuals @e2 for GAP residuals @e3 for INF residuals @e4 for REER residuals The identifying restriction is imposed in terms of variables e's which are the residuals from the VAR estimates, and variables u's which are the fundamental or 'primitive' random (stochastic) errors in the structural system. Enter the following the text box: @e1 = C(1)*@u1 @e2 = C(2)*@e1 + C(3)*@u2 @e3 = C(4)*@e1 + C(5)*@e2 + C(6)*@u3 @e4 = C(7)*@e1 + C(8)*@e2 + C(9)*@e3 + C(10)*@u4 To use the matrix form to impose a restriction, create two matrices with the following values (we call them A and B here) 0 0 1 0 NA 1 A = NA NA 1 NA NA NA 0 0 ,B= 0 1 0 0 NA 0 0 0 NA 0 0 0 NA 0 0 0 0 NA Select the matrix specification in the structural factorisation described above and enter the names of the matrices (A and B) as appropriate: The output is: 6 D:\687303163.doc Structural VAR Estimates Sample(adjusted): 1981:2 2001:4 Included observations: 83 after adjusting endpoints Estimation method: method of scoring (analytic derivatives) Convergence achieved after 12 iterations Structural VAR is just-identified Model: Ae = Bu where E[ee']=I Restriction Type: short-run pattern matrix A= 1 0 C(1) 1 C(2) C(4) C(3) C(5) B= C(7) 0 0 C(8) 0 0 0 0 0 0 1 C(6) 0 0 0 1 0 0 C(9) 0 0 0 0 C(10) Coefficient Std. Error z-Statistic Prob. C(1) C(2) C(3) C(4) C(5) C(6) C(7) C(8) C(9) C(10) -0.001066 -0.091071 0.329808 1.055599 -48.42839 0.965941 1.085418 0.007255 0.808446 3.372914 0.000734 0.082789 0.347913 12.23200 51.03540 0.457947 0.084245 0.000563 0.062748 0.261789 -1.453529 -1.100032 0.947961 0.086298 -0.948918 2.109284 12.88410 12.88410 12.88410 12.88410 0.1461 0.2713 0.3431 0.9312 0.3427 0.0349 0.0000 0.0000 0.0000 0.0000 Log likelihood -152.2836 0.000000 1.000000 1.055599 -48.42839 0.000000 0.000000 1.000000 0.965941 0.000000 0.000000 0.000000 1.000000 0.000000 0.007255 0.000000 0.000000 0.000000 0.000000 0.808446 0.000000 0.000000 0.000000 0.000000 3.372914 Estimated A matrix: 1.000000 -0.001066 -0.091071 0.329808 Estimated B matrix: 1.085418 0.000000 0.000000 0.000000 4 Imposing Long Run Restrictions To impose long run restrictions, we return to the unrestricted VAR estimate: yt A1C ( L) yt A1 Bu t Rearrangement of this equation reveals equation (5) below: [ I A 1C ( L)] y t A 1 Bu t y t [ I A 1C ( L)] 1 A 1 Bu t (6) 7 D:\687303163.doc Equation (6) shows how the random (stochastic) shocks affect the long-run levels of the variables. If we define a matrix C [ I A 1C ( L)] 1 A 1 B , the aggregate effect of a shock u's is given by matrix C. Hence if we assume that the (long run) cumulative effect of a sub-shock ui on a variable yj is zero, then column i and row j of matrix C should be zero. Knowing the values of matrix C tells us something about matrices A and B. Due to the number of restrictions required EViews also imposes the restriction that matrix A is the identity matrix. It uses matrix C to estimate matrix B. Long run imposition can be specified in matrix form (were matrix C is entered) or in text form in EViews. Going back to our example, we know that we must have at least 22 restrictions. Matrix A is assumed to be the identity matrix. This is equivalent to 16 restrictions so a further 6 restrictions must be imposed in matrix C. We have the following variable numeration: Q6. Impose the following (arbitrary) restriction to matrix C: (i) The two nominal variable (INTERST and INF) have no long run real effect, and (ii) INF shocks have no long run effect on other variables (iii) Gap is unaffected by any shocks but its own Answer: In matrix form this is: NA 0 C= NA 0 NA 0 NA NA 0 0 NA NA NA NA 0 NA In the text form restriction is: @LR1(@U3)=0 @LR2(@U1)=0 @LR2(@U3)=0 @LR2(@U4)=0 @LR4(@U1)=0 @LR4(@U3)=0 The output is: 8 D:\687303163.doc Structural VAR Estimates Sample(adjusted): 1980:2 2001:4 Included observations: 87 after adjusting endpoints Estimation method: method of scoring (analytic derivatives) Convergence achieved after 13 iterations Structural VAR is just-identified Model: Ae = Bu where E[ee']=I Restriction Type: long-run text form Long-run response pattern: C(1) C(3) 0 C(4) C(2) C(5) 0 C(6) 0 0 C(7) 0 C(8) 0 C(9) C(10) Coefficient Std. Error z-Statistic Prob. C(1) C(2) C(3) C(4) C(5) C(6) C(7) C(8) C(9) C(10) 10.96752 8.536423 -13.50216 -0.031006 -7.593409 -27.08645 5.160389 16.85658 14.40233 71.07902 0.831445 0.851401 2.386708 0.002351 1.964504 7.892281 0.391208 1.736553 1.528329 5.388486 13.19091 10.02632 -5.657231 -13.19091 -3.865306 -3.432018 13.19091 9.706919 9.423579 13.19091 0.0000 0.0000 0.0000 0.0000 0.0001 0.0006 0.0000 0.0000 0.0000 0.0000 Log likelihood -200.6625 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 -0.022506 0.007326 -0.430771 0.327101 -0.298165 0.000116 0.470101 -3.389196 0.025184 0.002695 0.700787 1.608676 Estimated A matrix: 1.000000 0.000000 0.000000 0.000000 Estimated B matrix: 1.101966 0.002579 0.281968 -1.833790 5 Generating impulse responses Q7. Generate impulse response curves for the identification scheme in our example. Answer: Selecting VIEW/IMPULSE RESPONSES, on the IMPULSE DEFINITION tag select STRUCTURAL DECOMPOSITION. This option shows the impulse response of each variable from shocks to the underlying fundamental shocks (u's). 9 D:\687303163.doc Response to Structural One S.D. Innovations Response of INTEREST to Shock1 Response of INTEREST to Shock2 Response of INTEREST to Shock3 Response of INTEREST to Shock4 1.2 1.2 1.2 1.2 0.8 0.8 0.8 0.8 0.4 0.4 0.4 0.4 0.0 0.0 0.0 0.0 -0.4 -0.4 1 2 3 4 5 6 7 8 9 10 -0.4 1 Response of GAP to Shock1 2 3 4 5 6 7 8 9 10 -0.4 1 Response of GAP to Shock2 2 3 4 5 6 7 8 9 10 1 Response of GAP to Shock3 .008 .008 .008 .006 .006 .006 .006 .004 .004 .004 .004 .002 .002 .002 .002 .000 .000 .000 2 3 4 5 6 7 8 9 10 1 Response of INF to Shock1 2 3 4 5 6 7 8 9 10 Response of INF to Shock2 2 3 4 5 6 7 8 9 10 1 Response of INF to Shock3 .8 .8 .6 .6 .6 .4 .4 .4 .4 .2 .2 .2 .2 .0 .0 .0 .0 -.2 -.2 -.2 -.2 -.4 -.4 -.6 1 2 3 4 5 6 7 8 9 10 Response of REER to Shock1 2 3 4 5 6 7 8 9 10 Response of REER to Shock2 2 3 4 5 6 7 8 9 10 1 Response of REER to Shock3 3 3 2 2 2 2 1 1 1 1 0 0 0 0 -1 -1 -1 -1 -2 -2 -2 -2 -3 -3 -3 -4 2 3 4 5 6 7 8 9 10 2 3 4 5 6 7 8 9 10 9 10 2 3 4 5 6 7 8 9 10 2 3 4 5 6 7 8 9 10 -3 -4 1 8 Response of REER to Shock4 3 1 7 -.6 1 3 -4 6 -.4 -.6 1 5 Response of INF to Shock4 .8 .6 -.6 4 .000 1 .8 -.4 3 Response of GAP to Shock4 .008 1 2 -4 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 Can you go back and replicate this for the Cholesky decomposition? How does it compare with the default Cholesky decomposition available in EViews? They should be the same. 6 Generating the ‘fundamental’ shocks From the estimated structural VAR, how can we generate the fundamental shocks i.e. ut's in equation (1), using EViews? To generate the fundamental shocks, we use equation Aet Bu t . Where et is the error or residual from the VAR regression which has been generated, and matrices A and B identified in the estimated SVAR. The fundamental shocks are then simply: uˆt B 1 Aet Q8. Generate the fundamental shocks from the SVAR Answer: Select PROCS\MAKE RESIDUALS. EViews will automatically generate series named RESID?? in the same ordering as the VAR estimate. In this case we assume that they are RESID01, RESID02, RESID03, RESID04. Change the names as appropriate. 10 D:\687303163.doc Create two matrices call them matx_a and matx_b by typing in the command window matrix(4,4) matx_a matrix(4,4) matx_b and enter the estimated co-efficient from the estimated SVAR i.e. matx_a values 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 matx_b values 1.101966 0.002579 0.281968 -1.833790 -0.022506 -0.298165 0.007326 0.000116 -0.430771 0.470101 0.327101 -3.389196 0.025184 0.002695 0.700787 1.608676 Type in the command window: group resgrp RESID01 RESID02 RESID03 RESID04 matrix resmatrx=@convert(resgrp) matrix resfund=@transpose(@inverse(matx_b) * matx_a * @transpose(resmatrx)) show resfund Select View/graph/line to see a plot of the errors: 10 5 0 -5 -10 -15 -20 10 20 30 40 C1 C2 50 60 70 80 C3 C4 We can see that shock volatility was higher in the first half of the sample. 11 D:\687303163.doc 7 Estimating VARs in EViews 4.0 Estimating an unrestricted VAR is relatively straightforward in EViews 4.0, this was shown in question Q1. Identifying the VAR to obtain a Structural VAR by imposing certain identifying assumption is more involved and new techniques of doing this are available all the time. The question is then what identifying assumption can be imposed in EViews 4.0 and what can’t we impose? EViews is fairly flexible in that it only imposes two restrictions on the types of restrictions one can impose. This class of restrictions are known as AB class of restrictions (Amisano and Giannini, 1997). We begin with our original structural equation that we wish to identify: Ayt C ( L) yt Bu t and we list each restriction that EViews assumes below: Restriction 1. Matrices A and B are square and invertible. This means that the number of the fundamental shocks (ui’s) is equal to the number of endogenous variables. This implicitly assumes each fundamental shock is identified uniquely with an endogenous variable. For a given number of endogenous variables in the system, there is no a priori reason to assume that there are the same number fundamental shocks present. For instance it might more convenient to assume that there are fewer number of fundamental shocks, although in practice most researchers assume that the two are equal. Restriction 2. Identifying restrictions can either be of the short run type characterised by equation (5) in section 3, or long run type characterised by equation (6) in section 4, but not both. By imposing a long-run restriction (in matrix C described above) we infer a restriction on the values of matrices A and B, although such a restriction may not be simple. We often find that economic theory infer combinations of short-run and long-run relationships amongst a set of given variables. Combining short-run and long-run restrictions involve complex matrix algebra since we need to ensure that such combination do not contradict each other. 8 References Amisano,Gianni and Carlo Giannini (1997), Topics in structural VAR econometrics, Second edition. Heidelberg and New York: Springer. Blanchard, O and D, Quah, The Dynamic Effects of Aggregate Supply and Demand Disturbances, American Economic Review (1989) Lütkepohl, Helmut (1991). Introduction to Multiple Time Series Analysis, Springer-Verlag. 12