Is there any example on how to code the estimation of a SVAR? I am particularly interested in obtaining the responses to structural VAR innovations for producing additional statistics and charts.
The manual mentions the @lrrsp vector, but varname.@lrrsp(1,1) returns a number which does not match any number in the table obtained with View > Impulse response
Thank you
code for SVAR
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
-
- EViews Developer
- Posts: 563
- Joined: Thu Apr 25, 2013 7:48 pm
Re: code for SVAR
Hello,
There are a few small SVAR examples in the documentation, but I can provide a few more here. To answer you're question about @lrrsp, the accumulated impulse responses that data member holds are the theoretical/asymptotic responses, not the responses at the last horizon as shown in the impulse responses view. As a simple demonstration,
The above code generates a trivial VAR and shows the accumulated impulse responses to unit innovations (for mathematical simplicity), as well as the @lrrsp matrix and a manual calculation of the long-run multiplier, psi. The two matrices should match, and represent the values that the accumulated responses are asymptotically approaching. Examining the response graphs or table, the values at the last horizon should be near those in the matrices though likely not identical.
The same idea holds if you're using EViews' built-in SVAR estimation, were there @lrrsp and @svarfmat matrices represent asymptotic behavior of the accumulated impulse responses. For example,
Now, if you what you actually want to capture is the finite (horizon-limited) behavior of the responses as shown in the view window, there are options to copy that data to the workfile. For example,
There are a few small SVAR examples in the documentation, but I can provide a few more here. To answer you're question about @lrrsp, the accumulated impulse responses that data member holds are the theoretical/asymptotic responses, not the responses at the last horizon as shown in the impulse responses view. As a simple demonstration,
Code: Select all
create u 50
series x = 0
series y = 1
smpl 2 50
x = .5 * x(-1) + rnd
y = .8 * y(-1) + .3 * x(-1) + nrnd
var v.ls 1 1 x y
v.impulse(a,imp=unit,se=a)
matrix auto_lrrsp = v.@lrrsp
matrix manual_lrrsp = @inverse(@identity(2) - v.@lagcoef(1))
show auto_lrrsp
show manual_lrrsp
The above code generates a trivial VAR and shows the accumulated impulse responses to unit innovations (for mathematical simplicity), as well as the @lrrsp matrix and a manual calculation of the long-run multiplier, psi. The two matrices should match, and represent the values that the accumulated responses are asymptotically approaching. Examining the response graphs or table, the values at the last horizon should be near those in the matrices though likely not identical.
The same idea holds if you're using EViews' built-in SVAR estimation, were there @lrrsp and @svarfmat matrices represent asymptotic behavior of the accumulated impulse responses. For example,
Code: Select all
create u 50
series x = 0
series y = 1
smpl 2 50
x = .5 * x(-1) + rnd
y = .8 * y(-1) + .3 * x(-1) + nrnd
var v.ls 1 1 x y
v.svar(preset=1)
v.impulse(a,imp=struct,se=a)
matrix lrrsp = v.@lrrsp
matrix fmat = v.@svarfmat
show lrrsp
show fmat
Now, if you what you actually want to capture is the finite (horizon-limited) behavior of the responses as shown in the view window, there are options to copy that data to the workfile. For example,
Code: Select all
create u 50
series x = 0
series y = 1
smpl 2 50
x = .5 * x(-1) + rnd
y = .8 * y(-1) + .3 * x(-1) + nrnd
var v.ls 1 1 x y
v.svar(preset=1)
v.impulse(a,imp=struct,se=a,matbyr=responses)
show responses
Re: code for SVAR
Thank you, you have been very clear, and the code works on my data!
Re: code for SVAR
One last question: Is there a way to get a matrix of the standard errors of the responses, to reproduce the charts with the confidence intervals?
Thank you
Thank you
-
- EViews Developer
- Posts: 563
- Joined: Thu Apr 25, 2013 7:48 pm
Re: code for SVAR
Hello,
When using 'matbyr' or similar options, a second matrix with the suffix "_se" is created to hold the standard errors. So in my example code, matrices "responses" and "responses_se" are created as part of the impulse procedure.
When using 'matbyr' or similar options, a second matrix with the suffix "_se" is created to hold the standard errors. So in my example code, matrices "responses" and "responses_se" are created as part of the impulse procedure.
Re: code for SVAR
Thank you! I should have noticed...
Who is online
Users browsing this forum: No registered users and 53 guests