MathType

Monday, 21 August 2017

Impulse Response Function with Stata (time series)




In the VAR analysis at here, we have discussed how we analysis and run the VAR model. The most popular method using the VAR is the causality test which is also been discussed at here and here.
In this section, we discussed another method which is also using the VAR and it is called Impulse response function (IRFs).

 An IRFs show the adjustment or time path of the variables explained in a VAR model, when one of the variables in the model is “shocked”.

We get a “picture” of how the variable in question respond to the shock over several period of time.

An IRFs is essentially type of conditional forecast. It’s a messy function of the estimated coefficients in the VAR model, and the data. So, it’s a really just a point estimate, period by period.

Just as an AR has a moving average representation, a VAR can be written as a vector moving average (VMA) representation in that the variables (lets say, \({{y}_{t}}\) and \({{z}_{t}}\) are expressed in term of current and past values of the two types of shocks (lets say, \({{e}_{1t}}\) and \({{e}_{2t}}\) .
The VMA representation is an essential feature of Sim’s (1980) methodology in that allows us to trace out the time path of the various shocks on the variables contained in the VAR systems.
Consider the two equations in matrix form;
  
 
or;

 

(refer Ender (1995, p 297)

Eq(2) express \({{y}_{t}}\)  and \({{z}_{t}}\) in term of the \(\left\{ {{e}_{1t}} \right\}\) and \(\left\{ {{e}_{2t}} \right\}\) sequences. However, it is insightful to rewrite Eq(2) in term of \(\left\{ {{\varepsilon }_{1t}} \right\}\)  and \(\left\{ {{\varepsilon }_{2t}} \right\}\)  sequences. The vector error can be written as;

 
So that Eq(2) and (3) can be combined to form

 

Since the notation is getting unwieldy, we can simplify by defining 2 X 2 matrix \({{\phi }_{\iota }}\)   with the elements  \({{\phi }_{jk}}\left( i \right)\):

 
Hence, the moving average representation of Eq(4) and Eq(5) can be written in terms of the  \(\left\{ {{\varepsilon }_{1t}} \right\}\) and  \(\left\{ {{\varepsilon }_{2t}} \right\}\) sequences.

 



or more compactly


                 \({{x}_{t}}=\mu +\sum\nolimits_{i=0}^{\infty }{{{\phi }_{i}}{{\varepsilon }_{t-i}}}\)                                      (7)





The moving average representation is an especially useful tool to examine between the \(\left\{ {{y}_{t}} \right\}\)  and \(\left\{ {{z}_{t}} \right\}\)  sequences. The coefficients of \({{\phi }_{\iota }}\) can be used to generate the effects of \({{\varepsilon }_{yt}}\)  and \({{\varepsilon }_{zt}}\) shocks on the entire time path of the \(\left\{ {{y}_{t}} \right\}\)  and \(\left\{ {{z}_{t}} \right\}\)  sequences.


It should be clear that the four elements \({{\phi }_{jk}}\left( 0 \right)\)  are impact multiplier. For example, the coefficients \({{\phi }_{12}}\left( 0 \right)\)  is the instantaneous impact of a one unit change in \({{\varepsilon }_{zt}}\)  on \({{y}_{t}}\). In the same way, the elements \({{\phi }_{11}}\left( 1 \right)\)  and \({{\phi }_{12}}\left( 1 \right)\) are the one period responses of unit changes in \({{\varepsilon }_{yt-1}}\)  and \({{\varepsilon }_{zt-1}}\) on \({{y}_{t}}\) respectively.

Updating one period indicate that \({{\phi }_{11}}\left( 1 \right)\)  and \({{\phi }_{12}}\left( 1 \right)\) also represent the effects of unit changes in \({{\varepsilon }_{yt}}\) and \({{\varepsilon }_{zt}}\) on \({{y}_{t+1}}\) .The accumulated effects of unit impulses in \({{\varepsilon }_{yt}}\) and/or \({{\varepsilon }_{zt}}\) can be obtained by the appropriate summation of the coefficients of the IRFs. For example, after \(n\)  periods,the cumulated sun of effects of \({{\varepsilon }_{zt}}\)  on the \({{y}_{t+1}}\) is \({{\phi }_{12}}\left( n \right)\).


Thus, after  periods, the cumulated sun of the effects of \({{\varepsilon }_{zt}}\) on the \(\left\{ {{y}_{t}} \right\}\) sequence is;


\(\sum\nolimits_{i=0}^{n}{{{\phi }_{12}}\left( n \right)}\)                                                             (8)



Letting \(n\)  approach infinity yields the long-run multiplier. Since the \(\left\{ {{y}_{t}} \right\}\) and \(\left\{ {{z}_{t}} \right\}\) sequences are assumed to be stationary, it must be the case that for all \(j\)  and \(k\) ,


\(\sum\nolimits_{i=0}^{\infty }{\phi _{jk}^{2}\left( i \right)}\)  is finite.                                  (9)



The four sets of coefficients \({{\phi }_{11}}\left( i \right)\), \({{\phi }_{12}}\left( i \right)\), \({{\phi }_{21}}\left( i \right)\) and \({{\phi }_{22}}\left( i \right)\)  are called the impulse response functions. Plotting the impulse response function  (i.e. plotting the coefficients of \({{\phi }_{jk}}\left( i \right)\)  against \(\left( i \right)\)  is a practical way to visually represent the behavior of the \(\left\{ {{y}_{t}} \right\}\) and \(\left\{ {{z}_{t}} \right\}\) series in response to the various shock.


With such knowledge, it would be possible to trace out the time path of the effects of pure  \({{\varepsilon }_{yt}}\) and  \({{\varepsilon }_{zt}}\) shock.

In Stata, IRFs can be produced after using the varbasic command.  The results can be presented in a table or a graph.


Estimating Using Stata

To create the IRFs, we use the command irf create and it will estimates the five type of IRFs; simple IRFs, orthogonalized  IRFs, cumulative IRFs, cumulative orthogonalized IRFs and structural IRFs.

Before we analyze the IRFs, we need the fit model, then use irf create to estimate the IRFs and store them in file, and finally use irf graph or any other irf analysis commands to examine results.

We use again the data file Data09.dta.

The VAR variable we want to estimate is log for gross fixed capital formation (lrgrossinv) , log for real household consumption expenditure (lrconsump) and log for real gross domestic products (lrgdp).

Before we run the IRFs, we need to know the optimal lag will be chosen for our VAR model;

                varsoc lrgrossinv lrconsump lrgdp, max (12)

 

The analysis in VAR show that based on AIC, the model is fit with VAR(7). Estimate again the VAR model;

quietly var lrgrossinv lrconsump lrgdp,lags(1/7)dfk >small

Then, to create the IRFs ;

irf create order1, step(10) set(myirf1) replace

 

Mulitiple sets of IRFs can be placed in the same file, with each set of results in file bearing a distinct name. The irf create command above created file myirf1.irf and put one set of results in it, named order1.

The order1 results include estimates of the simple IRFs, orthogonalized IRFs, cumulative IRFs, cumulative orthogonalized IRFs and Cholesky FEVDs.

Now, we will create the graph for IRFs using the command irf graph.

To create the IRFs graph with standard statistics IRFs;

irf graph oirf, impulse(lrgrossinv lrconsump lrgdp) response(lrgrossinv lrconsump lrgdp)  yline (0,lcolor(black)) xlabel(0(4)20) byopts(yrescale)


 

The IRFs graph places one impulse in each row and one response variable in each column. The horizontal axis for each graph is in the unit of time that our VAR is estimated in, in this case is quarters. Hence, IRFs graph shows the effect of a shocks over a 10-quarter period. The vertical axis is in unit of the variables in the VAR; in this case, everything is measured on percentage points, so the vertical units in all panels are percentage point changes.

The first row shows the effect of a one-standard-deviation impulse to the consumption equation. The household consumption decrease until 5 period and then elevated. The gross domestic product rises for about 4 periods, peaking about nearly 0.01 percentage point increases , before declining slowly. The pattern for gross fixed capital also share the same pattern as gross domestic product, rises for about 4 period with peaking at 0.01  and then decreases slowly after the impulse to consumption.

The second row shows the impact of the shock to the gross domestic equation. The gross domestic product is decrease slightly until at 5 period and then recover to increase slowly.   Both the household consumption and gross fixed capital decrease until 5 period and then elevated after the impulse to gross domestic shocks.

Finally, the third row shows the impact to a shock to the gross fixed capital equation. An impulse to the gross fixed capital causes highly persistent decrease for the both household consumption and the gross domestic product .