multiple IRFs

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

multiple IRFs

Postby S_V » Fri Feb 24, 2017 5:51 pm

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.
Attachments
transition.mod
(11.12 KiB) Downloaded 40 times
mult_irf.m
(246 Bytes) Downloaded 41 times
run_1.m
(3.48 KiB) Downloaded 40 times
run.m
(3.47 KiB) Downloaded 42 times
S_V
 
Posts: 26
Joined: Tue Nov 15, 2016 11:38 am

Re: multiple IRFs

Postby jpfeifer » Sat Feb 25, 2017 10:32 am

Please explain the logic of your files, which file I need to run, and what does not work as expected.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: multiple IRFs

Postby S_V » Sat Feb 25, 2017 3:27 pm

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.
Attachments
model_simulations.zip
(26.65 KiB) Downloaded 42 times
S_V
 
Posts: 26
Joined: Tue Nov 15, 2016 11:38 am

Re: multiple IRFs

Postby jpfeifer » Tue Feb 28, 2017 10:26 am

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.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: multiple IRFs

Postby ACL » Tue Feb 28, 2017 11:16 pm

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.
ACL
 
Posts: 8
Joined: Sat Nov 28, 2015 4:00 am

Re: multiple IRFs

Postby S_V » Thu Mar 02, 2017 4:04 pm

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
S_V
 
Posts: 26
Joined: Tue Nov 15, 2016 11:38 am


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 7 guests