Pages

Thursday, November 3, 2011

VECMs, IRFs & gretl

In a comment on my post yesterday, "psummers" kindly pointed out that the free econometrics package, gretl, will also produce confidence intervals for Impulse Response Functions (IRFs) generated by a VECM.

I had an earlier post about gretl, and here is a very brief run-down on using it to produce those VECM-IRF confidence intervals.

After starting up the package, I selected "File" / "Open Data" / "Sample File", and chose Johansen's Danish macroeconomic data:








 I then selected "Model" / "Time Series" / "VECM":




As you can see, I chose all 4 of the variables as "endogenous", so I'll have a 4-equation VECM:



(etc.)


Then I chose "Analysis" / "Impulse Responses":



 Here are IRF results:


(etc.)

Then, here's the crucial bit - to get the confidence intervals for the IRF's I chose "Graphs" / "Response of LRM to LRY" (for example), and checked the "include bootstrap confidence interval" box:


Et voilĂ !




I like this even more than JMulTi!  Thanks again, "psummers".

And isn't this a terrific example of two packages that are free, providing us with results that we can't get from a commercial package, such as EViews?

p.s.:  "Ben" please note - there's no "-0.0" label on the vertical axis of the last graph!



© 2011, David E. Giles

33 comments:

  1. Ben: thanks for the earlier comment ;-)

    ReplyDelete
  2. Just a side note. I think the models with unrestricted deterministic terms should generally be avoided and maybe also excluded from the list of possible models in the software. That is the chosen design in JMulti. Nothing is lost from using the restricted models and you get well behaved test statistics together with a better separation of different statistical questions. The topic is treated in Nielsen and Rahbek (2000), "Similarity issues in cointegration analysis", Oxford Bulletin of Economics and Statistics.

    ReplyDelete
  3. David,

    Thanks for the shout-out!

    I've just started following your blog, so I missed your earlier gretl post. I started using gretl about 5 years ago when I first taught u/grad econometrics. I wanted a free, easy-to-use package for my students. I was pleasantly surprised at the positive reaction I got from them about gretl. I've also started using it more & more for research.

    Andreas: gretl has a menu option to control the treatment of deterministic terms in vecms. "Unrestricted constant" is the default, but it's easy to change. The users' guide also has a good discussion of this issue.

    PS

    ReplyDelete
  4. @Andreas: Nice point, thanks.
    @psummers: gretl rules again!

    ReplyDelete
  5. Dear Professor Giles,

    1. Is it possible to set up the bootstrap confidence intervals for the structural VAR in Eviews? or gretl?

    2. There are three variables in the model and I imposed some restrictions as below.

    @e1=0.70*@e3+c(1)*@u2+@u1
    @e2=c(2)*@u1+@u2
    @e3=c(3)*@e1+c(4)*@e2+@u3

    IRF in eviews showed 0 and probably the restrictions here might be wrong as it might be either 0 or 1.

    If it's possible could you kindly post any example of structural VAR please?

    Thanks,

    Best,
    Z

    ReplyDelete
  6. Z: Thanks for the comment. Not in either, I'm afraid. In the gretl user's guide it shows up on p.200 as being on the "to do" list.

    ReplyDelete
  7. Dear Professor Giles,

    Thanks for the reply.
    Could you recommend any other Programme?
    What about Stata or SAS?

    Thanks,

    Best,
    Z

    ReplyDelete
  8. Dear Professor Giles,

    How we can interpret the impulse response from above graph?

    Regards,
    SASI

    ReplyDelete
  9. Dear Professor Giles,

    How is the syntax of the impulse response from above
    graph including the bootstrapped confidence interval?

    Thanks for your help

    ReplyDelete
    Replies
    1. Not sure that I understand your question - sorry!

      Delete
    2. Dear Professor Giles,
      the syntax to get the impulse- response function of a VECM- model is:

      vecm order rank ylist ... -- impulse-response

      It prints the impulse response

      But how is the syntax (not the click-sequence) to become above graph including the bootstrapped confidence interval

      Delete
    3. Dear Professor Giles,
      the syntax to get the impulse- response function of a VECM- model is:

      vecm order rank ylist ... -- impulse-response

      It prints the impulse response

      But how is the syntax (not the click-sequence) to become above graph including the bootstrapped confidence interval
      Thanks for your help

      Delete
    4. You can get this from the "HELP" (or from the manual):

      Syntax
      var_name.impulse(n, options) ser1 [ser2 ser3 ...] [@ shock_series [@ ordering_series]]

      Options

      g (default)
      Display combined graphs, with impulse responses of one variable to all shocks shown in one graph. If you choose this option, standard error bands will not be displayed.

      m
      Display multiple graphs, with impulse response to each shock shown in separate graphs.

      se=arg
      Standard error calculations: "se=a" (analytic), "se=mc" (Monte Carlo).

      If selecting Monte Carlo, you must specify the number of replications with the "rep=" option.

      Note the following:

      (1) Analytic standard errors are currently not available for (a) VECs and (b) structural decompositions identified by long-run restrictions. The "se=a" option will be ignored for these cases.

      (2) Monte Carlo standard errors are currently not available for (a) VECs and (b) structural decompositions. The "se=mc" option will be ignored for these cases.

      rep=integer
      Number of Monte Carlo replications to be used in computing the standard errors. Must be used with the "se=mc" option.

      Delete
    5. Dear Professor Giles,
      thanks for your help, the syntax works in eViews,
      but I need it for Gretl.

      Delete
    6. Soryy - don't know off hand, but contact them directly.

      Delete
  10. Dear Professor Giles,
    the syntax to get the impulse- response function of a VECM- model is:

    vecm order rank ylist ... -- impulse-response

    It prints the impulse response

    But how is the syntax (not the click-sequence) to become above graph including the bootstrapped confidence interval

    ReplyDelete
    Replies
    1. I'm afraid I'm not sure. Why not contact EViews?

      Delete
  11. Dear Prof. Giles

    I`ve got a quick one on the VEC model. In case the t- values for the adjustment vector of a VEC model are not statistically significant, can I still use the VEC model and interpret the impulse responses?

    Best wishes
    Tim

    ReplyDelete
  12. Dear Prof. Dave,

    Thanks a lot for this post. But may I ask you if it is possible to use this gretl or JMulTi (in another post of yours) to calculate Confidence Intervals if I estimate generalized IRFs based on VECM?

    Thank you very much. I look forward to hearing from you soon.

    ReplyDelete
  13. Not sure that I understand your question. This post and the previous one deal with C.I.'s for IRF's from VECM models. What do you mean by "generalized" IRF's?

    ReplyDelete
    Replies
    1. Dear Prof.,

      Thanks for your reply. IRF using traditional approach is sensitive to the ordering of the variables in the system while generalized approach does not have this shortcoming.

      Pesaran, M.H., Shin, Y. 1998. Generalized impulse response analysis in linear multivariate models, Economics Letters 58, 17-29.

      To the best of my knowledge, currently there are only Eviews 6,7 and Microfit do estimate generalized IRF but they do not supply standard errors for VECMs as you say.

      So my question is if we can calculate Confidence Intervals if I estimate generalized IRFs based on VECM?

      Thank you very much.

      Delete
    2. Thanks - now I understand! I don't think that any of the packages accomodate this. The only option I can see is to bootstrap the CI's.

      DG

      Delete
    3. Then I guess I have to follow the procedure in this article: A. Benkwitz & H. Lutkepohl, "Comparison of Bootstrap Confidence Intervals for Impulse Responses of German Monetary Systems", Macroeconomic Dynamics, 2001, 5, 81-100.

      Sigh... :(

      Thank you anyway :)

      Delete
    4. My final question is: Do you think I can bootstrap the CI's using Eviews? Or which statistical tool is easiest for this procedure? Thank you.

      Delete
    5. thank you! have a nice day!

      Delete
  14. Dear professor Dave,
    How do I calculate a simple hedge ratio for futures contracts for hedging a stock portfolio using VECM coefficients.

    ReplyDelete
  15. Prof Giles,
    Thank you for introducing me to Gretl!

    I have a question regarding IRF for VECM on Eviews and Gretl.
    On Eviews the IRF (for two variables) gives a decline in Y before a later increase in response to shocks to X. However in Gretl, Y increases in response to shocks to X.
    I tried my best to apply the same setting regarding VECM. In your opinion, what's the reason for contradictory results?

    One more thing, Do you believe it is correct to report VECM IRF results from Eviews (even though they don't show confidence intervals) in a paper?

    I would appreciate your comment!

    Amir,

    ReplyDelete
    Replies
    1. Amir - I have no idea why they would differ. Perhaps you should check with the producers of the 2 packages. Ideally, confidence intervals should be given. You could bootstrap them.

      Delete

Note: Only a member of this blog may post a comment.