Merging IRFs from various models - M.File

Dear Dynare users,

When you have a model with several different specifications that you wish to compare, Dynare doesn’t handle to merge the IRF’s produced. This has to be done in matlab particularly with an m.file. My impression was, that it is quite tricky to compute such a code, therefor I post the one I used for my last work. If you have suggestions for improvement, please point them out to me. I suppose that this will be of help to all the beginning Dynare users.

2 comments:

  1. make sure the IRFs of your models that you wish to compare have the same dimensions.
  2. make sure your IRF matrices do all have the same variables ( you compare the effect on y of model 1 with the effect of y on model 2)

My best wishes,

Philipp
irfmerge.m (1.57 KB)

Hello, Philipp,
Thank you for your kindness to post the .m file. I use Matlab of version R2013 but failed to run the code out. It warns about keep, strvcat in the following code:

[code]load model2_results.mat %model 1a
irf2=oo_.irfs;
keep irf1 irf2

load modelxy_results.mat
irf3=oo_.irfs;
keep irf1 irf2 irfxy % number all the irf graphs that you need

% Define variables and colors to be loaded as strings

var=strvcat(‘y_e’, ‘c_e’, ‘h_e’, ‘k_e’, ‘d_e’, ‘i_e’, ‘tb_e’, ‘ca_e’, ‘a_e’);
color=strcat(‘b’,‘g’,‘r’,‘c’,‘m’);[/code]
Are the codes just out-of-date? If so, are theres any alternatives? Many thanks in advance.

Best,
GOODLUCK

[quote=“Philipp”]Dear Dynare users,

When you have a model with several different specifications that you wish to compare, Dynare doesn’t handle to merge the IRF’s produced. This has to be done in matlab particularly with an m.file. My impression was, that it is quite tricky to compute such a code, therefor I post the one I used for my last work. If you have suggestions for improvement, please point them out to me. I suppose that this will be of help to all the beginning Dynare users.

2 comments:

  1. make sure the IRFs of your models that you wish to compare have the same dimensions.
  2. make sure your IRF matrices do all have the same variables ( you compare the effect on y of model 1 with the effect of y on model 2)

My best wishes,

Philipp[/quote]