How to correctly define user-specified matrix/vector to obtain the desired IRFs after estimating a VAR

For technical questions regarding estimation of single equations, systems, VARs, Factor analysis and State Space Models in EViews. General econometric questions and advice should go in the Econometric Discussions forum.

Moderators: EViews Gareth, EViews Moderator

p2021
Posts: 8
Joined: Thu Jul 01, 2021 3:35 pm

How to correctly define user-specified matrix/vector to obtain the desired IRFs after estimating a VAR

Postby p2021 » Tue Jul 06, 2021 12:18 pm

I am trying to figure out how to properly use the user-specified impulse option after estimating a VAR. Specifically, I am having a hard time figuring out how to correctly specify the user-specified matrix/vector for the problem at hand.

Suppose that I estimate a reduced-form VAR: var myvar.ls 1 4 gdp wages fed. (Variable names come from the downloadable stockwatson.wf1.) I'd then like to conduct some structural analysis and generate different IRFs.

#1. How does one specify the user-specific matrix/vector that would recreate the full set of 9 impulse-response diagrams obtainable after using the Cholesky – dof adjusted clickable option, with Cholesky ordering gdp wages fed?

#2. Is it possible to define a user-specified matrix/vector that would allow one to generate IRFs stemming from a joint (concurrent) 1SD (positive) shock to gdp and to wages (but not to fed)? If so, how would that matrix/vector look like?

Thank you in advance,

Peter

EViews Matt
EViews Developer
Posts: 560
Joined: Thu Apr 25, 2013 7:48 pm

Re: How to correctly define user-specified matrix/vector to obtain the desired IRFs after estimating a VAR

Postby EViews Matt » Tue Jul 06, 2021 5:19 pm

Hello,

Just for the sake of a complete example here in my response, let me address your questions using a trivial artificial VAR.

Regarding (1), matrix/vector you must specify holds the shocks in its column(s), with the rows representing the different variables. For the basic Cholesky decomposition, this matrix is just the Cholesky factorization of the residual covariance, e.g.,

Code: Select all

create u 50
series x = rnd
series y = x + rnd
series z = nrnd
var v.ls 1 2 x y z

freeze v.impulse(se=a)   ' Default Cholesky dof-adjusted IRFs for reference
matrix m = @cholesky(v.@residcov)   ' Create the equivalent factorization matrix (should match that returned by v.@impfact)
freeze v.impulse(imp=user, fname=m, se=a)   ' Custom IRFs that match

Regarding (2), you may specify the shocks to be whatever you please. Since you're interested in a single shock comprising 1 S.D. of the first two variables, you could create a vector with exactly that shock information and pass it to the impulse proc. For example,

Code: Select all

create u 50
series x = rnd
series y = x + rnd
series z = nrnd
var v.ls 1 2 x y z

vector(3) shock
shock.fill v.@se(1), v.@se(2), 0   ' Set the shock equal to the residual SE of the first two variables
v.impulse(imp=user, fname=shock, se=a)

p2021
Posts: 8
Joined: Thu Jul 01, 2021 3:35 pm

Re: How to correctly define user-specified matrix/vector to obtain the desired IRFs after estimating a VAR

Postby p2021 » Tue Jul 06, 2021 7:49 pm

Thank you for the response.

I apologize for the following, I believe there is still some confusion on my end and I might not have articulated my question sufficiently accurately.

Re (1): I was under the impression that, after estimating a VAR, the default choice of View->Impulse Response, using Cholesky - dof adjusted, and a specific Cholesky ordering of variables (say x y z), produces IRFs as a consequence of shocks (increases in structural residuals) of the size of 1SD of the variable with which a particular structural residual (shock) is associated. Is my interpretation actually correct? If not, then what exactly is the size of the "Cholesky One S.D. (d.f. adjusted) Innovation" (as labeled in the Eviews-produced graph) with respect to the variable with which a shock is associated?

Re (2): I would like to construct a shock that respects the Cholesky ordering (for simplicity, suppose that ordering is x y z) but entails an increase in the structural residual of both x and y (in your notation). The magnitude of shocks to each of the structural residuals of x and y, respectively, should be of the same size as the size of the shocks under the default Cholesky ordering exercise, as for example noted above.

p2021
Posts: 8
Joined: Thu Jul 01, 2021 3:35 pm

Re: How to correctly define user-specified matrix/vector to obtain the desired IRFs after estimating a VAR

Postby p2021 » Wed Jul 07, 2021 10:03 am

I believe I have figured out the answer to my Re (1). What Eviews labels as "Cholesky One S.D. Innovation" is an increase in a structural residual by one unit; or, equivalently, an increase in the structural residual by 1SD of structural residual (given that the varcov matrix of structural residuals is an identity matrix); or an in increase in reduced-form residual by 1SD of the reduced-form residual (this follows from the definition of matrix S and the nature of Cholesky decomposition). Correct?

