I am using 4.0.4, and I have a simple Dynare model that behaves as follows. When I do stoch_simul(order=1), everything works fine and I see four sets of impulse response graphs. However, when I do stoch_simul(order=2), Dynare appears to solve the model successfully, but no impulse response graphs appear. Has anyone run into this? Is it (possibly) a bug in 4.0.4? I am new to Dynare, so I may well be missing something.
More details: when I run Dynare on Villaverde’s rbc.mod (from the ‘examples’ section of the website), the impulse response graphs appear both for first order and second order. However, for my model, they appear at first order only. I believe Dynare has solved my model successfully to second order, because I see nonzero coefficients on cross-product terms in the policy and transition functions table. Dynare also displays theoretical moments, variance decomposition, matrix of correlations and coefficients of autocorrelation. Just no impulse response graphs at second order. I can provide my mod file if that would help.
Here’s an update. When I look at oo_.irfs (at second order), I see all NaNs. Also, when I turn the “simul” flag on, all the simulated moments are also NaN. I went a little deeper and stepped through stoch_simul (and dependent functions) in the debugger. I noticed that my simulated endogenous variables grew very quickly in magnitude with each iterated period. Sure enough, after about five periods, all the simulated variables were NaN.
So it looks like I have an explosive model, at least to second order. What confuses me a bit is that the Blanchard-Kahn condition was satisfied, and Dynare did find a unique solution for the policy and transition functions. I also get well-defined theoretical moments. I thought that if Blanchard-Kahn was satisfied, the resulting solution was theoretically non-explosive?
I do suspect the “cuplrit” here is a near-unit-root in the model. I have a two-country international model with incomplete markets; without any frictions, such models have a unit root in the state variable for (relative) wealth. I’ve imposed a portfolio adjustment cost (similar to Schmitt-Grohe and Uribe (2003)), which should make the model theoretically stationary. However, perhaps it is “close enough” to being nonstationary that the Monte Carlo simulations fail.
So, does anyone out there have experience simulating international models with near-unit-roots in Dynare? Any ideas/workarounds for getting Monte Carlo simulations to work in this type of environment? As a newbie to Dynare, I appreciate any thoughts or advice.
I think I fixed my problem. My shock variances were way too high. When I reset the shock variances to something reasonable (0.01^2 instead of 1), everything worked fine. With the variances accidentally that high and the reversion back to steady-state fairly slow, the simulation was probably wandering very far from the steady state, where the dynamics are not very accurate.
It might be nice if MATLAB displayed an error for this case. For example, if the Monte Carlo simulation in simult_ yields (absolute) values for endogenous variables that are above a certain threshold, error out with a message like “Error simulating the model. The model appears explosive using the shock variances supplied. Ensure that the model is stationary and/or consider trying smaller shock variances.”
Anyway, I’m glad to be back in business (for the moment).
Stephan has now posted a version of Chris Sims’ pruning algorithm for Dynare 4.0.4 here:
This may be helpful if you’re encountering explosive IRFs and simulations at second-order, even though your model is stable to first-order. It was very helpful for me. Read Kim, Kim, Schaumberg and Sims (JEDC 2008) for details.
Thank you for this post, I have the same issue and reducing the shock variances or using the pruning algorithm helps. I just want to add that this algorithm is included in Dynare versions 4.3 and higher. Simply include the option ‘pruning’ into stoch_simul().