IRF second order with large shock, Dynare 4.2.1

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.

IRF second order with large shock, Dynare 4.2.1

Postby 616Dynare » Tue Apr 03, 2012 9:27 am

Hi,

I tried to replicate the IRF of Dynare 4.2.1 for 2nd-order approximation, using Dynare's policy functions. It seems to be fine for small shocks, but for large shocks there is a difference between Dynare-based irfs and irfs computed using Dynare's policy functions (I eliminate the issues regarding the seed, drop periods, etc. by fixing the seed for random numbers and looking at only one shock). I attach the Dynare file and a file that computes the IRFs and plots the differences. There are even small differences for the shock process (z), which seems particularly strange. Am I just being silly and overlooking something?

Thanx a lot!

P.S.: In fact, e1 in Dynare's irf is 0.070000000000071. Shouldn't it be just 0.07 if the shock is 0.07?
P.P.S.: To follow up: Controlling for the seed within the .mod file does not seem to work. If I control for the random number seed in Dynare's irf.m file (just before ex1(:,i_exo_var) = randn(long+drop,nxs)*chol_S;), then this guarantees that Dynare's and my IRFs are based on exactly the same random numbers. However, the issue with e1 remains - the shock size in Dynare is slightly different (e1=0.070000000000071 instead of 0.07). I guess this is a numerical issue, but it might nevertheless be annoying if one wants to compare accuracy...
Attachments
IRF2nd_SimpleGrowth.m
This one plots the irfs and differences
(2.62 KiB) Downloaded 88 times
SimpleGrowth.mod
Dynare file
(644 Bytes) Downloaded 85 times
616Dynare
 
Posts: 2
Joined: Tue Apr 03, 2012 8:47 am

Re: IRF second order with large shock, Dynare 4.2.1

Postby jpfeifer » Wed Apr 18, 2012 7:01 pm

Your problem is line 154 of stoch_simul. To avoid problems with semidefinite covariance matrices, Dynare adds 1e-14 to the covariance matrix:
Code: Select all
    SS(M_.exo_names_orig_ord,M_.exo_names_orig_ord)=M_.Sigma_e+1e-14*eye(M_.exo_nbr);

before doing a Cholesky decomposition. If you comment out the plus part, everything should be fine.
------------
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: IRF second order with large shock, Dynare 4.2.1

Postby 616Dynare » Wed Apr 25, 2012 2:54 pm

Excellent! Thank you very much!
616Dynare
 
Posts: 2
Joined: Tue Apr 03, 2012 8:47 am


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 5 guests