How to feed in shocks from m file?

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.

How to feed in shocks from m file?

Postby dphm » Fri Sep 25, 2015 3:41 am

Hi everyone

I don't know if this was discussed before but I couldn't find any information on this.

Anyway, I have obtained the shocks from actual historical data. And I am trying to feed the vector of shocks into my mod file.

How am I supposed to go about doing this?

Thanks!
dphm
 
Posts: 16
Joined: Fri Sep 11, 2015 12:27 am

Re: How to feed in shocks from m file?

Postby econ86 » Sun Sep 27, 2015 6:30 am

Posterior means of volatility of exogenous disturbances? If yes, here is the solution:

xb=load ('name_of_your_results_matrix.mat');
myshocks=xb.oo_.posterior_mean.shocks_std;
myshocksmat=cell2mat(struct2cell(myshocks));


shocks;
// Non-stationary technology growth
var epsilon_muz;
stderr myshocksmat(1);

// Stationary technology
var epsilon_epsilon;
stderr myshocksmat(2);

etc.

end;
econ86
 
Posts: 78
Joined: Sun Apr 26, 2015 10:32 am

Re: How to feed in shocks from m file?

Postby jpfeifer » Sun Sep 27, 2015 8:16 am

What is your ultimate goal, i.e. when you feed in the shocks, what are you trying to compute based on the shocks?
------------
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: How to feed in shocks from m file?

Postby dphm » Sun Sep 27, 2015 9:29 am

Thank you everyone for your replies.

My objective is actually to feed in the shocks and get the impulse responses of key variables like GDP and inflation. Then I'll compare them to the actual data to see if my model is a fair representation of past economic shocks.

How can I feed in the shocks from an m-file and simulate the impulse responses?

Thank you.
dphm
 
Posts: 16
Joined: Fri Sep 11, 2015 12:27 am

Re: How to feed in shocks from m file?

Postby jpfeifer » Sun Sep 27, 2015 9:48 am

I see. In this case, you have to manually feed the shock series to the simult_-function. An example is here: https://github.com/JohannesPfeifer/DSGE_mod/tree/master/RBC_news_shock_model
------------
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: How to feed in shocks from m file?

Postby dphm » Sun Sep 27, 2015 10:14 am

Hi jpfeifer

Thank you very much for the link.

Do you mean this portion of your code:
// set shocks for pure news
shock_matrix(1,strmatch('eps_z_news',M_.exo_names,'exact')) = 1; %set news shock to 1 (use any shock size you want)
shock_matrix(1+8,strmatch('eps_z_surprise',M_.exo_names,'exact')) = -1; %8 periods later use counteracting shock of -1


Thank you.
dphm
 
Posts: 16
Joined: Fri Sep 11, 2015 12:27 am

Re: How to feed in shocks from m file?

Postby jpfeifer » Thu Oct 01, 2015 9:24 pm

Yes, along these lines.
------------
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


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 3 guests

cron