Stochastic shocks in some periods- Iacoviello 2015

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.

Stochastic shocks in some periods- Iacoviello 2015

Postby leonard007 » Mon Feb 20, 2017 3:45 pm

Dear Prof. Jpfeifer,
Thank you for your help in advance.
I am working on Iacoviello 2015 (Financial business cycles). He has a stochastic DSGE model. He has a stochastic shock let's say as :
x=0.9* x(-1)+eps;
and he says :"I feed into the model a sequence of unexpected shocks to eps, each quarter equal to 0.38 percent of annual GDP, which lasts 12 quarters and causes losses for the banking system to rise from zero to 2.8 percent of GDP after 3 years, before loan losses gradually return to zero."
I would like to know how it is possible to have a stochastic shock for some period and how I can set this shock for example to 0.38 percent of annual GDP?
I appreciate you time and consideration.
Leo
leonard007
 
Posts: 54
Joined: Tue May 26, 2015 12:30 pm

Re: Stochastic shocks in some periods- Iacoviello 2015

Postby leonard007 » Fri Feb 24, 2017 1:25 pm

Hello,
I am still waiting for the answer, IS there anybody who knows somthing about this kind of shocks?
Thanks
leonard007
 
Posts: 54
Joined: Tue May 26, 2015 12:30 pm

Re: Stochastic shocks in some periods- Iacoviello 2015

Postby jpfeifer » Sat Feb 25, 2017 9:57 am

The mod-file at https://github.com/JohannesPfeifer/DSGE_mod/blob/master/RBC_news_shock_model/RBC_news_shock_model.mod
shows how to use the
Code: Select all
simult_
function to feed a given sequence of shocks into the model. The challenge is to determine the shock size. But you should see the steady state of output Y and should be able to scale the shock size accordingly.
------------
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: Stochastic shocks in some periods- Iacoviello 2015

Postby leonard007 » Tue Feb 28, 2017 2:29 pm

Dear Professor Jpfeifer,
Thank you so much for the reply.
I found also this link that really helps me : http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=4471.
I have just one more question, I run the Iacoviello's model (attached here) but unofrtunately I get this error :
Error using check_model (line 20)
Not enough input arguments.
Error in stoch_simul (line 65)
check_model;
Error in fbc1 (line 682)
info = stoch_simul(var_list_);
Error in dynare (line 223)
evalin('base',fname) ;

Then when I search
Code: Select all
 which check_model

it replies :
E:\dynare-2016-12-01-win\2016-12-01\matlab\check_model.m
I installed also the latest unstable version but still the same error. I am wondering if it is a problem in codes or my Dynare.
Sincerely
Attachments
fbc1.mod
(10.57 KiB) Downloaded 92 times
leonard007
 
Posts: 54
Joined: Tue May 26, 2015 12:30 pm

Re: Stochastic shocks in some periods- Iacoviello 2015

Postby jpfeifer » Tue Feb 28, 2017 2:58 pm

Please provide the missing files (like the steady state file)
------------
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: Stochastic shocks in some periods- Iacoviello 2015

Postby leonard007 » Tue Feb 28, 2017 3:32 pm

Thank you for the prompt reply.
All files are attached here.
Attachments
stoch_simul.m
(6.65 KiB) Downloaded 96 times
fbc1_steadystate.m
(4.54 KiB) Downloaded 91 times
fbc1.mod
(10.56 KiB) Downloaded 98 times
leonard007
 
Posts: 54
Joined: Tue May 26, 2015 12:30 pm

Re: Stochastic shocks in some periods- Iacoviello 2015

Postby jpfeifer » Tue Feb 28, 2017 5:30 pm

Why are you using an old and modified version of
Code: Select all
stoch_simul
? That explains the incompatibility with recent versions.
------------
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: Stochastic shocks in some periods- Iacoviello 2015

Postby leonard007 » Tue Feb 28, 2017 7:04 pm

yes, you are right. This old version is the problem. Actually It is what Prof. Iacoveillo put in the folder to run. I want to compare my results with his results so I run the .mod file he has provided, without considering the old version of stoch_simul in the folder.
Thank you for your great help.
Now I have my estimation .mod file, and I guess it works well. The acceptance rate is 22.97 . I have two question in accordance to my mod file (I attach here) :

