Page 1 of 1

multiple IRFs

PostPosted: Fri Feb 24, 2017 5:51 pm
by S_V
Dear All,

I am trying to generate multiple IRFs on the same graph. I know this topic has been covered but I think the code file I am working with are a bit different. I am trying to generate graphs for the same sets of variables but from different scenarios. So for example, say I have two scenarios, in each of the graphs I would like the irfs from both scenario A and B for each variable.

Hopefully, this is clear from the attached files.

One of the main problems I am having is that I am unable to save the irfs (irf1 and irf2) separately, one keeps replacing the other in my folder.


Many thanks.

Re: multiple IRFs

PostPosted: Sat Feb 25, 2017 10:32 am
by jpfeifer
Please explain the logic of your files, which file I need to run, and what does not work as expected.

Re: multiple IRFs

PostPosted: Sat Feb 25, 2017 3:27 pm
by S_V
Many thanks for you reply Prof. Pfeifer

run and run_1 have the same code in them but apply to two different scenarios. As these two files are currently set up, they run the same mod file, under two different names transition.mod and transition_1.mod because I thought this might help.

run refers to the scenario where pmrI = 1; fcI = 0; ubI = 0; while run_1 is set to pmrI = 1; fcI = 1; ubI = 0;. I want to generate irfs for the set of variables in the transition.mod file under these two scenarios in the same graph for each variable.

I am not sure whether it is necessary to name the files differently. I got to this stage because I tried running the single run file twice but under the two different scenarios and saving the simulation results in oo_.endo_simul as irf1 and irf2 respectively but irf2 would just replace irf1 in my folder so I thought I should try to name the files differently, but this doesn't seem to have worked.

I attach the other files you would need in a zip file. You would only need to run the run.m and run.1 files to see the irfs I am trying to merge ( Alternatively, you can stick with running the run file but changing fcI from 0 to 1).

The mult_irf file was just my initial attempt to start writing a code that would merge the results.

Many thanks.

Re: multiple IRFs

PostPosted: Tue Feb 28, 2017 10:26 am
by jpfeifer
No, it is not necessary to have separate files. Try using the macro-processor language (e.g. as in https://github.com/JohannesPfeifer/DSGE_mod/blob/master/Gali_Monacelli_2005/Gali_Monacelli_2005.mod). What exactly do you mean when you say
Code: Select all
but irf2 would just replace irf1 in my folder

If you are referring to a file on the harddisk, you need to assign a different name for the second file. If you are referring to the Matlab workspace, you need to make sure that you do not have any
Code: Select all
clear

commands, i.e. you need to invoke Dynare using the
Code: Select all
noclearall

option.

Re: multiple IRFs

PostPosted: Tue Feb 28, 2017 11:16 pm
by ACL
S_V wrote:Dear All,

I am trying to generate multiple IRFs on the same graph. I know this topic has been covered but I think the code file I am working with are a bit different. I am trying to generate graphs for the same sets of variables but from different scenarios. So for example, say I have two scenarios, in each of the graphs I would like the irfs from both scenario A and B for each variable.

Hopefully, this is clear from the attached files.

One of the main problems I am having is that I am unable to save the irfs (irf1 and irf2) separately, one keeps replacing the other in my folder.


Many thanks.


One of the things I have done is to run dynare under one "scenario" as you put it, and then save the impulse responses for that scenario. They can be found in the workspace window. Once they are saved, you can then run the simulation again under the alternative scenario. Following this, dynare should give you the plots for the impulse responses. You can then import your first set of impulse responses into that workspace and add them to your new graphs. In order to do this, you will have to open the figure editor and "add data" to the figure and select the impulse response from the first simulation that you saved.

Re: multiple IRFs

PostPosted: Thu Mar 02, 2017 4:04 pm
by S_V
Many thanks Prof. Pfeifer and ACL.

I have now been able to save the time series. The problem was having 'clear' in the run file. I think I should be able to get the irfs now.

Many thanks