# Tips to help convergence of deterministic simulations

Hello Dynare team,

First of all, thank you for your availability and for the wonderful tool you provide!

My question is related to what has already been expressed on this forum, but I think goes a step further. I am trying to compute non-linear deterministic simulations using a rather big model (>100 endogenous variables, ~40 of them being dynamic). This is a Smets & Wouters type of NK model, but with two countries in a Monetary Union, Calvo prices and wages. So far, I have used it (successfully) to study cross-country spillovers, with linear simulations. For my research, I need to study how this model behaves with bigger fiscal shocks (>1% of GDP, over several quarters), taking non linearity into account.

The problem is, once write my model in levels and try to launch simul, I run into a convergence problem even for relatively small shocks. I tried the usual and extended the number of simulation periods, it allows me to simulate responses to slightly bigger shocks, but there’s a point where even that does not work.

I tried everything I could (change algo, use bytecode, block, differentiate_forward_vars…). What annoys me is that I have the code for another big model and simul has no problem computing responses to very big shocks in that model.

So I guess my question is : are there ways to write the model equations or modeling assumptions that we know simplify calculations? Where should I look first? For instance, should I try to reduce the number of equations or the complexity of each equation? Should I avoid quotients when possible? Does it matter?

PS : BK conditions are met, I can compute the steady state with an external solver, and I have tried several calibrations. The convergence problem is still there even when I get rid of the “à la Calvo” sticky prices, which are the most complicated equations.

Do you model the variables in levels or log-levels? That would be a first source of problems. Did you check whether your model works as expected? The simulation you conducted in the linearized model shock work in the nonlinear one as well. Have you tried the current unstable version, where homotopy works?

Dear Johannes,

thank you for your quick reply and your advice. In the meantime, I started working on a model that I know is supposed to work and that you know perfectly well, the Fernandez Villaverde et al model of 2006. This one : github.com/DynareTeam/dynare/bl … seline.mod. My model is very similar to this one, but with two countries and a fiscal block.

The thing is, I run into the same problem with NK_baseline as with my model : big shocks lead to divergence of deterministic simulation. For example, a temporary labour productivity growth increase of 5% during 10 periods make NK_baseline diverge with the current calibration… (I know it’s a very big shock, but I will later need to study strategic gov behavior and simulate unexpected fiscal shocks over a big grid in order to ensure that the Nash and cooperative optima are within my grid, and that behavior indeed becomes suboptimal beyond a certain point).

So I tried your solution. Indeed, when I write everything in log levels, I can simulate bigger shocks, but I still run into a divergence problem after a point. I looked at what happens around the divergence point, and it seems that the problem comes from the recursive term of the wage setting curve (the f variable in NK_baseline). For big TFP shocks, this term, equivalent to the current value of all future wages (or equivalently to all future marginal disutility of labour) for a given reset wage, approaches zero. Which is absurd from an economic standpoint. With lower rigidities, I can therefore simulate bigger shocks.

So it seems the issue comes from the Calvo assumption. I know there are problems with Calvo prices: theoretically, it’s rational to deviate if the incentive is enormous, so the probability to deviate is endogenous. But it seems there are numerical problem also. Have you already encountered such an issue?

I am still running Dynare 4.4.3, I will try with the unstable version to see if it changes (still have trouble installing it), but I think the problem is not numerical…

Jocelyn

EDIT : Okay, installed unstable version, it does not change anything!

But I like the new iteration default reporting

But if divergence is a consistent feature of your simulations it might indicate that the model simply is not globally stable and your shocks bring you out of the convergence radius. The Calvo pricing introduces very strong nonlinearities. You might want to try Rotemberg pricing instead.

Hi

Apologies for refering to this issue again but i face a similar problem. I have a 3 period standard OLG model where I am experimenting with permanent fiscal policy changes. While the linearized version of the model works perfect<a class=“attachment” (using stock_simul) when I want to perform a deterministic simulation using the simul command the model fails to converge even for really really small shocks. I do not know if there is something wrong with the model or a theoretical one. I post the mod file if it helps. Any tips or advice on how to check for these issues (matrix singularity, no convergence)?

p.s: i am using Dynare 4.4.3

OLG_v3_simul.mod (7.4 KB)