1. If I add another parameter to estimate , like line 340 or 345 , the model does not work and I have an error. How can I fix it?
Error using chol
Matrix must be positive definite.
Error in posterior_sampler_initialization (line 84)
d = chol(vv);
Error in posterior_sampler (line 59)


2. in the model check plots, I have red dots that I cannot find why they are there. ( the pic in the attachment).

I appreciate your time and consideration
Sincerely,
Attachments
Parameters_1.zip
(55.12 KiB) Downloaded 85 times
leonard007
 
Posts: 54
Joined: Tue May 26, 2015 12:30 pm

Re: Stochastic shocks in some periods- Iacoviello 2015

Postby jpfeifer » Thu Mar 02, 2017 7:10 am

The red dots are points where the model solution could not be computed. That can be because the steady state could not be computed or the Blanchard-Kahn conditions are not satisfied. That ties in to your second question. As you can see in the mode_check plots, the mode is right at the boundary to the region where the model could be solved. As you do not have an interior solution, the Hessian will not be positive definite. The red dots are parameters for which Dynare could not compute the steady state.
------------
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: Stochastic shocks in some periods- Iacoviello 2015

Postby leonard007 » Thu Mar 02, 2017 9:00 am

Thank you.
So the way to fixing could be adding external steady state file? or something else should be done?
I added the external steady state, now dynare can solve with "mode_compute=4", and there is no negativity, but still there is red dots in two plots, this makes a problem in the estimation?
leonard007
 
Posts: 54
Joined: Tue May 26, 2015 12:30 pm

Re: Stochastic shocks in some periods- Iacoviello 2015

Postby jpfeifer » Thu Mar 02, 2017 12:21 pm

In the unstable version, you can use
Code: Select all
options_.debug=1

to get information on the error code giving rise to the red dots. Sometimes it is BK violations, which are not problematic from a programming perspective (but perhaps from an economic perspective)
------------
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: Stochastic shocks in some periods- Iacoviello 2015

Postby leonard007 » Thu Mar 02, 2017 2:57 pm

Thank you so much Professor Jpfeifer. Your helps always show us the best way.
Have a good day
leonard007
 
Posts: 54
Joined: Tue May 26, 2015 12:30 pm

Re: Stochastic shocks in some periods- Iacoviello 2015

Postby leonard007 » Fri Mar 03, 2017 10:12 am

Dear Professor Jpfeifer,

Considering the topic http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=10391 and your last reply on 05/Nov, is this issue now fixed in unstable version? I mean if we easily use stoch_simul right after estimation, dynare will consider mean instead of mode? or we should change it manually? I use unstable version of " dynare-2016-12-01-win".

Sincerely,
Leo
leonard007
 
Posts: 54
Joined: Tue May 26, 2015 12:30 pm

Re: Stochastic shocks in some periods- Iacoviello 2015

Postby jpfeifer » Fri Mar 03, 2017 3:42 pm

Dear Leo,
if the bug list http://www.dynare.org/DynareWiki/KnownBugs does not state
bug not yet fixed

then the bug has been fixed in the unstable version.
------------
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: Stochastic shocks in some periods- Iacoviello 2015

Postby leonard007 » Fri Mar 03, 2017 4:45 pm

Dear Professor Jpfeifer,
Thank you for the hint. So far I checked, apparently it was fixed.
I am sorry for lots of question I have. I attach my all files here. The problem is still
Error using chol
Matrix must be positive definite.
and the fact dynare cannot find the steady state. I provide an external steady state file, and as I checked manually, for a wide range of parameters it is able to compute the steady state perfectly. I guessed that the problem is my initial parameters value, so as you commented on http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=5358 I used
Code: Select all
estimated_params_init(use_calibration);
end;

but still the problem runs.
I checked the eigenvalues and there is no unit one,however there is an eigenvalue=1.003, so I use
Code: Select all
diffuse_filter
but still nothing is fixed.
I was wondering if there is a solution for this problem?

Ps: Once I ran the codes with
Code: Select all
mode_compute=6
then I put the posterior mean as the prior mean of the parameters for a new computing with
Code: Select all
mode_compute=4

Sincerely,
Leo
Attachments
Credit_crunch.zip
(23.93 KiB) Downloaded 99 times
leonard007
 
Posts: 54
Joined: Tue May 26, 2015 12:30 pm

Next

Return to Dynare contributions and examples

Who is online

Users browsing this forum: No registered users and 3 guests