IRF second order with large shock, Dynare 4.2.1
Posted: 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...
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...