Impulse response analysis in time series analysis is important in determining the effects of external shocks on the variables of the system. Simply put, an Impulse Response Function (IRF) shows how an unexpected change in one variable at the beginning affects another variable through time. It is so widely applicable that we can use on our previous analysis of the relationship between GDP and oil prices.
It should be emphasized that we are not looking at how one variable (oil prices, for example) affects another variable (GDP, for example). We can easily look at the coefficients to know that. What we are looking for are how unexpected changes that directly affect oil prices affect GDP. In a sense, we are looking at shocks coming from the error term related to oil prices, and how such shocks change GDP.
Now, we're not going to discuss impulse response functions the easy way. Before we go into using STATA to compute the impulse response functions, we're going to look at the econometrics behind it. The formula for an IRF is:
Ψi = ΦiB-1Λ½
where B-1 is the matrix of coefficients of all the variables at time t; Λ½ is the lower Cholesky decomposition of the variance-covariance matrix of et (both Λ and Λ½ are diagonal matrices with zero non-diagonal elements); and, Φi is another matrix that contains the effects of a one-unit increase in innovation at date t (et) on the value of the y variable at time t+s:
For example, if we have two variables, (yt, xt), and we're looking at how the error terms, (eyt, ext), affect each of the two variables, the IRF can be summarized as:
Of course, the elements of the matrix are different at each point in time, as we will see shortly.
Now, let's put numbers behind the IRF. Suppose we are analyzing a vector autoregression (VAR) system. We are interested in the following structural vector autoregression (SVAR):
where zt = (yt,xt)'.
But of course, if we want to estimate an SVAR, we instead estimate an observationally equivalent reduced-form vector autoregression (RFVAR) simply because they're easier to estimate:
where Σ is the variance of the error term of the RFVAR (ε).
Now, since both forms of VAR are equivalent, it should be that:
Assuming invertibility is verified (the matrix of coefficients is nonsingular--it has a determinant), we can derive the series of Φi by looking at the MA(∞) representation of zt:
Finally, for the last element of the IRF (Λ½), we make use of the following formula:
then we apply a Cholesky decomposition to get Λ½. In STATA, we use the CHOLESKY function to derive the Cholesky decomposition of a matrix. For example, given that Λ is:
To derive the Cholesky decomposition in STATA, we simply use the following commands:
matrix a=(4,0\0,3.75)
matrix b=cholesky(a)
The first line is where I input the 2X2 matrix and name it a, and b is the resulting Cholesky decomposition.
Alternatively, we can get Λ½ directly by applying another formula:
Σ½ is the lower Cholesky decomposition of the variance-covariance matrix of the RFVAR error term (εt). Applying the formula, we get:
Now, we can apply the formula to get the IRF. Suppose we want to compute the responses for t = 0, 1, 2:
For example, if we want to know the responses of (yt) to one standard deviation shock in (ext), we get 0 for the first period, -½(15)½ for the second period, and 0 for the third period.
Now, the we have the algebra and the econometrics out of the way, let's look at implementing these in STATA. It's way more simpler than the procedure above.
Let us use the data from our previous GDP-oil price analysis. Using that data (already in first-difference log forms), we run the original VAR command with 4 lags:
Before we proceed, we can check if we do need four lags by obtaining lag-order selection statistics. The STATA command VARSOC shows four information criteria (I'll discuss more of this tomorrow) that shows how many lags are the most appropriate:
It seems that we only need a single lag (check the lags with the *). So, rerunning the VAR with only one lag, we get:
Then as a post-estimation command, we run STATA's IRF command after the VAR estimation:
The first line is needed as STATA needs an active file to where the results of the impulse response analyses are kept.
As the footnotes indicate, the first column displays the responses of GDP to one standard deviation shock in eGDP. The second column show response of oil to a shock in eGDP. For the third and fourth columns, the effects of a shock in eoil on GDP and oil, respectively, are shown. The table shows up to nine time periods (quarters in this case).
The NOCI option is there to suppress reporting of the confidence interval. Of course, you can show the intervals by not including this option. Another option that might be useful for you is STDERROR, which shows the standard errors.
STATA provides a very convenient tool to do impulse response analysis. The IRF command can also create graphs which is useful if you prefer a visual look instead of looking at the numbers.