Concerning my Re (2), I see that the user MaartenG on Sat Oct 26, 2013 posed what is in spirit the exact question that I am interested in: viewtopic.php?t=5512. But he did not receive an answer. Would it be possible to provide it?

EViews Matt
EViews Developer
Posts: 560
Joined: Thu Apr 25, 2013 7:48 pm

Re: How to correctly define user-specified matrix/vector to obtain the desired IRFs after estimating a VAR

Postby EViews Matt » Wed Jul 07, 2021 11:39 am

Hello,

Regarding (1), you're follow-up is correct. The shocks are structural shocks and by construction the structural residuals have an identity covariance matrix. A one unit structural shock and one S.D. structural shock are therefore identical, and can be interpreted directly as the columns of the structural factorization matrix (e.g. the Cholesky decomposition of the endogenous residual covariance matrix).

Regarding (2), I believe I now understand what you want. You want to simultaneously shock the first two structural variables, not the first two endogenous variables, correct? Since user-supplied shocks to the VAR impulse procedure are specified in terms of the endogenous variables, you just need to translate your structural shock into the equivalent endogenous shock. For example,

Code: Select all

create u 50
series x = rnd
series y = x + rnd
series z = nrnd
var v.ls 1 2 x y z

vector(3) struct_shock
struct_shock.fill 1, 1, 0
matrix struct_to_endog = @cholesky(v.@residcov)   ' The structural factorization matrix
vector endog_shock = struct_to_endog * struct_shock
v.impulse(imp=user, fname=endog_shock, se=a)

p2021
Posts: 8
Joined: Thu Jul 01, 2021 3:35 pm

Re: How to correctly define user-specified matrix/vector to obtain the desired IRFs after estimating a VAR

Postby p2021 » Wed Jul 07, 2021 3:01 pm

Thank you very much, this is very helpful.

Re (2), yes, obeying a specific Cholesky ordering (i.e. a structural VAR), I would like is to simultaneously increase by one unit the structural residuals associated with the first two variables (as opposed to conduct the standard exercise, whereby one increases only one structural residual by one unit -- the exercise that was the subject of my question (1)).

Looking at your code, I believe this matches the algebra that I was hoping one would be able to implement computationally, given that the reduced-form residuals vector equals matrix S (what your code refers to as struct_to_endog) multiplied by the structural residuals vector.

houji
Posts: 11
Joined: Mon Mar 20, 2023 3:19 pm

Re: How to correctly define user-specified matrix/vector to obtain the desired IRFs after estimating a VAR

Postby houji » Mon Mar 20, 2023 7:44 pm

Following up on the user-specified matrix, how do I change the labels? Right now the labels read response of variable to Shock 1, shock 2, shock 3, etc...

EViews Matt
EViews Developer
Posts: 560
Joined: Thu Apr 25, 2013 7:48 pm

Re: How to correctly define user-specified matrix/vector to obtain the desired IRFs after estimating a VAR

Postby EViews Matt » Tue Mar 21, 2023 4:00 pm

Hello,

The names "Shock1", "Shock2", etc., are hard-coded into the impulse response view, but with a little work you can recreate the response multigraph with your own labels. Since there isn't a way to alter individual graphs within a multigraph, the strategy must be to create and alter each individual graph before combining them into a multigraph. Updating my previous example,

Code: Select all

create u 50
series x = rnd
series y = x + rnd
series z = nrnd
var v.ls 1 2 x y z

vector(3) struct_shock
struct_shock.fill 1, 1, 0
matrix struct_to_endog = @cholesky(v.@residcov)   ' The structural factorization matrix
vector endog_shock = struct_to_endog * struct_shock
freeze v.impulse(imp=user, fname=endog_shock, se=a)   ' Reference multigraph

freeze(tmpx) v.impulse(imp=user, fname=endog_shock, se=a) x
tmpx.addtext(t,font(20)) "Response of X to Shock1"
freeze(tmpy) v.impulse(imp=user, fname=endog_shock, se=a) y
tmpy.addtext(t,font(20)) "Response of Y to Shock1"
freeze(tmpz) v.impulse(imp=user, fname=endog_shock, se=a) z
tmpz.addtext(t,font(20)) "Response of Z to Shock1"
graph custom.merge tmpx tmpy tmpz      ' Our recreation of the reference multigraph
custom.addtext(t,font(24),just(c)) "Response to User Specified Innovations (ENDOG_SHOCK)\n95% CI using analytic asymptotic S.E.s"
show custom

The above displays both the basic impulse response graph generated by the VAR impulse procedure as well as a custom recreation of that graph. You can clearly replace the "Shock1" label with whatever you please.


Return to “Estimation”

Who is online

Users browsing this forum: EViews Gareth, Google [Bot] and 24 guests